mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
Test site supports before=
and after=
search parameters.
They add text before/after the math. Example use: testing baseline alignment.
This commit is contained in:
@@ -30,6 +30,30 @@ function init() {
|
||||
macroString += "&" + match[0].substr(1);
|
||||
}
|
||||
|
||||
// The `before` search parameter puts normal text before the math.
|
||||
// The `after` search parameter puts normal text after the math.
|
||||
// Example use: testing baseline alignment.
|
||||
if (/(?:^\?|&)(?:before|after)=/.test(window.location.search)) {
|
||||
var mathContainer = math;
|
||||
mathContainer.id = "math-container";
|
||||
|
||||
if ((match = /(?:^\?|&)before=([^&]*)/.exec(window.location.search))) {
|
||||
var child = document.createTextNode(decodeURIComponent(match[1]));
|
||||
mathContainer.appendChild(child);
|
||||
macroString += "&" + match[0].substr(1);
|
||||
}
|
||||
|
||||
math = document.createElement("span");
|
||||
math.id = "math";
|
||||
mathContainer.appendChild(math);
|
||||
|
||||
if ((match = /(?:^\?|&)after=([^&]*)/.exec(window.location.search))) {
|
||||
var child = document.createTextNode(decodeURIComponent(match[1]));
|
||||
mathContainer.appendChild(child);
|
||||
macroString += "&" + match[0].substr(1);
|
||||
}
|
||||
}
|
||||
|
||||
reprocess();
|
||||
|
||||
function setSearch() {
|
||||
|
Reference in New Issue
Block a user