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
Boxiang Sun
gitlab-ce
Commits
e818195b
Commit
e818195b
authored
May 30, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes multi-line math in notebooks
Closes #30900
parent
374486fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
app/assets/javascripts/notebook/cells/markdown.vue
app/assets/javascripts/notebook/cells/markdown.vue
+15
-7
No files found.
app/assets/javascripts/notebook/cells/markdown.vue
View file @
e818195b
...
...
@@ -30,7 +30,7 @@
|
\\s\\$(?!\\$)
)
(
.
+?)
(
(.|\\n)
+?)
(
\\s\\\\end{[a-zA-Z]+}$
|
...
...
@@ -45,15 +45,23 @@
let
inline
=
false
;
if
(
typeof
katex
!==
'
undefined
'
)
{
const
katexString
=
text
.
replace
(
/
\\
/g
,
'
\\
'
);
const
matches
=
new
RegExp
(
katexRegexString
,
'
gi
'
).
exec
(
katexString
);
const
katexString
=
text
.
replace
(
/&/g
,
'
&
'
)
.
replace
(
/&=&/g
,
'
\\
&=
\\
&
'
)
.
replace
(
/<
(\/?)
em>/g
,
''
);
const
regex
=
new
RegExp
(
katexRegexString
,
'
gi
'
);
const
numberOfMatches
=
katexString
.
match
(
regex
);
if
(
matches
&&
matches
.
length
>
0
)
{
if
(
matches
[
1
].
trim
()
===
'
$
'
&&
matches
[
3
].
trim
()
===
'
$
'
)
{
if
(
numberOfMatches
&&
numberOfMatches
.
length
!==
0
)
{
if
(
numberOfMatches
.
length
>
1
)
{
let
matches
=
regex
.
exec
(
katexString
);
inline
=
true
;
text
=
`
${
katexString
.
replace
(
matches
[
0
],
''
)}
${
katex
.
renderToString
(
matches
[
2
])}
`
;
while
(
matches
!==
null
)
{
text
=
`
${
text
.
replace
(
matches
[
0
],
katex
.
renderToString
(
matches
[
0
].
replace
(
/
\$
/g
,
''
)))}
`
;
matches
=
regex
.
exec
(
katexString
);
}
}
else
{
const
matches
=
regex
.
exec
(
katexString
);
text
=
katex
.
renderToString
(
matches
[
2
]);
}
}
...
...
@@ -79,7 +87,7 @@
},
computed
:
{
markdown
()
{
return
marked
(
this
.
cell
.
source
.
join
(
''
));
return
marked
(
this
.
cell
.
source
.
join
(
''
)
.
replace
(
/
\\
/g
,
'
\\\\
'
)
);
},
},
};
...
...
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