Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
df9a992c
Commit
df9a992c
authored
Apr 16, 2015
by
Vinnie Okada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GFM extractions
Extract and re-insert links after sanitizing user markup.
parent
9deda682
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+13
-13
No files found.
lib/gitlab/markdown.rb
View file @
df9a992c
...
@@ -60,21 +60,8 @@ module Gitlab
...
@@ -60,21 +60,8 @@ module Gitlab
@html_options
=
html_options
@html_options
=
html_options
# Extract pre blocks so they are not altered
# from http://github.github.com/github-flavored-markdown/
text
.
gsub!
(
%r{<pre>.*?</pre>|<code>.*?</code>}m
)
{
|
match
|
extract_piece
(
match
)
}
# Extract links with probably parsable hrefs
text
.
gsub!
(
%r{<a.*?>.*?</a>}m
)
{
|
match
|
extract_piece
(
match
)
}
# Extract images with probably parsable src
text
.
gsub!
(
%r{<img.*?>}m
)
{
|
match
|
extract_piece
(
match
)
}
# TODO: add popups with additional information
# TODO: add popups with additional information
# Insert pre block extractions
text
.
gsub!
(
/\{gfm-extraction-(\h{32})\}/
)
do
insert_piece
(
$1
)
end
# Used markdown pipelines in GitLab:
# Used markdown pipelines in GitLab:
# GitlabEmojiFilter - performs emoji replacement.
# GitlabEmojiFilter - performs emoji replacement.
# SanitizationFilter - remove unsafe HTML tags and attributes
# SanitizationFilter - remove unsafe HTML tags and attributes
...
@@ -118,8 +105,21 @@ module Gitlab
...
@@ -118,8 +105,21 @@ module Gitlab
text
=
result
[
:output
].
to_html
(
save_with:
saveoptions
)
text
=
result
[
:output
].
to_html
(
save_with:
saveoptions
)
# Extract pre blocks so they are not altered
# from http://github.github.com/github-flavored-markdown/
text
.
gsub!
(
%r{<pre>.*?</pre>|<code>.*?</code>}m
)
{
|
match
|
extract_piece
(
match
)
}
# Extract links with probably parsable hrefs
text
.
gsub!
(
%r{<a.*?>.*?</a>}m
)
{
|
match
|
extract_piece
(
match
)
}
# Extract images with probably parsable src
text
.
gsub!
(
%r{<img.*?>}m
)
{
|
match
|
extract_piece
(
match
)
}
text
=
parse
(
text
,
project
)
text
=
parse
(
text
,
project
)
# Insert pre block extractions
text
.
gsub!
(
/\{gfm-extraction-(\h{32})\}/
)
do
insert_piece
(
$1
)
end
if
options
[
:parse_tasks
]
if
options
[
:parse_tasks
]
text
=
parse_tasks
(
text
)
text
=
parse_tasks
(
text
)
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