Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fork of markdown-it-katex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Postal Owl
Fork of markdown-it-katex
Commits
332d6e41
Commit
332d6e41
authored
6 years ago
by
iktakahiro
Browse files
Options
Downloads
Plain Diff
Merge branch 'release/3.0.4'
parents
9fc7e66d
e8e33840
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
index.js
+12
-3
12 additions, 3 deletions
index.js
package.json
+1
-1
1 addition, 1 deletion
package.json
with
13 additions
and
4 deletions
index.js
+
12
−
3
View file @
332d6e41
...
...
@@ -152,6 +152,15 @@ function math_block(state, start, end, silent){
return
true
;
}
function
escapeHtml
(
unsafe
)
{
return
unsafe
.
replace
(
/&/g
,
"
&
"
)
.
replace
(
/</g
,
"
<
"
)
.
replace
(
/>/g
,
"
>
"
)
.
replace
(
/"/g
,
"
"
"
)
.
replace
(
/'/g
,
"
'
"
);
}
module
.
exports
=
function
math_plugin
(
md
,
options
)
{
// Default options
...
...
@@ -165,7 +174,7 @@ module.exports = function math_plugin(md, options) {
}
catch
(
error
){
if
(
options
.
throwOnError
){
console
.
log
(
error
);
}
return
latex
;
return
`<span class='katex-error' title='
${
escapeHtml
(
error
.
toString
())}
'>
${
escapeHtml
(
latex
)}
</span>`
;
}
};
...
...
@@ -176,11 +185,11 @@ module.exports = function math_plugin(md, options) {
var
katexBlock
=
function
(
latex
){
options
.
displayMode
=
true
;
try
{
return
"
<p>
"
+
katex
.
renderToString
(
latex
,
options
)
+
"
</p>
"
;
return
"
<p
class='katex-block'
>
"
+
katex
.
renderToString
(
latex
,
options
)
+
"
</p>
"
;
}
catch
(
error
){
if
(
options
.
throwOnError
){
console
.
log
(
error
);
}
return
latex
;
return
`<p class='katex-block katex-error' title='
${
escapeHtml
(
error
.
toString
())}
'>
${
escapeHtml
(
latex
)}
</p>`
;
}
}
...
...
This diff is collapsed.
Click to expand it.
package.json
+
1
−
1
View file @
332d6e41
{
"name"
:
"@iktakahiro/markdown-it-katex"
,
"version"
:
"3.0.
3
"
,
"version"
:
"3.0.
4
"
,
"description"
:
"Fast math support for markdown-it with KaTeX"
,
"main"
:
"index.js"
,
"scripts"
:
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment