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
Léo-Paul Géneau
gitlab-ce
Commits
2398af9a
Commit
2398af9a
authored
Dec 22, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed wierd gitlab markdown issue
parent
cec866a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
lib/redcarpet/render/gitlab_html.rb
lib/redcarpet/render/gitlab_html.rb
+10
-3
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+2
-2
No files found.
lib/redcarpet/render/gitlab_html.rb
View file @
2398af9a
...
...
@@ -13,10 +13,17 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
options
=
{
options:
{
encoding:
'utf-8'
}
}
options
.
merge!
(
lexer:
language
.
downcase
)
if
Pygments
::
Lexer
.
find
(
language
)
# New lines are placed to fix an rendering issue
# with code wrapped inside <h1> tag for next case:
#
# # Title kinda h1
#
# ruby code here
#
<<-
HTML
<div class="
#{
h
.
user_color_scheme_class
}
">
#{
Pygments
.
highlight
(
code
,
options
)
}
</div>
<div class="
#{
h
.
user_color_scheme_class
}
">
#{
Pygments
.
highlight
(
code
,
options
)
}
</div>
HTML
end
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
2398af9a
...
...
@@ -331,9 +331,9 @@ describe GitlabMarkdownHelper do
it
"should leave code blocks untouched"
do
helper
.
stub
(
:user_color_scheme_class
).
and_return
(
:white
)
helper
.
markdown
(
"
\n
some code from $
#{
snippet
.
id
}
\n
here too
\n
"
).
should
==
"<div class=
\"
white
\"
><div class=
\"
highlight
\"
><pre><span class=
\"
n
\"
>some</span> <span class=
\"
n
\"
>code</span> <span class=
\"
n
\"
>from</span> $
#{
snippet
.
id
}
\n
<span class=
\"
n
\"
>here</span> <span class=
\"
n
\"
>too</span>
\n
</pre></div></div>"
helper
.
markdown
(
"
\n
some code from $
#{
snippet
.
id
}
\n
here too
\n
"
).
should
include
(
"<div class=
\"
white
\"
><div class=
\"
highlight
\"
><pre><span class=
\"
n
\"
>some</span> <span class=
\"
n
\"
>code</span> <span class=
\"
n
\"
>from</span> $
#{
snippet
.
id
}
\n
<span class=
\"
n
\"
>here</span> <span class=
\"
n
\"
>too</span>
\n
</pre></div></div>"
)
helper
.
markdown
(
"
\n
```
\n
some code from $
#{
snippet
.
id
}
\n
here too
\n
```
\n
"
).
should
==
"<div class=
\"
white
\"
><div class=
\"
highlight
\"
><pre><span class=
\"
n
\"
>some</span> <span class=
\"
n
\"
>code</span> <span class=
\"
n
\"
>from</span> $
#{
snippet
.
id
}
\n
<span class=
\"
n
\"
>here</span> <span class=
\"
n
\"
>too</span>
\n
</pre></div></div>"
helper
.
markdown
(
"
\n
```
\n
some code from $
#{
snippet
.
id
}
\n
here too
\n
```
\n
"
).
should
include
(
"<div class=
\"
white
\"
><div class=
\"
highlight
\"
><pre><span class=
\"
n
\"
>some</span> <span class=
\"
n
\"
>code</span> <span class=
\"
n
\"
>from</span> $
#{
snippet
.
id
}
\n
<span class=
\"
n
\"
>here</span> <span class=
\"
n
\"
>too</span>
\n
</pre></div></div>"
)
end
it
"should leave inline code untouched"
do
...
...
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