1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix table tokenizer for node help markdown renderer

This commit is contained in:
Nick O'Leary 2021-10-08 17:56:24 +01:00
parent cf5e125cb3
commit 155e1be494
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -39,12 +39,12 @@ RED.utils = (function() {
type: 'descriptionList', // Should match "name" above type: 'descriptionList', // Should match "name" above
raw: match[0], // Text to consume from the source raw: match[0], // Text to consume from the source
text: match[0].trim(), // Additional custom properties text: match[0].trim(), // Additional custom properties
tokens: this.inlineTokens(match[0].trim()) // inlineTokens to process **bold**, *italics*, etc. tokens: this.lexer.inlineTokens(match[0].trim()) // inlineTokens to process **bold**, *italics*, etc.
}; };
} }
}, },
renderer(token) { renderer(token) {
return `<dl class="message-properties">${this.parseInline(token.tokens)}\n</dl>`; // parseInline to turn child tokens into HTML return `<dl class="message-properties">${this.parser.parseInline(token.tokens)}\n</dl>`; // parseInline to turn child tokens into HTML
} }
}; };
@ -64,14 +64,14 @@ RED.utils = (function() {
return { // Token to generate return { // Token to generate
type: 'description', // Should match "name" above type: 'description', // Should match "name" above
raw: match[0], // Text to consume from the source raw: match[0], // Text to consume from the source
dt: this.inlineTokens(match[1].trim()), // Additional custom properties dt: this.lexer.inlineTokens(match[1].trim()), // Additional custom properties
types: this.inlineTokens(match[2].trim()), types: this.lexer.inlineTokens(match[2].trim()),
dd: this.inlineTokens(match[3].trim()), dd: this.lexer.inlineTokens(match[3].trim()),
}; };
} }
}, },
renderer(token) { renderer(token) {
return `\n<dt>${this.parseInline(token.dt)}<span class="property-type">${this.parseInline(token.types)}</span></dt><dd>${this.parseInline(token.dd)}</dd>`; return `\n<dt>${this.parser.parseInline(token.dt)}<span class="property-type">${this.parser.parseInline(token.types)}</span></dt><dd>${this.parser.parseInline(token.dd)}</dd>`;
}, },
childTokens: ['dt', 'dd'], // Any child tokens to be visited by walkTokens childTokens: ['dt', 'dd'], // Any child tokens to be visited by walkTokens
walkTokens(token) { // Post-processing on the completed token tree walkTokens(token) { // Post-processing on the completed token tree