BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8bd9d096
Commit
8bd9d096
authored
Oct 02, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sh-thread-safe-markdown' into 'master'
Make Redcarpet Markdown renderer thread-safe Closes #36637 See merge request gitlab-org/gitlab-ce!14604
parents
b40192a9
15bebda7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
+19
-18
sh-thread-safe-markdown.yml
changelogs/unreleased/sh-thread-safe-markdown.yml
+5
-0
markdown_filter.rb
lib/banzai/filter/markdown_filter.rb
+14
-18
No files found.
changelogs/unreleased/sh-thread-safe-markdown.yml
0 → 100644
View file @
8bd9d096
---
title
:
Make Redcarpet Markdown renderer thread-safe
merge_request
:
author
:
type
:
fixed
lib/banzai/filter/markdown_filter.rb
View file @
8bd9d096
module
Banzai
module
Filter
class
MarkdownFilter
<
HTML
::
Pipeline
::
TextFilter
# https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
REDCARPET_OPTIONS
=
{
fenced_code_blocks:
true
,
footnotes:
true
,
lax_spacing:
true
,
no_intra_emphasis:
true
,
space_after_headers:
true
,
strikethrough:
true
,
superscript:
true
,
tables:
true
}.
freeze
def
initialize
(
text
,
context
=
nil
,
result
=
nil
)
super
text
,
context
,
result
@text
=
@text
.
delete
"
\r
"
...
...
@@ -13,27 +25,11 @@ module Banzai
end
def
self
.
renderer
@renderer
||=
begin
Thread
.
current
[
:banzai_markdown_renderer
]
||=
begin
renderer
=
Banzai
::
Renderer
::
HTML
.
new
Redcarpet
::
Markdown
.
new
(
renderer
,
redcarpet_options
)
Redcarpet
::
Markdown
.
new
(
renderer
,
REDCARPET_OPTIONS
)
end
end
def
self
.
redcarpet_options
# https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
@redcarpet_options
||=
{
fenced_code_blocks:
true
,
footnotes:
true
,
lax_spacing:
true
,
no_intra_emphasis:
true
,
space_after_headers:
true
,
strikethrough:
true
,
superscript:
true
,
tables:
true
}.
freeze
end
private_class_method
:redcarpet_options
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment