Skip to content

Commit 4f951cf

Browse files
authored
Merge pull request #139 from mathjax/fix-jsdoc
Fix the comment open delimiter for jsdoc comments
2 parents 670681b + 8ac75cf commit 4f951cf

File tree

125 files changed

+2505
-2518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+2505
-2518
lines changed

mathjax3-ts/adaptors/HTMLAdaptor.ts

Lines changed: 56 additions & 70 deletions
Large diffs are not rendered by default.

mathjax3-ts/adaptors/browserAdaptor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ declare global {
3737
}
3838
}
3939

40-
/*
40+
/**
4141
* Function to create an HTML adpator for browsers
42+
*
43+
* @return {HTMLAdaptor} The newly created adaptor
4244
*/
4345
export function browserAdaptor() {
4446
return new HTMLAdaptor<HTMLElement, Text, Document>(window);

mathjax3-ts/adaptors/chooseAdaptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ try {
3434
choose = liteAdaptor;
3535
}
3636

37-
/*
37+
/**
3838
* Function to selecting which adaptor to use (depending on whether we are in a browser of node.js)
3939
*/
4040
export const chooseAdaptor = choose;

mathjax3-ts/adaptors/jsdomAdaptor.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@
2323

2424
import {HTMLAdaptor} from './HTMLAdaptor.js';
2525

26-
/*
26+
/**
2727
* Function for creating an HTML adaptor using jsdom
28+
*
29+
* @param {any} JSDOM The jsdom object to use for this adaptor
30+
* @return {HTMLAdaptor} The newly created adaptor
2831
*/
2932
export function jsdomAdaptor(JSDOM: any) {
3033
return new HTMLAdaptor<HTMLElement, Text, Document>(new JSDOM().window);

mathjax3-ts/adaptors/lite/Document.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,25 @@
2424
import {LiteElement} from './Element.js';
2525

2626
/************************************************************/
27-
/*
27+
/**
2828
* Implements a lightweight Document replacement
2929
*/
3030
export class LiteDocument {
31-
/*
31+
/**
3232
* The <html>, <head>, and <body> elements
3333
*/
3434
public root: LiteElement;
3535
public head: LiteElement;
3636
public body: LiteElement;
3737

38-
/*
38+
/**
3939
* The kind is always #document
4040
*/
4141
public get kind() {
4242
return '#document';
4343
}
4444

45-
/*
45+
/**
4646
* @constructor
4747
*/
4848
constructor() {

mathjax3-ts/adaptors/lite/Element.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,51 +25,51 @@ import {OptionList} from '../../util/Options.js';
2525
import {Styles} from '../../util/Styles.js';
2626
import {LiteText} from './Text.js';
2727

28-
/*
28+
/**
2929
* Type for attribute lists
3030
*/
3131
export type LiteAttributeList = OptionList;
3232

33-
/*
33+
/**
3434
* Type for generic nodes in LiteAdaptor
3535
*/
3636
export type LiteNode = LiteElement | LiteText;
3737

3838

3939
/************************************************************/
40-
/*
40+
/**
4141
* Implements a lightweight HTML element replacement
4242
*/
4343
export class LiteElement {
44-
/*
44+
/**
4545
* The type of element (tag name)
4646
*/
4747
public kind: string;
4848

49-
/*
49+
/**
5050
* The element's attribute list
5151
*/
5252
public attributes: LiteAttributeList;
5353

54-
/*
54+
/**
5555
* The element's children
5656
*/
5757
public children: LiteNode[];
5858

59-
/*
59+
/**
6060
* The element's parent
6161
*/
6262
public parent: LiteElement;
6363

64-
/*
64+
/**
6565
* The styles for the element
6666
*/
6767
public styles: Styles;
6868

69-
/*
70-
* @param{string} kind The type of node to create
71-
* @param{LiteAttributeList} attributes The list of attributes to set (if any)
72-
* @param{LiteNode[]} children The children for the node (if any)
69+
/**
70+
* @param {string} kind The type of node to create
71+
* @param {LiteAttributeList} attributes The list of attributes to set (if any)
72+
* @param {LiteNode[]} children The children for the node (if any)
7373
* @constructor
7474
*/
7575
constructor(kind: string, attributes: LiteAttributeList = {}, children: LiteNode[] = []) {

mathjax3-ts/adaptors/lite/List.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,33 @@
2424
import {LiteNode} from './Element.js';
2525

2626
/************************************************************/
27-
/*
27+
/**
2828
* Implements a lightweight DocumentFragment or NodeList replacement
29-
*/
30-
31-
/*
29+
*
3230
* @template N The HTMLElement node class
3331
*/
3432
export class LiteList<N> {
35-
/*
33+
/**
3634
* The nodes held in the fragment
3735
*/
3836
public nodes: N[] = [];
3937

40-
/*
41-
* @param{N[]} children The children for the fragment
38+
/**
39+
* @param {N[]} children The children for the fragment
4240
* @constructor
4341
*/
4442
constructor(children: N[]) {
4543
this.nodes = [...children];
4644
}
4745

48-
/*
49-
* @param{N} node A node to append to the fragment
46+
/**
47+
* @param {N} node A node to append to the fragment
5048
*/
5149
public append(node: N) {
5250
this.nodes.push(node);
5351
}
5452

55-
/*
53+
/**
5654
* Make this class iterable (so it can be used with Array.from())
5755
*/
5856
public [Symbol.iterator](): Iterator<LiteNode> {

mathjax3-ts/adaptors/lite/Parser.ts

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {LiteElement} from './Element.js';
2929
import {LiteText, LiteComment} from './Text.js';
3030
import {LiteAdaptor} from '../liteAdaptor.js';
3131

32-
/*
32+
/**
3333
* Patterns used in parsing serialized HTML
3434
*/
3535
export namespace PATTERNS {
@@ -49,13 +49,13 @@ export namespace PATTERNS {
4949
}
5050

5151
/************************************************************/
52-
/*
52+
/**
5353
* Implements a lightweight DOMParser replacement
5454
* (Not perfect, but handles most well-formed HTML)
5555
*/
5656
export class LiteParser implements MinDOMParser<LiteDocument> {
5757

58-
/*
58+
/**
5959
* The list of self-closing tags
6060
*/
6161
public static SELF_CLOSING: {[name: string]: boolean} = {
@@ -78,7 +78,7 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
7878
wbr: true
7979
};
8080

81-
/*
81+
/**
8282
* The list of tags chose content is not parsed (PCDATA)
8383
*/
8484
public static PCDATA: {[name: string]: boolean} = {
@@ -90,7 +90,7 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
9090
script: true
9191
};
9292

93-
/*
93+
/**
9494
* The list of attributes that don't get entity translation
9595
*/
9696
public static CDATA_ATTR: {[name: string]: boolean} = {
@@ -110,7 +110,7 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
110110
scheme: true
111111
};
112112

113-
/*
113+
/**
114114
* @override
115115
*/
116116
public parseFromString(text: string, format: string = 'text/html', adaptor: LiteAdaptor = null) {
@@ -141,32 +141,32 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
141141
return root;
142142
}
143143

144-
/*
145-
* @param{LiteAdaptor} adaptor The adaptor for managing nodes
146-
* @param{LiteElement} node The node to add a text element to
147-
* @param{string} text The text for the text node
148-
* @return{LiteText} The text element
144+
/**
145+
* @param {LiteAdaptor} adaptor The adaptor for managing nodes
146+
* @param {LiteElement} node The node to add a text element to
147+
* @param {string} text The text for the text node
148+
* @return {LiteText} The text element
149149
*/
150150
protected addText(adaptor: LiteAdaptor, node: LiteElement, text: string) {
151151
text = Entities.translate(text);
152152
return adaptor.append(node, adaptor.text(text)) as LiteText;
153153
}
154154

155-
/*
156-
* @param{LiteAdaptor} adaptor The adaptor for managing nodes
157-
* @param{LiteElement} node The node to add a comment to
158-
* @param{string} comment The text for the comment node
159-
* @return{LiteText} The comment element
155+
/**
156+
* @param {LiteAdaptor} adaptor The adaptor for managing nodes
157+
* @param {LiteElement} node The node to add a comment to
158+
* @param {string} comment The text for the comment node
159+
* @return {LiteText} The comment element
160160
*/
161161
protected addComment(adaptor: LiteAdaptor, node: LiteElement, comment: string) {
162162
return adaptor.append(node, new LiteComment(comment)) as LiteComment;
163163
}
164164

165-
/*
166-
* @param{LiteAdaptor} adaptor The adaptor for managing nodes
167-
* @param{LiteElement} node The node to close
168-
* @param{string} tag The close tag being processed
169-
* @return{LiteElement} The first unclosed parent node
165+
/**
166+
* @param {LiteAdaptor} adaptor The adaptor for managing nodes
167+
* @param {LiteElement} node The node to close
168+
* @param {string} tag The close tag being processed
169+
* @return {LiteElement} The first unclosed parent node
170170
*/
171171
protected closeTag(adaptor: LiteAdaptor, node: LiteElement, tag: string) {
172172
const kind = tag.slice(2,tag.length - 1).toLowerCase();
@@ -176,12 +176,12 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
176176
return adaptor.parent(node);
177177
}
178178

179-
/*
180-
* @param{LiteAdaptor} adaptor The adaptor for managing nodes
181-
* @param{LiteElement} node The parent node for the tag
182-
* @param{string} tag The tag being processed
183-
* @param{string[]} parts The rest of the text/tag array
184-
* @return{LiteElement} The node to which the next tag will be added
179+
/**
180+
* @param {LiteAdaptor} adaptor The adaptor for managing nodes
181+
* @param {LiteElement} node The parent node for the tag
182+
* @param {string} tag The tag being processed
183+
* @param {string[]} parts The rest of the text/tag array
184+
* @return {LiteElement} The node to which the next tag will be added
185185
*/
186186
protected openTag(adaptor: LiteAdaptor, node: LiteElement, tag: string, parts: string[]) {
187187
const PCDATA = (this.constructor as typeof LiteParser).PCDATA;
@@ -222,10 +222,10 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
222222
return node;
223223
}
224224

225-
/*
226-
* @param{LiteAdaptor} adaptor The adaptor for managing nodes
227-
* @param{LiteElement} node The node getting the attributes
228-
* @param{string[]} attributes The array of space, name, value1, value2, value3
225+
/**
226+
* @param {LiteAdaptor} adaptor The adaptor for managing nodes
227+
* @param {LiteElement} node The node getting the attributes
228+
* @param {string[]} attributes The array of space, name, value1, value2, value3
229229
* as described above.
230230
*/
231231
protected addAttributes(adaptor: LiteAdaptor, node: LiteElement, attributes: string[]) {
@@ -240,11 +240,11 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
240240
}
241241
}
242242

243-
/*
244-
* @param{LiteAdaptor} adaptor The adaptor for managing nodes
245-
* @param{LiteElement} node The node whose PCDATA content is being collected
246-
* @param{string} kind The tag name being handled
247-
* @param{string[]} parts The array of text/tag data for the document
243+
/**
244+
* @param {LiteAdaptor} adaptor The adaptor for managing nodes
245+
* @param {LiteElement} node The node whose PCDATA content is being collected
246+
* @param {string} kind The tag name being handled
247+
* @param {string[]} parts The array of text/tag data for the document
248248
*/
249249
protected handlePCDATA(adaptor: LiteAdaptor, node: LiteElement, kind: string, parts: string[]) {
250250
const pcdata = [] as string[];
@@ -266,13 +266,13 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
266266
adaptor.append(node, adaptor.text(pcdata.join('')));
267267
}
268268

269-
/*
269+
/**
270270
* Check the contents of the parsed document and move html, head, and body
271271
* tags into the document structure. That way, you can parse fragements or
272272
* full documents and still get a valid document.
273273
*
274-
* @param{LiteAdaptor} adaptor The adaptor for managing nodes
275-
* @param{LiteDocuemnt} root The document being checked
274+
* @param {LiteAdaptor} adaptor The adaptor for managing nodes
275+
* @param {LiteDocuemnt} root The document being checked
276276
*/
277277
protected checkDocument(adaptor: LiteAdaptor, root: LiteDocument) {
278278
if (adaptor.childNodes(adaptor.body(root)).length !== 1) return;
@@ -315,10 +315,10 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
315315
}
316316
}
317317

318-
/*
319-
* @param{LiteAdaptor} adaptor The adaptor for managing nodes
320-
* @param{LiteElement} node The node to serialize
321-
* @return{string} The serialized element (like outerHTML)
318+
/**
319+
* @param {LiteAdaptor} adaptor The adaptor for managing nodes
320+
* @param {LiteElement} node The node to serialize
321+
* @return {string} The serialized element (like outerHTML)
322322
*/
323323
public serialize(adaptor: LiteAdaptor, node: LiteElement) {
324324
const SELF_CLOSING = (this.constructor as typeof LiteParser).SELF_CLOSING;
@@ -333,10 +333,10 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
333333
return html;
334334
}
335335

336-
/*
337-
* @param{LiteAdaptor} adaptor The adaptor for managing nodes
338-
* @param{LiteElement} node The node whose innerHTML is needed
339-
* @return{string} The serialized element (like innerHTML)
336+
/**
337+
* @param {LiteAdaptor} adaptor The adaptor for managing nodes
338+
* @param {LiteElement} node The node whose innerHTML is needed
339+
* @return {string} The serialized element (like innerHTML)
340340
*/
341341
public serializeInner(adaptor: LiteAdaptor, node: LiteElement) {
342342
const PCDATA = (this.constructor as typeof LiteParser).PCDATA;
@@ -351,17 +351,17 @@ export class LiteParser implements MinDOMParser<LiteDocument> {
351351
}).join('');
352352
}
353353

354-
/*
355-
* @param{string} text The attribute value to be HTML escaped
356-
* @return{string} The string with " replaced by entities
354+
/**
355+
* @param {string} text The attribute value to be HTML escaped
356+
* @return {string} The string with " replaced by entities
357357
*/
358358
public protectAttribute(text: string) {
359359
return text.replace(/"/, '&quot;');
360360
}
361361

362-
/*
363-
* @param{string} text The text to be HTML escaped
364-
* @return{string} The string with &, <, and > replaced by entities
362+
/**
363+
* @param {string} text The text to be HTML escaped
364+
* @return {string} The string with &, <, and > replaced by entities
365365
*/
366366
public protectHTML(text: string) {
367367
return text.replace(/&/g, '&amp;')

0 commit comments

Comments
 (0)