1
0

add initial marp implementation with sample content and build configuration

This commit is contained in:
2025-09-13 18:13:22 +02:00
parent dcacc9b409
commit e5f219507f
10319 changed files with 1402023 additions and 0 deletions

42
node_modules/mathjax-full/ts/handlers/html.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
/*************************************************************
*
* Copyright (c) 2017-2022 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Registers the HTML document type
*
* @author dpvc@mathjax.org (Davide Cervone)
*/
import {mathjax} from '../mathjax.js';
import {HTMLHandler} from './html/HTMLHandler.js';
import {DOMAdaptor} from '../core/DOMAdaptor.js';
/**
* Create the HTML handler object and register it with MathJax.
*
* @param {DOMAdaptor<N,T,D>} adaptor The DOM adaptor to use with HTML
* @return {HTMLHandler} The newly created handler
*
* @template N The HTMLElement node class
* @template T The Text node class
* @template D The Document class
*/
export function RegisterHTMLHandler<N, T, D>(adaptor: DOMAdaptor<N, T, D>): HTMLHandler<N, T, D> {
const handler = new HTMLHandler<N, T, D>(adaptor);
mathjax.handlers.register(handler);
return handler;
}

View File

@@ -0,0 +1,288 @@
/*************************************************************
*
* Copyright (c) 2017-2022 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Implements the HTMLDocument class
*
* @author dpvc@mathjax.org (Davide Cervone)
*/
import {AbstractMathDocument} from '../../core/MathDocument.js';
import {userOptions, separateOptions, OptionList, expandable} from '../../util/Options.js';
import {HTMLMathItem} from './HTMLMathItem.js';
import {HTMLMathList} from './HTMLMathList.js';
import {HTMLDomStrings} from './HTMLDomStrings.js';
import {DOMAdaptor} from '../../core/DOMAdaptor.js';
import {InputJax} from '../../core/InputJax.js';
import {STATE, ProtoItem, Location} from '../../core/MathItem.js';
import {StyleList} from '../../util/StyleList.js';
/*****************************************************************/
/**
* List of Lists of pairs consisting of a DOM node and its text length
*
* These represent the Text elements that make up a single
* string in the list of strings to be searched for math
* (multiple consecutive Text nodes can form a single string).
*
* @template N The HTMLElement node class
* @template T The Text node class
*/
export type HTMLNodeArray<N, T> = [N | T, number][][];
/*****************************************************************/
/**
* The HTMLDocument class (extends AbstractMathDocument)
*
* @template N The HTMLElement node class
* @template T The Text node class
* @template D The Document class
*/
export class HTMLDocument<N, T, D> extends AbstractMathDocument<N, T, D> {
/**
* The kind of document
*/
public static KIND: string = 'HTML';
/**
* The default options for HTMLDocument
*/
public static OPTIONS: OptionList = {
...AbstractMathDocument.OPTIONS,
renderActions: expandable({
...AbstractMathDocument.OPTIONS.renderActions,
styles: [STATE.INSERTED + 1, '', 'updateStyleSheet', false] // update styles on a rerender() call
}),
MathList: HTMLMathList, // Use the HTMLMathList for MathLists
MathItem: HTMLMathItem, // Use the HTMLMathItem for MathItem
DomStrings: null // Use the default DomString parser
};
/**
* Extra styles to be included in the document's stylesheet (added by extensions)
*/
protected styles: StyleList[];
/**
* The DomString parser for locating the text in DOM trees
*/
public domStrings: HTMLDomStrings<N, T, D>;
/**
* @override
* @constructor
* @extends {AbstractMathDocument}
*/
constructor(document: any, adaptor: DOMAdaptor<N, T, D>, options: OptionList) {
let [html, dom] = separateOptions(options, HTMLDomStrings.OPTIONS);
super(document, adaptor, html);
this.domStrings = this.options['DomStrings'] || new HTMLDomStrings<N, T, D>(dom);
this.domStrings.adaptor = adaptor;
this.styles = [];
}
/**
* Creates a Location object for a delimiter at the position given by index in the N's string
* of the array of strings searched for math, recovering the original DOM node where the delimiter
* was found.
*
* @param {number} N The index of the string in the string array
* @param {number} index The position within the N's string that needs to be found
* @param {string} delim The delimiter for this position
* @param {HTMLNodeArray} nodes The list of node lists representing the string array
* @return {Location} The Location object for the position of the delimiter in the document
*/
protected findPosition(N: number, index: number, delim: string, nodes: HTMLNodeArray<N, T>): Location<N, T> {
const adaptor = this.adaptor;
for (const list of nodes[N]) {
let [node, n] = list;
if (index <= n && adaptor.kind(node) === '#text') {
return {node: node, n: Math.max(index, 0), delim: delim};
}
index -= n;
}
return {node: null, n: 0, delim: delim};
}
/**
* Convert a ProtoItem to a MathItem (i.e., determine the actual Location
* objects for its start and end)
*
* @param {ProtoItem} item The proto math item to turn into an actual MathItem
* @param {InputJax} jax The input jax to use for the MathItem
* @param {HTMLNodeArray} nodes The array of node lists that produced the string array
* @return {HTMLMathItem} The MathItem for the given proto item
*/
protected mathItem(item: ProtoItem<N, T>, jax: InputJax<N, T, D>,
nodes: HTMLNodeArray<N, T>): HTMLMathItem<N, T, D> {
let math = item.math;
let start = this.findPosition(item.n, item.start.n, item.open, nodes);
let end = this.findPosition(item.n, item.end.n, item.close, nodes);
return new this.options.MathItem(math, jax, item.display, start, end) as HTMLMathItem<N, T, D>;
}
/**
* Find math within the document:
* Get the list of containers (default is document.body), and for each:
* For each input jax:
* Make a new MathList to store the located math
* If the input jax processes strings:
* If we haven't already made the string array and corresponding node list, do so
* Ask the jax to find the math in the string array, and
* for each one, push it onto the math list
* Otherwise (the jax processes DOM nodes):
* Ask the jax to find the math in the container, and
* for each one, make the result into a MathItem, and push it on the list
* Merge the new math list into the document's math list
* (we use merge to maintain a sorted list of MathItems)
*
* @override
*/
public findMath(options: OptionList) {
if (!this.processed.isSet('findMath')) {
this.adaptor.document = this.document;
options = userOptions({elements: this.options.elements || [this.adaptor.body(this.document)]}, options);
for (const container of this.adaptor.getElements(options['elements'], this.document)) {
let [strings, nodes] = [null, null] as [string[], HTMLNodeArray<N, T>];
for (const jax of this.inputJax) {
let list = new (this.options['MathList'])();
if (jax.processStrings) {
if (strings === null) {
[strings, nodes] = this.domStrings.find(container);
}
for (const math of jax.findMath(strings)) {
list.push(this.mathItem(math, jax, nodes));
}
} else {
for (const math of jax.findMath(container)) {
let item: HTMLMathItem<N, T, D> =
new this.options.MathItem(math.math, jax, math.display, math.start, math.end);
list.push(item);
}
}
this.math.merge(list);
}
}
this.processed.set('findMath');
}
return this;
}
/**
* @override
*/
public updateDocument() {
if (!this.processed.isSet('updateDocument')) {
this.addPageElements();
this.addStyleSheet();
super.updateDocument();
this.processed.set('updateDocument');
}
return this;
}
/**
* Add any elements needed for the document
*/
protected addPageElements() {
const body = this.adaptor.body(this.document);
const node = this.documentPageElements();
if (node) {
this.adaptor.append(body, node);
}
}
/**
* Add the stylesheet to the document
*/
public addStyleSheet() {
const sheet = this.documentStyleSheet();
const adaptor = this.adaptor;
if (sheet && !adaptor.parent(sheet)) {
const head = adaptor.head(this.document);
let styles = this.findSheet(head, adaptor.getAttribute(sheet, 'id'));
if (styles) {
adaptor.replace(sheet, styles);
} else {
adaptor.append(head, sheet);
}
}
}
/**
* @param {N} head The document <head>
* @param {string} id The id of the stylesheet to find
* @param {N|null} The stylesheet with the given ID
*/
protected findSheet(head: N, id: string) {
if (id) {
for (const sheet of this.adaptor.tags(head, 'style')) {
if (this.adaptor.getAttribute(sheet, 'id') === id) {
return sheet;
}
}
}
return null as N;
}
/**
* @override
*/
public removeFromDocument(restore: boolean = false) {
if (this.processed.isSet('updateDocument')) {
for (const math of this.math) {
if (math.state() >= STATE.INSERTED) {
math.state(STATE.TYPESET, restore);
}
}
}
this.processed.clear('updateDocument');
return this;
}
/**
* @override
*/
public documentStyleSheet() {
return this.outputJax.styleSheet(this);
}
/**
* @override
*/
public documentPageElements() {
return this.outputJax.pageElements(this);
}
/**
* Add styles to be included in the document's stylesheet
*
* @param {StyleList} styles The styles to include
*/
public addStyles(styles: StyleList) {
this.styles.push(styles);
}
/**
* Get the array of document-specific styles
*/
public getStyles() {
return this.styles;
}
}

View File

@@ -0,0 +1,303 @@
/*************************************************************
*
* Copyright (c) 2017-2022 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Implements the HTMLDomStrings class
*
* @author dpvc@mathjax.org (Davide Cervone)
*/
import {userOptions, defaultOptions, OptionList, makeArray} from '../../util/Options.js';
import {DOMAdaptor} from '../../core/DOMAdaptor.js';
/**
* List of consecutive text nodes and their text lengths
*
* @template N The HTMLElement node class
* @template T The Text node class
*/
export type HTMLNodeList<N, T> = [N | T, number][];
/*****************************************************************/
/**
* The HTMLDocument class (extends AbstractMathDocument)
*
* A class for extracting the text from DOM trees
*
* @template N The HTMLElement node class
* @template T The Text node class
* @template D The Document class
*/
export class HTMLDomStrings<N, T, D> {
/**
* The default options for string processing
*/
public static OPTIONS: OptionList = {
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code', 'annotation', 'annotation-xml'],
// The names of the tags whose contents will not be
// scanned for math delimiters
includeHtmlTags: {br: '\n', wbr: '', '#comment': ''},
// tags to be included in the text (and what
// text to replace them with)
ignoreHtmlClass: 'mathjax_ignore', // the class name of elements whose contents should
// NOT be processed by tex2jax. Note that this
// is a regular expression, so be sure to quote any
// regexp special characters
processHtmlClass: 'mathjax_process' // the class name of elements whose contents SHOULD
// be processed when they appear inside ones that
// are ignored. Note that this is a regular expression,
// so be sure to quote any regexp special characters
};
/**
* The options for this instance
*/
protected options: OptionList;
/**
* The array of strings found in the DOM
*/
protected strings: string[];
/**
* The string currently being constructed
*/
protected string: string;
/**
* The list of nodes and lengths for the string being constructed
*/
protected snodes: HTMLNodeList<N, T>;
/**
* The list of node lists corresponding to the strings in this.strings
*/
protected nodes: HTMLNodeList<N, T>[];
/**
* The container nodes that are currently being traversed, and whether their
* contents are being ignored or not
*/
protected stack: [N | T, boolean][];
/**
* Regular expression for the tags to be skipped
* processing of math
*/
protected skipHtmlTags: RegExp;
/**
* Regular expression for which classes should stop processing of math
*/
protected ignoreHtmlClass: RegExp;
/**
* Regular expression for which classes should start processing of math
*/
protected processHtmlClass: RegExp;
/**
* The DOM Adaptor to managing HTML elements
*/
public adaptor: DOMAdaptor<N, T, D>;
/**
* @param {OptionList} options The user-supplied options
* @constructor
*/
constructor(options: OptionList = null) {
let CLASS = this.constructor as typeof HTMLDomStrings;
this.options = userOptions(defaultOptions({}, CLASS.OPTIONS), options);
this.init();
this.getPatterns();
}
/**
* Set the initial values of the main properties
*/
protected init() {
this.strings = [];
this.string = '';
this.snodes = [];
this.nodes = [];
this.stack = [];
}
/**
* Create the search patterns for skipHtmlTags, ignoreHtmlClass, and processHtmlClass
*/
protected getPatterns() {
let skip = makeArray(this.options['skipHtmlTags']);
let ignore = makeArray(this.options['ignoreHtmlClass']);
let process = makeArray(this.options['processHtmlClass']);
this.skipHtmlTags = new RegExp('^(?:' + skip.join('|') + ')$', 'i');
this.ignoreHtmlClass = new RegExp('(?:^| )(?:' + ignore.join('|') + ')(?: |$)');
this.processHtmlClass = new RegExp('(?:^| )(?:' + process + ')(?: |$)');
}
/**
* Add a string to the string array and record its node list
*/
protected pushString() {
if (this.string.match(/\S/)) {
this.strings.push(this.string);
this.nodes.push(this.snodes);
}
this.string = '';
this.snodes = [];
}
/**
* Add more text to the current string, and record the
* node and its position in the string.
*
* @param {N|T} node The node to be pushed
* @param {string} text The text to be added (it may not be the actual text
* of the node, if it is one of the nodes that gets
* translated to text, like <br> to a newline).
*/
protected extendString(node: N | T, text: string) {
this.snodes.push([node, text.length]);
this.string += text;
}
/**
* Handle a #text node (add its text to the current string)
*
* @param {T} node The Text node to process
* @param {boolean} ignore Whether we are currently ignoring content
* @return {N | T} The next element to process
*/
protected handleText(node: T, ignore: boolean): N | T {
if (!ignore) {
this.extendString(node, this.adaptor.value(node));
}
return this.adaptor.next(node);
}
/**
* Handle a BR, WBR, or #comment element (or others in the includeHtmlTags object).
*
* @param {N} node The node to process
* @param {boolean} ignore Whether we are currently ignoring content
* @return {N | T} The next element to process
*/
protected handleTag(node: N, ignore: boolean): N | T {
if (!ignore) {
let text = this.options['includeHtmlTags'][this.adaptor.kind(node)];
this.extendString(node, text);
}
return this.adaptor.next(node);
}
/**
* Handle an arbitrary DOM node:
* Check the class to see if it matches the processHtmlClass regex
* If the node has a child and is not marked as created by MathJax (data-MJX)
* and either it is marked as restarting processing or is not a tag to be skipped, then
* Save the next node (if there is one) and whether we are currently ignoring content
* Move to the first child node
* Update whether we are ignoring content
* Otherwise
* Move on to the next sibling
* Return the next node to process and the ignore state
*
* @param {N} node The node to process
* @param {boolean} ignore Whether we are currently ignoring content
* @return {[N|T, boolean]} The next element to process and whether to ignore its content
*/
protected handleContainer(node: N, ignore: boolean): [N | T, boolean] {
this.pushString();
const cname = this.adaptor.getAttribute(node, 'class') || '';
const tname = this.adaptor.kind(node) || '';
const process = this.processHtmlClass.exec(cname);
let next = node as N | T;
if (this.adaptor.firstChild(node) && !this.adaptor.getAttribute(node, 'data-MJX') &&
(process || !this.skipHtmlTags.exec(tname))) {
if (this.adaptor.next(node)) {
this.stack.push([this.adaptor.next(node), ignore]);
}
next = this.adaptor.firstChild(node);
ignore = (ignore || this.ignoreHtmlClass.exec(cname)) && !process;
} else {
next = this.adaptor.next(node);
}
return [next, ignore];
}
/**
* Handle an unknown node type (nodeType other than 1, 3, 8)
*
* @param {N} node The node to process
* @param {boolean} ignore Whether we are currently ignoring content
* @return {N|T} The next element to process
*/
protected handleOther(node: N, _ignore: boolean): N | T {
this.pushString();
return this.adaptor.next(node);
}
/**
* Find the strings for a given DOM element:
* Initialize the state
* Get the element where we stop processing
* While we still have a node, and it is not the one where we are to stop:
* If it is a text node, handle it and get the next node
* Otherwise, if it is in the includeHtmlTags list, handle it and get the next node
* Otherwise, handle it as a container and get the next node and ignore status
* If there is no next node, and there are more nodes on the stack:
* Save the current string, and pop the node and ignore status from the stack
* Push the final string
* Get the string array and array of associated DOM nodes
* Clear the internal values (so the memory can be freed)
* Return the strings and node lists
*
* @param {N} node The node to search
* @return {[string[], HTMLNodeList[]]} The array of strings and their associated lists of nodes
*/
public find(node: N | T): [string[], HTMLNodeList<N, T>[]] {
this.init();
let stop = this.adaptor.next(node);
let ignore = false;
let include = this.options['includeHtmlTags'];
while (node && node !== stop) {
const kind = this.adaptor.kind(node);
if (kind === '#text') {
node = this.handleText(node as T, ignore);
} else if (include.hasOwnProperty(kind)) {
node = this.handleTag(node as N, ignore);
} else if (kind) {
[node, ignore] = this.handleContainer(node as N, ignore);
} else {
node = this.handleOther(node as N, ignore);
}
if (!node && this.stack.length) {
this.pushString();
[node, ignore] = this.stack.pop();
}
}
this.pushString();
let result = [this.strings, this.nodes] as [string[], HTMLNodeList<N, T>[]];
this.init(); // free up memory
return result;
}
}

View File

@@ -0,0 +1,86 @@
/*************************************************************
*
* Copyright (c) 2017-2022 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Implements the HTMLHandler class
*
* @author dpvc@mathjax.org (Davide Cervone)
*/
import {AbstractHandler} from '../../core/Handler.js';
import {MinHTMLAdaptor} from '../../adaptors/HTMLAdaptor.js';
import {HTMLDocument} from './HTMLDocument.js';
import {OptionList} from '../../util/Options.js';
/*****************************************************************/
/**
* Implements the HTMLHandler class (extends AbstractHandler)
*
* @template N The HTMLElement node class
* @template T The Text node class
* @template D The Document class
*/
export class HTMLHandler<N, T, D> extends AbstractHandler<N, T, D> {
/**
* The DOMAdaptor for the document being handled
*/
public adaptor: MinHTMLAdaptor<N, T, D>; // declare a more specific adaptor type
/**
* @override
*/
public documentClass = HTMLDocument;
/**
* @override
*/
public handlesDocument(document: any) {
const adaptor = this.adaptor;
if (typeof(document) === 'string') {
try {
document = adaptor.parse(document, 'text/html');
} catch (err) {}
}
if (document instanceof adaptor.window.Document ||
document instanceof adaptor.window.HTMLElement ||
document instanceof adaptor.window.DocumentFragment) {
return true;
}
return false;
}
/**
* If the document isn't already a Document object, create one
* using the given data
*
* @override
*/
public create(document: any, options: OptionList) {
const adaptor = this.adaptor;
if (typeof(document) === 'string') {
document = adaptor.parse(document, 'text/html');
} else if (document instanceof adaptor.window.HTMLElement ||
document instanceof adaptor.window.DocumentFragment) {
let child = document as N;
document = adaptor.parse('', 'text/html');
adaptor.append(adaptor.body(document), child);
}
return super.create(document, options) as HTMLDocument<N, T, D>;
}
}

View File

@@ -0,0 +1,141 @@
/*************************************************************
*
* Copyright (c) 2017-2022 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Implements the HTMLMathItem class
*
* @author dpvc@mathjax.org (Davide Cervone)
*/
import {AbstractMathItem, Location, STATE} from '../../core/MathItem.js';
import {InputJax} from '../../core/InputJax.js';
import {HTMLDocument} from './HTMLDocument.js';
/*****************************************************************/
/**
* Implements the HTMLMathItem class (extends AbstractMathItem)
*
* @template N The HTMLElement node class
* @template T The Text node class
* @template D The Document class
*/
export class HTMLMathItem<N, T, D> extends AbstractMathItem<N, T, D> {
/**
* Easy access to DOM adaptor
*/
get adaptor() {
return this.inputJax.adaptor;
}
/**
* @override
*/
constructor(math: string, jax: InputJax<N, T, D>, display: boolean = true,
start: Location<N, T> = {node: null, n: 0, delim: ''},
end: Location<N, T> = {node: null, n: 0, delim: ''}) {
super(math, jax, display, start, end);
}
/**
* Insert the typeset MathItem into the document at the right location
* If the starting and ending nodes are the same:
* Split the text to isolate the math and its delimiters
* Replace the math by the typeset version
* Otherewise (spread over several nodes)
* Split the start node, if needed
* Remove nodes until we reach the end node
* Insert the math before the end node
* Split the end node, if needed
* Remove the end node
*
* @override
*/
public updateDocument(_html: HTMLDocument<N, T, D>) {
if (this.state() < STATE.INSERTED) {
if (this.inputJax.processStrings) {
let node = this.start.node as T;
if (node === this.end.node) {
if (this.end.n && this.end.n < this.adaptor.value(this.end.node).length) {
this.adaptor.split(this.end.node, this.end.n);
}
if (this.start.n) {
node = this.adaptor.split(this.start.node as T, this.start.n);
}
this.adaptor.replace(this.typesetRoot, node);
} else {
if (this.start.n) {
node = this.adaptor.split(node, this.start.n);
}
while (node !== this.end.node) {
let next = this.adaptor.next(node) as T;
this.adaptor.remove(node);
node = next;
}
this.adaptor.insert(this.typesetRoot, node);
if (this.end.n < this.adaptor.value(node).length) {
this.adaptor.split(node, this.end.n);
}
this.adaptor.remove(node);
}
} else {
this.adaptor.replace(this.typesetRoot, this.start.node);
}
this.start.node = this.end.node = this.typesetRoot;
this.start.n = this.end.n = 0;
this.state(STATE.INSERTED);
}
}
/**
* Update the style sheet for any changes due to rerendering
*
* @param {HTMLDocument} document The document whose styles are to be updated
*/
public updateStyleSheet(document: HTMLDocument<N, T, D>) {
document.addStyleSheet();
}
/**
* Remove the typeset math from the document, and put back the original
* expression and its delimiters, if requested.
*
* @override
*/
public removeFromDocument(restore: boolean = false) {
if (this.state() >= STATE.TYPESET) {
const adaptor = this.adaptor;
let node = this.start.node;
let math: N | T = adaptor.text('');
if (restore) {
let text = this.start.delim + this.math + this.end.delim;
if (this.inputJax.processStrings) {
math = adaptor.text(text);
} else {
const doc = adaptor.parse(text, 'text/html');
math = adaptor.firstChild(adaptor.body(doc));
}
}
if (adaptor.parent(node)) {
adaptor.replace(math, node);
}
this.start.node = this.end.node = math;
this.start.n = this.end.n = 0;
}
}
}

View File

@@ -0,0 +1,35 @@
/*************************************************************
*
* Copyright (c) 2017-2022 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Implements the HTMLMathList object
*
* @author dpvc@mathjax.org (Davide Cervone)
*/
import {AbstractMathList} from '../../core/MathList.js';
/*****************************************************************/
/**
* Implement the HTMLMathList class (extends AbstractMathList)
*
* @template N The HTMLElement node class
* @template T The Text node class
* @template D The Document class
*/
export class HTMLMathList<N, T, D> extends AbstractMathList<N, T, D> {
}