Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
38010360
Commit
38010360
authored
Mar 09, 2016
by
Nick Stenning
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3042 from hypothesis/remove-mathjax-fallback
Remove the MathJax math rendering fallback
parents
77db5fd6
715b1a52
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
29 deletions
+0
-29
markdown.js
h/static/scripts/directive/markdown.js
+0
-29
No files found.
h/static/scripts/directive/markdown.js
View file @
38010360
'use strict'
;
'use strict'
;
/* globals MathJax */
var
angular
=
require
(
'angular'
);
var
angular
=
require
(
'angular'
);
var
katex
=
require
(
'katex'
);
var
katex
=
require
(
'katex'
);
var
commands
=
require
(
'../markdown-commands'
);
var
commands
=
require
(
'../markdown-commands'
);
var
mediaEmbedder
=
require
(
'../media-embedder'
);
var
mediaEmbedder
=
require
(
'../media-embedder'
);
var
loadMathJax
=
function
()
{
if
(
!
(
typeof
MathJax
!==
"undefined"
&&
MathJax
!==
null
))
{
return
$
.
ajax
({
url
:
"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full"
,
dataType
:
'script'
,
cache
:
true
,
complete
:
function
()
{
// MathJax configuration overides.
return
MathJax
.
Hub
.
Config
({
showMathMenu
:
false
,
displayAlign
:
"left"
});
}
});
}
};
/**
/**
* @ngdoc directive
* @ngdoc directive
* @name markdown
* @name markdown
...
@@ -160,7 +141,6 @@ module.exports = function($filter, $sanitize, $sce) {
...
@@ -160,7 +141,6 @@ module.exports = function($filter, $sanitize, $sce) {
}
}
};
};
var
mathJaxFallback
=
false
;
var
renderInlineMath
=
function
(
textToCheck
)
{
var
renderInlineMath
=
function
(
textToCheck
)
{
var
re
=
/
\\?\\\(
|
\\?\\\)
/g
;
var
re
=
/
\\?\\\(
|
\\?\\\)
/g
;
var
startMath
=
null
;
var
startMath
=
null
;
...
@@ -188,8 +168,6 @@ module.exports = function($filter, $sanitize, $sce) {
...
@@ -188,8 +168,6 @@ module.exports = function($filter, $sanitize, $sce) {
endMath
=
null
;
endMath
=
null
;
return
renderInlineMath
(
textToCheck
);
return
renderInlineMath
(
textToCheck
);
}
catch
(
error
)
{
}
catch
(
error
)
{
loadMathJax
();
mathJaxFallback
=
true
;
$sanitize
(
textToCheck
.
substring
(
startMath
,
endMath
));
$sanitize
(
textToCheck
.
substring
(
startMath
,
endMath
));
}
}
}
}
...
@@ -228,8 +206,6 @@ module.exports = function($filter, $sanitize, $sce) {
...
@@ -228,8 +206,6 @@ module.exports = function($filter, $sanitize, $sce) {
// \\displaystyle tells KaTeX to render the math in display style (full sized fonts).
// \\displaystyle tells KaTeX to render the math in display style (full sized fonts).
return
katex
.
renderToString
(
$sanitize
(
"
\\
displaystyle {"
+
textToCheck
.
substring
(
startMath
,
index
)
+
"}"
));
return
katex
.
renderToString
(
$sanitize
(
"
\\
displaystyle {"
+
textToCheck
.
substring
(
startMath
,
index
)
+
"}"
));
}
catch
(
error
)
{
}
catch
(
error
)
{
loadMathJax
();
mathJaxFallback
=
true
;
return
$sanitize
(
textToCheck
.
substring
(
startMath
,
index
));
return
$sanitize
(
textToCheck
.
substring
(
startMath
,
index
));
}
}
}
else
{
}
else
{
...
@@ -260,11 +236,6 @@ module.exports = function($filter, $sanitize, $sce) {
...
@@ -260,11 +236,6 @@ module.exports = function($filter, $sanitize, $sce) {
}
}
var
value
=
ctrl
.
$viewValue
||
''
;
var
value
=
ctrl
.
$viewValue
||
''
;
output
.
innerHTML
=
renderMathAndMarkdown
(
value
);
output
.
innerHTML
=
renderMathAndMarkdown
(
value
);
if
(
mathJaxFallback
)
{
return
$timeout
((
function
()
{
return
((
typeof
MathJax
!==
"undefined"
&&
MathJax
!==
null
)
?
MathJax
.
Hub
:
undefined
).
Queue
([
'Typeset'
,
MathJax
.
Hub
,
output
]);
}),
0
,
false
);
}
};
};
// React to the changes to the input
// React to the changes to the input
...
...
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