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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c51e8241
Commit
c51e8241
authored
Apr 26, 2021
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix job failure
parent
a93fcc9f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
app/assets/javascripts/behaviors/markdown/render_math.js
app/assets/javascripts/behaviors/markdown/render_math.js
+6
-0
spec/features/markdown/math_spec.rb
spec/features/markdown/math_spec.rb
+15
-3
No files found.
app/assets/javascripts/behaviors/markdown/render_math.js
View file @
c51e8241
...
...
@@ -114,6 +114,12 @@ class SafeMathRenderer {
throwOnError
:
true
,
maxSize
:
20
,
maxExpand
:
20
,
trust
:
(
context
)
=>
// this config option restores the KaTeX pre-v0.11.0
// behavior of allowing certain commands and protocols
// eslint-disable-next-line @gitlab/require-i18n-strings
[
'
\\
url
'
,
'
\\
href
'
].
includes
(
context
.
command
)
&&
[
'
http
'
,
'
https
'
,
'
mailto
'
,
'
_relative
'
].
includes
(
context
.
protocol
),
});
}
catch
(
e
)
{
// Don't show a flash for now because it would override an existing flash message
...
...
spec/features/markdown/math_spec.rb
View file @
c51e8241
...
...
@@ -13,14 +13,24 @@ RSpec.describe 'Math rendering', :js do
```math
a^2+b^2=c^2
```
This math is aligned
```math
\\
begin{align*}
a&=b+c
\\\\
d+e&=f
\\
end{align*}
```
MATH
issue
=
create
(
:issue
,
project:
project
,
description:
description
)
visit
project_issue_path
(
project
,
issue
)
expect
(
page
).
to
have_selector
(
'.katex .mord.mathdefault'
,
text:
'b'
)
expect
(
page
).
to
have_selector
(
'.katex-display .mord.mathdefault'
,
text:
'b'
)
expect
(
page
).
to
have_selector
(
'.katex .mord.mathnormal'
,
text:
'b'
)
expect
(
page
).
to
have_selector
(
'.katex-display .mord.mathnormal'
,
text:
'b'
)
expect
(
page
).
to
have_selector
(
'.katex-display .mtable .col-align-l .mord.mathnormal'
,
text:
'f'
)
end
it
'only renders non XSS links'
do
...
...
@@ -35,7 +45,9 @@ RSpec.describe 'Math rendering', :js do
visit
project_issue_path
(
project
,
issue
)
page
.
within
'.description > .md'
do
expect
(
page
).
to
have_selector
(
'.katex-error'
)
# unfortunately there is no class selector for KaTeX's "unsupported command"
# formatting so we must match the style attribute
expect
(
page
).
to
have_selector
(
'.katex-html .mord[style="color:#cc0000;"]'
,
text:
'\href'
)
expect
(
page
).
to
have_selector
(
'.katex-html a'
,
text:
'Gitlab'
)
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