mirror of
https://github.com/MonitorControl/MonitorControl.git
synced 2026-05-18 06:05:54 -06:00
refactor: restructure directories
This commit is contained in:
parent
aff98e59f0
commit
6d31e0f1ad
16 changed files with 0 additions and 0 deletions
42
docs/scripts/marked-footnotes.min.js
vendored
42
docs/scripts/marked-footnotes.min.js
vendored
|
|
@ -1,42 +0,0 @@
|
|||
const footnoteMatch = /^\[\^([^\]]+)\]:([\s\S]*)$/;
|
||||
const referenceMatch = /\[\^([^\]]+)\](?!\()/g;
|
||||
const referencePrefix = "fnref";
|
||||
const footnotePrefix = "fn";
|
||||
const footnoteTemplate = (ref, text) => {
|
||||
return `<p id="${footnotePrefix}:${ref}">${ref}. ${text}</p>`;
|
||||
};
|
||||
const footnoteContainerTemplate = (text) => {
|
||||
return `<h3>Footnotes</h3>${text}`
|
||||
}
|
||||
const referenceTemplate = ref => {
|
||||
return `<sup id="${referencePrefix}:${ref}"><a href="#${footnotePrefix}:${ref}">[${ref}]</a></sup>`;
|
||||
};
|
||||
const interpolateReferences = (text) => {
|
||||
return text.replace(referenceMatch, (_, ref) => {
|
||||
return referenceTemplate(ref);
|
||||
});
|
||||
}
|
||||
const interpolateFootnotes = (text) => {
|
||||
const found = text.match(footnoteMatch)
|
||||
if (found) {
|
||||
const replacedText = text.replace(footnoteMatch, (_, value, text) => {
|
||||
return footnoteTemplate(value, text);
|
||||
});
|
||||
return footnoteContainerTemplate(replacedText)
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
const renderer = {
|
||||
paragraph(text) {
|
||||
return marked.Renderer.prototype.paragraph.apply(null, [
|
||||
interpolateReferences(interpolateFootnotes(text))
|
||||
]);
|
||||
},
|
||||
text(text) {
|
||||
return marked.Renderer.prototype.text.apply(null, [
|
||||
interpolateReferences(interpolateFootnotes(text))
|
||||
]);
|
||||
}
|
||||
};
|
||||
marked.use({ renderer });
|
||||
1
docs/scripts/marked.min.js
vendored
1
docs/scripts/marked.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue