mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-17 06:20:07 +02:00
Use mdast-util-from-markdown instead of simple-markdown
This commit is contained in:
@@ -96,7 +96,7 @@ mermaid.initialize(config);
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:673](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L673)
|
||||
[mermaidAPI.ts:667](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L667)
|
||||
|
||||
## Functions
|
||||
|
||||
@@ -127,7 +127,7 @@ Return the last node appended
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:312](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L312)
|
||||
[mermaidAPI.ts:306](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L306)
|
||||
|
||||
---
|
||||
|
||||
@@ -153,7 +153,7 @@ the cleaned up svgCode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:263](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L263)
|
||||
[mermaidAPI.ts:257](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L257)
|
||||
|
||||
---
|
||||
|
||||
@@ -179,7 +179,7 @@ the string with all the user styles
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:192](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L192)
|
||||
[mermaidAPI.ts:186](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L186)
|
||||
|
||||
---
|
||||
|
||||
@@ -202,7 +202,7 @@ the string with all the user styles
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:240](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L240)
|
||||
[mermaidAPI.ts:234](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L234)
|
||||
|
||||
---
|
||||
|
||||
@@ -229,7 +229,7 @@ with an enclosing block that has each of the cssClasses followed by !important;
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:176](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L176)
|
||||
[mermaidAPI.ts:170](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L170)
|
||||
|
||||
---
|
||||
|
||||
@@ -295,7 +295,7 @@ Put the svgCode into an iFrame. Return the iFrame code
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:291](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L291)
|
||||
[mermaidAPI.ts:285](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L285)
|
||||
|
||||
---
|
||||
|
||||
@@ -320,4 +320,4 @@ Remove any existing elements from the given document
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:362](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L362)
|
||||
[mermaidAPI.ts:356](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L356)
|
||||
|
@@ -55,7 +55,45 @@ flowchart LR
|
||||
id1[This is the text in the box]
|
||||
```
|
||||
|
||||
## Graph
|
||||
#### Unicode text
|
||||
|
||||
Use `"` to enclose the unicode text.
|
||||
|
||||
```mermaid-example
|
||||
flowchart LR
|
||||
id["This ❤ Unicode"]
|
||||
```
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
id["This ❤ Unicode"]
|
||||
```
|
||||
|
||||
#### Markdown formatting
|
||||
|
||||
Use double quotes and backticks "\` text \`" to enclose the markdown text.
|
||||
|
||||
```mermaid-example
|
||||
%%{init: {"flowchart": {"htmlLabels": false}} }%%
|
||||
flowchart LR
|
||||
markdown["`This **is** _Markdown_`"]
|
||||
newLines["`Line1
|
||||
Line 2
|
||||
Line 3`"]
|
||||
markdown --> newLines
|
||||
```
|
||||
|
||||
```mermaid
|
||||
%%{init: {"flowchart": {"htmlLabels": false}} }%%
|
||||
flowchart LR
|
||||
markdown["`This **is** _Markdown_`"]
|
||||
newLines["`Line1
|
||||
Line 2
|
||||
Line 3`"]
|
||||
markdown --> newLines
|
||||
```
|
||||
|
||||
### Direction
|
||||
|
||||
This statement declares the direction of the Flowchart.
|
||||
|
||||
@@ -83,15 +121,13 @@ flowchart LR
|
||||
Start --> Stop
|
||||
```
|
||||
|
||||
## Flowchart Orientation
|
||||
|
||||
Possible FlowChart orientations are:
|
||||
|
||||
- TB - top to bottom
|
||||
- TD - top-down/ same as top to bottom
|
||||
- BT - bottom to top
|
||||
- RL - right to left
|
||||
- LR - left to right
|
||||
- TB - Top to bottom
|
||||
- TD - Top-down/ same as top to bottom
|
||||
- BT - Bottom to top
|
||||
- RL - Right to left
|
||||
- LR - Left to right
|
||||
|
||||
## Node shapes
|
||||
|
||||
|
@@ -39,7 +39,30 @@ flowchart LR
|
||||
id1[This is the text in the box]
|
||||
```
|
||||
|
||||
## Graph
|
||||
#### Unicode text
|
||||
|
||||
Use `"` to enclose the unicode text.
|
||||
|
||||
```mermaid-example
|
||||
flowchart LR
|
||||
id["This ❤ Unicode"]
|
||||
```
|
||||
|
||||
#### Markdown formatting
|
||||
|
||||
Use double quotes and backticks "\` text \`" to enclose the markdown text.
|
||||
|
||||
```mermaid-example
|
||||
%%{init: {"flowchart": {"htmlLabels": false}} }%%
|
||||
flowchart LR
|
||||
markdown["`This **is** _Markdown_`"]
|
||||
newLines["`Line1
|
||||
Line 2
|
||||
Line 3`"]
|
||||
markdown --> newLines
|
||||
```
|
||||
|
||||
### Direction
|
||||
|
||||
This statement declares the direction of the Flowchart.
|
||||
|
||||
@@ -57,15 +80,13 @@ flowchart LR
|
||||
Start --> Stop
|
||||
```
|
||||
|
||||
## Flowchart Orientation
|
||||
|
||||
Possible FlowChart orientations are:
|
||||
|
||||
- TB - top to bottom
|
||||
- TD - top-down/ same as top to bottom
|
||||
- BT - bottom to top
|
||||
- RL - right to left
|
||||
- LR - left to right
|
||||
- TB - Top to bottom
|
||||
- TD - Top-down/ same as top to bottom
|
||||
- BT - Bottom to top
|
||||
- RL - Right to left
|
||||
- LR - Left to right
|
||||
|
||||
## Node shapes
|
||||
|
||||
|
@@ -154,13 +154,7 @@ export const encodeEntities = function (text: string): string {
|
||||
* @returns
|
||||
*/
|
||||
export const decodeEntities = function (text: string): string {
|
||||
let txt = text;
|
||||
|
||||
txt = txt.replace(/fl°°/g, '&#');
|
||||
txt = txt.replace(/fl°/g, '&');
|
||||
txt = txt.replace(/¶ß/g, ';');
|
||||
|
||||
return txt;
|
||||
return text.replace(/fl°°/g, '&#').replace(/fl°/g, '&').replace(/¶ß/g, ';');
|
||||
};
|
||||
|
||||
// append !important; to each cssClass followed by a final !important, all enclosed in { }
|
||||
|
@@ -1,7 +1,4 @@
|
||||
import { select } from 'd3';
|
||||
import { log } from '../logger.js';
|
||||
import { getConfig } from '../config.js';
|
||||
import { evaluate } from '../diagrams/common/common.js';
|
||||
import { decodeEntities } from '../mermaidAPI.js';
|
||||
import { markdownToHTML, markdownToLines } from '../rendering-util/handle-markdown-text.js';
|
||||
/**
|
||||
@@ -207,17 +204,6 @@ export const createText = (
|
||||
return vertexNode;
|
||||
} else {
|
||||
const structuredText = markdownToLines(text);
|
||||
const special = ['"', "'", '.', ',', ':', ';', '!', '?', '(', ')', '[', ']', '{', '}'];
|
||||
let lastWord;
|
||||
structuredText.forEach((line) => {
|
||||
line.forEach((word) => {
|
||||
if (special.includes(word.content) && lastWord) {
|
||||
lastWord.content += word.content;
|
||||
word.content = '';
|
||||
}
|
||||
lastWord = word;
|
||||
});
|
||||
});
|
||||
const svgLabel = createFormattedText(width, el, structuredText, addSvgBackground);
|
||||
return svgLabel;
|
||||
}
|
||||
|
@@ -1,61 +1,136 @@
|
||||
// import { test } from 'vitest';
|
||||
import { markdownToLines, markdownToHTML } from './handle-markdown-text';
|
||||
import { test } from 'vitest';
|
||||
import { markdownToLines, markdownToHTML } from './handle-markdown-text.js';
|
||||
import { test, expect } from 'vitest';
|
||||
|
||||
test('markdownToLines - Basic test', () => {
|
||||
describe('markdownToLines', () => {
|
||||
test('Basic test', () => {
|
||||
const input = `This is regular text
|
||||
Here is a new line
|
||||
There is some words **with a bold** section
|
||||
Here is a line *with an italic* section`;
|
||||
|
||||
const expectedOutput = [
|
||||
[
|
||||
{ content: 'This', type: 'normal' },
|
||||
{ content: 'is', type: 'normal' },
|
||||
{ content: 'regular', type: 'normal' },
|
||||
{ content: 'text', type: 'normal' },
|
||||
],
|
||||
[
|
||||
{ content: 'Here', type: 'normal' },
|
||||
{ content: 'is', type: 'normal' },
|
||||
{ content: 'a', type: 'normal' },
|
||||
{ content: 'new', type: 'normal' },
|
||||
{ content: 'line', type: 'normal' },
|
||||
],
|
||||
[
|
||||
{ content: 'There', type: 'normal' },
|
||||
{ content: 'is', type: 'normal' },
|
||||
{ content: 'some', type: 'normal' },
|
||||
{ content: 'words', type: 'normal' },
|
||||
{ content: 'with', type: 'strong' },
|
||||
{ content: 'a', type: 'strong' },
|
||||
{ content: 'bold', type: 'strong' },
|
||||
{ content: 'section', type: 'normal' },
|
||||
],
|
||||
[
|
||||
{ content: 'Here', type: 'normal' },
|
||||
{ content: 'is', type: 'normal' },
|
||||
{ content: 'a', type: 'normal' },
|
||||
{ content: 'line', type: 'normal' },
|
||||
{ content: 'with', type: 'em' },
|
||||
{ content: 'an', type: 'em' },
|
||||
{ content: 'italic', type: 'em' },
|
||||
{ content: 'section', type: 'normal' },
|
||||
],
|
||||
];
|
||||
|
||||
const output = markdownToLines(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
expect(output).toMatchInlineSnapshot(`
|
||||
[
|
||||
[
|
||||
{
|
||||
"content": "This",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "is",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "regular",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "text",
|
||||
"type": "normal",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
"content": "Here",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "is",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "a",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "new",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "line",
|
||||
"type": "normal",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
"content": "There",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "is",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "some",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "words",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "with",
|
||||
"type": "strong",
|
||||
},
|
||||
{
|
||||
"content": "a",
|
||||
"type": "strong",
|
||||
},
|
||||
{
|
||||
"content": "bold",
|
||||
"type": "strong",
|
||||
},
|
||||
{
|
||||
"content": "section",
|
||||
"type": "normal",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
"content": "Here",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "is",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "a",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "line",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "with",
|
||||
"type": "emphasis",
|
||||
},
|
||||
{
|
||||
"content": "an",
|
||||
"type": "emphasis",
|
||||
},
|
||||
{
|
||||
"content": "italic",
|
||||
"type": "emphasis",
|
||||
},
|
||||
{
|
||||
"content": "section",
|
||||
"type": "normal",
|
||||
},
|
||||
],
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
test('markdownToLines - Empty input', () => {
|
||||
test('Empty input', () => {
|
||||
const input = '';
|
||||
const expectedOutput = [[]];
|
||||
const output = markdownToLines(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
|
||||
test('markdownToLines - No formatting', () => {
|
||||
test('No formatting', () => {
|
||||
const input = `This is a simple test
|
||||
with no formatting`;
|
||||
|
||||
@@ -76,9 +151,9 @@ with no formatting`;
|
||||
|
||||
const output = markdownToLines(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
|
||||
test('markdownToLines - Only bold formatting', () => {
|
||||
test('Only bold formatting', () => {
|
||||
const input = `This is a **bold** test`;
|
||||
|
||||
const expectedOutput = [
|
||||
@@ -93,9 +168,9 @@ test('markdownToLines - Only bold formatting', () => {
|
||||
|
||||
const output = markdownToLines(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
|
||||
test('markdownToLines - paragraph 1', () => {
|
||||
test('paragraph 1', () => {
|
||||
const input = `**Start** with
|
||||
a second line`;
|
||||
|
||||
@@ -113,9 +188,9 @@ test('markdownToLines - paragraph 1', () => {
|
||||
|
||||
const output = markdownToLines(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
|
||||
test('markdownToLines - paragraph', () => {
|
||||
test('paragraph', () => {
|
||||
const input = `**Start** with
|
||||
|
||||
a second line`;
|
||||
@@ -134,120 +209,183 @@ test('markdownToLines - paragraph', () => {
|
||||
|
||||
const output = markdownToLines(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
|
||||
test('markdownToLines - Only italic formatting', () => {
|
||||
test('Only italic formatting', () => {
|
||||
const input = `This is an *italic* test`;
|
||||
|
||||
const expectedOutput = [
|
||||
[
|
||||
{ content: 'This', type: 'normal' },
|
||||
{ content: 'is', type: 'normal' },
|
||||
{ content: 'an', type: 'normal' },
|
||||
{ content: 'italic', type: 'em' },
|
||||
{ content: 'test', type: 'normal' },
|
||||
],
|
||||
];
|
||||
|
||||
const output = markdownToLines(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
expect(output).toMatchInlineSnapshot(`
|
||||
[
|
||||
[
|
||||
{
|
||||
"content": "This",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "is",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "an",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "italic",
|
||||
"type": "emphasis",
|
||||
},
|
||||
{
|
||||
"content": "test",
|
||||
"type": "normal",
|
||||
},
|
||||
],
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
it('markdownToLines - Mixed formatting', () => {
|
||||
test('Mixed formatting', () => {
|
||||
const input = `*Italic* and **bold** formatting`;
|
||||
|
||||
const expectedOutput = [
|
||||
[
|
||||
{ content: 'Italic', type: 'em' },
|
||||
{ content: 'and', type: 'normal' },
|
||||
{ content: 'bold', type: 'strong' },
|
||||
{ content: 'formatting', type: 'normal' },
|
||||
],
|
||||
];
|
||||
|
||||
const output = markdownToLines(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
expect(output).toMatchInlineSnapshot(`
|
||||
[
|
||||
[
|
||||
{
|
||||
"content": "Italic",
|
||||
"type": "emphasis",
|
||||
},
|
||||
{
|
||||
"content": "and",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "bold",
|
||||
"type": "strong",
|
||||
},
|
||||
{
|
||||
"content": "formatting",
|
||||
"type": "normal",
|
||||
},
|
||||
],
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
it('markdownToLines - Mixed formatting', () => {
|
||||
test('Mixed formatting with newline', () => {
|
||||
const input = `The dog in **the** hog... a *very long text* about it
|
||||
Word!`;
|
||||
|
||||
const expectedOutput = [
|
||||
[
|
||||
{ content: 'The', type: 'normal' },
|
||||
{ content: 'dog', type: 'normal' },
|
||||
{ content: 'in', type: 'normal' },
|
||||
{ content: 'the', type: 'strong' },
|
||||
{ content: 'hog', type: 'normal' },
|
||||
{ content: '.', type: 'normal' },
|
||||
{ content: '.', type: 'normal' },
|
||||
{ content: '.', type: 'normal' },
|
||||
{ content: 'a', type: 'normal' },
|
||||
{ content: 'very', type: 'em' },
|
||||
{ content: 'long', type: 'em' },
|
||||
{ content: 'text', type: 'em' },
|
||||
{ content: 'about', type: 'normal' },
|
||||
{ content: 'it', type: 'normal' },
|
||||
],
|
||||
[
|
||||
{ content: 'Word', type: 'normal' },
|
||||
{ content: '!', type: 'normal' },
|
||||
],
|
||||
];
|
||||
|
||||
const output = markdownToLines(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
expect(output).toMatchInlineSnapshot(`
|
||||
[
|
||||
[
|
||||
{
|
||||
"content": "The",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "dog",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "in",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "the",
|
||||
"type": "strong",
|
||||
},
|
||||
{
|
||||
"content": "hog...",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "a",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "very",
|
||||
"type": "emphasis",
|
||||
},
|
||||
{
|
||||
"content": "long",
|
||||
"type": "emphasis",
|
||||
},
|
||||
{
|
||||
"content": "text",
|
||||
"type": "emphasis",
|
||||
},
|
||||
{
|
||||
"content": "about",
|
||||
"type": "normal",
|
||||
},
|
||||
{
|
||||
"content": "it",
|
||||
"type": "normal",
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
"content": "Word!",
|
||||
"type": "normal",
|
||||
},
|
||||
],
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
test('markdownToHTML - Basic test', () => {
|
||||
describe('markdownToHTML', () => {
|
||||
test('Basic test', () => {
|
||||
const input = `This is regular text
|
||||
Here is a new line
|
||||
There is some words **with a bold** section
|
||||
Here is a line *with an italic* section`;
|
||||
|
||||
const expectedOutput = `<p>This is regular text<br/>Here is a new line<br/>There is some words <strong>with a bold</strong> section<br/>Here is a line <em>with an italic</em> section</p>`;
|
||||
|
||||
const output = markdownToHTML(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
expect(output).toMatchInlineSnapshot(
|
||||
'"<p>This is regular text<br/>Here is a new line<br/>There is some words <strong>with a bold</strong> section<br/>Here is a line <em>with an italic</em> section</p>"'
|
||||
);
|
||||
});
|
||||
|
||||
test('markdownToHTML - Empty input', () => {
|
||||
test('Empty input', () => {
|
||||
const input = '';
|
||||
const expectedOutput = '';
|
||||
const output = markdownToHTML(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
|
||||
test('markdownToHTML - No formatting', () => {
|
||||
test('No formatting', () => {
|
||||
const input = `This is a simple test
|
||||
with no formatting`;
|
||||
|
||||
const expectedOutput = `<p>This is a simple test<br/>with no formatting</p>`;
|
||||
const output = markdownToHTML(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
|
||||
test('markdownToHTML - Only bold formatting', () => {
|
||||
test('Only bold formatting', () => {
|
||||
const input = `This is a **bold** test`;
|
||||
|
||||
const expectedOutput = `<p>This is a <strong>bold</strong> test</p>`;
|
||||
const output = markdownToHTML(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
|
||||
test('markdownToHTML - Only italic formatting', () => {
|
||||
test('Only italic formatting', () => {
|
||||
const input = `This is an *italic* test`;
|
||||
|
||||
const expectedOutput = `<p>This is an <em>italic</em> test</p>`;
|
||||
const output = markdownToHTML(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
});
|
||||
});
|
||||
|
||||
test('markdownToHTML - Mixed formatting', () => {
|
||||
test('Mixed formatting', () => {
|
||||
const input = `*Italic* and **bold** formatting`;
|
||||
|
||||
const expectedOutput = `<p><em>Italic</em> and <strong>bold</strong> formatting</p>`;
|
||||
const output = markdownToHTML(input);
|
||||
expect(output).toEqual(expectedOutput);
|
||||
// const expectedOutput = 'this text has some special characters: `<p>hi</p>`';
|
||||
expect(
|
||||
markdownToHTML('this text has some special characters: `<p>hi</p>`')
|
||||
).toMatchInlineSnapshot('"<p>this text has some special characters: </p>"');
|
||||
});
|
||||
});
|
||||
|
@@ -1,61 +1,52 @@
|
||||
import SimpleMarkdown from '@khanacademy/simple-markdown';
|
||||
import { fromMarkdown } from 'mdast-util-from-markdown';
|
||||
import type { Content } from 'mdast';
|
||||
import { dedent } from 'ts-dedent';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param markdown
|
||||
*/
|
||||
function preprocessMarkdown(markdown) {
|
||||
function preprocessMarkdown(markdown: string): string {
|
||||
// Replace multiple newlines with a single newline
|
||||
const withoutMultipleNewlines = markdown.replace(/\n{2,}/g, '\n');
|
||||
// Remove extra spaces at the beginning of each line
|
||||
const withoutExtraSpaces = withoutMultipleNewlines.replace(/^\s+/gm, '');
|
||||
const withoutExtraSpaces = dedent(withoutMultipleNewlines);
|
||||
return withoutExtraSpaces;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param markdown
|
||||
*/
|
||||
export function markdownToLines(markdown) {
|
||||
const preprocessedMarkdown = preprocessMarkdown(markdown);
|
||||
const mdParse = SimpleMarkdown.defaultBlockParse;
|
||||
const syntaxTree = mdParse(preprocessedMarkdown);
|
||||
interface Word {
|
||||
content: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
let lines = [[]];
|
||||
type Line = Word[];
|
||||
|
||||
export function markdownToLines(markdown: string): Line[] {
|
||||
const preprocessedMarkdown = preprocessMarkdown(markdown);
|
||||
const { children } = fromMarkdown(preprocessedMarkdown);
|
||||
const lines: Line[] = [[]];
|
||||
let currentLine = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param node
|
||||
* @param parentType
|
||||
*/
|
||||
function processNode(node, parentType) {
|
||||
function processNode(node: Content, parentType?: string) {
|
||||
if (node.type === 'text') {
|
||||
const textLines = node.content.split('\n');
|
||||
|
||||
const textLines = node.value.split('\n');
|
||||
textLines.forEach((textLine, index) => {
|
||||
if (index !== 0) {
|
||||
currentLine++;
|
||||
lines.push([]);
|
||||
}
|
||||
|
||||
// textLine.split(/ (?=[^!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]+)/).forEach((word) => {
|
||||
textLine.split(' ').forEach((word) => {
|
||||
if (word) {
|
||||
lines[currentLine].push({ content: word, type: parentType || 'normal' });
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (node.type === 'strong' || node.type === 'em') {
|
||||
node.content.forEach((contentNode) => {
|
||||
} else if (node.type === 'strong' || node.type === 'emphasis') {
|
||||
node.children.forEach((contentNode) => {
|
||||
processNode(contentNode, node.type);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
syntaxTree.forEach((treeNode) => {
|
||||
children.forEach((treeNode) => {
|
||||
if (treeNode.type === 'paragraph') {
|
||||
treeNode.content.forEach((contentNode) => {
|
||||
treeNode.children.forEach((contentNode) => {
|
||||
processNode(contentNode);
|
||||
});
|
||||
}
|
||||
@@ -64,31 +55,21 @@ export function markdownToLines(markdown) {
|
||||
return lines;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param markdown
|
||||
*/
|
||||
export function markdownToHTML(markdown) {
|
||||
const mdParse = SimpleMarkdown.defaultBlockParse;
|
||||
const syntaxTree = mdParse(markdown);
|
||||
export function markdownToHTML(markdown: string): string {
|
||||
const { children } = fromMarkdown(markdown);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param node
|
||||
*/
|
||||
function output(node) {
|
||||
function output(node: Content): string {
|
||||
if (node.type === 'text') {
|
||||
return node.content.replace(/\n/g, '<br/>');
|
||||
return node.value.replace(/\n/g, '<br/>');
|
||||
} else if (node.type === 'strong') {
|
||||
return `<strong>${node.content.map(output).join('')}</strong>`;
|
||||
} else if (node.type === 'em') {
|
||||
return `<em>${node.content.map(output).join('')}</em>`;
|
||||
return `<strong>${node.children.map(output).join('')}</strong>`;
|
||||
} else if (node.type === 'emphasis') {
|
||||
return `<em>${node.children.map(output).join('')}</em>`;
|
||||
} else if (node.type === 'paragraph') {
|
||||
return `<p>${node.content.map(output).join('')}</p>`;
|
||||
} else {
|
||||
return `<p>${node.children.map(output).join('')}</p>`;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
return syntaxTree.map(output).join('');
|
||||
return children.map(output).join('');
|
||||
}
|
||||
|
147
pnpm-lock.yaml
generated
147
pnpm-lock.yaml
generated
@@ -214,6 +214,9 @@ importers:
|
||||
lodash-es:
|
||||
specifier: ^4.17.21
|
||||
version: 4.17.21
|
||||
mdast-util-from-markdown:
|
||||
specifier: ^1.3.0
|
||||
version: 1.3.0
|
||||
non-layered-tidy-tree-layout:
|
||||
specifier: ^2.0.2
|
||||
version: 2.0.2
|
||||
@@ -331,7 +334,7 @@ importers:
|
||||
version: 1.0.0
|
||||
vitepress:
|
||||
specifier: ^1.0.0-alpha.72
|
||||
version: 1.0.0-alpha.72(@algolia/client-search@4.14.2)(@types/node@18.16.0)(react-dom@16.14.0)(react@16.14.0)
|
||||
version: 1.0.0-alpha.72(@algolia/client-search@4.14.2)(react-dom@16.14.0)(react@16.14.0)
|
||||
vitepress-plugin-search:
|
||||
specifier: ^1.0.4-alpha.20
|
||||
version: 1.0.4-alpha.20(flexsearch@0.7.31)(vitepress@1.0.0-alpha.72)(vue@3.2.47)
|
||||
@@ -733,6 +736,7 @@ packages:
|
||||
dependencies:
|
||||
'@applitools/eg-frpc': 1.0.2
|
||||
'@applitools/eg-socks5-proxy-server': 0.5.4
|
||||
'@applitools/execution-grid-tunnel': 1.0.24
|
||||
'@applitools/logger': 1.1.48
|
||||
dotenv: 16.0.3
|
||||
encoding: 0.1.13
|
||||
@@ -1097,7 +1101,7 @@ packages:
|
||||
'@babel/traverse': 7.19.1
|
||||
'@babel/types': 7.19.0
|
||||
convert-source-map: 1.8.0
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
gensync: 1.0.0-beta.2
|
||||
json5: 2.2.1
|
||||
lodash: 4.17.21
|
||||
@@ -1374,7 +1378,7 @@ packages:
|
||||
'@babel/helper-split-export-declaration': 7.18.6
|
||||
'@babel/parser': 7.19.1
|
||||
'@babel/types': 7.19.0
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
globals: 11.12.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -2162,7 +2166,7 @@ packages:
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
dependencies:
|
||||
ajv: 6.12.6
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
espree: 9.5.1
|
||||
globals: 13.19.0
|
||||
ignore: 5.2.0
|
||||
@@ -2204,7 +2208,7 @@ packages:
|
||||
engines: {node: '>=10.10.0'}
|
||||
dependencies:
|
||||
'@humanwhocodes/object-schema': 1.2.1
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
minimatch: 3.1.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -2935,7 +2939,6 @@ packages:
|
||||
resolution: {integrity: sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==}
|
||||
dependencies:
|
||||
'@types/ms': 0.7.31
|
||||
dev: true
|
||||
|
||||
/@types/dompurify@3.0.2:
|
||||
resolution: {integrity: sha512-YBL4ziFebbbfQfH5mlC+QTJsvh0oJUrWbmxKMyEdL7emlHJqGR2Qb34TEFKj+VCayBvjKy3xczMFNhugThUsfQ==}
|
||||
@@ -3088,7 +3091,6 @@ packages:
|
||||
resolution: {integrity: sha512-Y/uImid8aAwrEA24/1tcRZwpxX3pIFTSilcNDKSPn+Y2iDywSEachzRuvgAYYLR3wpGXAsMbv5lvKLDZLeYPAw==}
|
||||
dependencies:
|
||||
'@types/unist': 2.0.6
|
||||
dev: true
|
||||
|
||||
/@types/mdurl@1.0.2:
|
||||
resolution: {integrity: sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==}
|
||||
@@ -3110,7 +3112,6 @@ packages:
|
||||
|
||||
/@types/ms@0.7.31:
|
||||
resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==}
|
||||
dev: true
|
||||
|
||||
/@types/node-fetch@2.6.2:
|
||||
resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==}
|
||||
@@ -3225,7 +3226,6 @@ packages:
|
||||
|
||||
/@types/unist@2.0.6:
|
||||
resolution: {integrity: sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==}
|
||||
dev: true
|
||||
|
||||
/@types/uuid@9.0.1:
|
||||
resolution: {integrity: sha512-rFT3ak0/2trgvp4yYZo5iKFEPsET7vKydKF+VRCxlQ9bpheehyAJH89dAkaLEq/j/RZXJIqcgsmPJKUP1Z28HA==}
|
||||
@@ -3281,7 +3281,7 @@ packages:
|
||||
'@typescript-eslint/scope-manager': 5.59.0
|
||||
'@typescript-eslint/type-utils': 5.59.0(eslint@8.39.0)(typescript@5.0.4)
|
||||
'@typescript-eslint/utils': 5.59.0(eslint@8.39.0)(typescript@5.0.4)
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
eslint: 8.39.0
|
||||
grapheme-splitter: 1.0.4
|
||||
ignore: 5.2.0
|
||||
@@ -3306,7 +3306,7 @@ packages:
|
||||
'@typescript-eslint/scope-manager': 5.59.0
|
||||
'@typescript-eslint/types': 5.59.0
|
||||
'@typescript-eslint/typescript-estree': 5.59.0(typescript@5.0.4)
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
eslint: 8.39.0
|
||||
typescript: 5.0.4
|
||||
transitivePeerDependencies:
|
||||
@@ -3333,7 +3333,7 @@ packages:
|
||||
dependencies:
|
||||
'@typescript-eslint/typescript-estree': 5.59.0(typescript@5.0.4)
|
||||
'@typescript-eslint/utils': 5.59.0(eslint@8.39.0)(typescript@5.0.4)
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
eslint: 8.39.0
|
||||
tsutils: 3.21.0(typescript@5.0.4)
|
||||
typescript: 5.0.4
|
||||
@@ -3357,7 +3357,7 @@ packages:
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 5.59.0
|
||||
'@typescript-eslint/visitor-keys': 5.59.0
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
globby: 11.1.0
|
||||
is-glob: 4.0.3
|
||||
semver: 7.5.0
|
||||
@@ -3402,7 +3402,7 @@ packages:
|
||||
vite: ^4.0.0
|
||||
vue: ^3.2.25
|
||||
dependencies:
|
||||
vite: 4.2.2(@types/node@18.16.0)
|
||||
vite: 4.2.2
|
||||
vue: 3.2.47
|
||||
dev: true
|
||||
|
||||
@@ -3881,7 +3881,7 @@ packages:
|
||||
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
|
||||
engines: {node: '>= 6.0.0'}
|
||||
dependencies:
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
@@ -4171,7 +4171,7 @@ packages:
|
||||
resolution: {integrity: sha512-AOhBxyLVdpOad3TujtC9kL/9r3HnTkxwQ5ggOsYrvvZP1cCFvzHWJd5XxZDFuTn+IN8vkKSG5SEJrd27vCSbeA==}
|
||||
dependencies:
|
||||
archy: 1.0.0
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
fastq: 1.13.0
|
||||
queue-microtask: 1.2.3
|
||||
transitivePeerDependencies:
|
||||
@@ -4619,7 +4619,6 @@ packages:
|
||||
|
||||
/character-entities@2.0.2:
|
||||
resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==}
|
||||
dev: true
|
||||
|
||||
/character-reference-invalid@1.1.4:
|
||||
resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==}
|
||||
@@ -5182,7 +5181,7 @@ packages:
|
||||
engines: {node: '>=14'}
|
||||
dependencies:
|
||||
'@cspell/cspell-service-bus': 6.31.1
|
||||
node-fetch: 2.6.9(encoding@0.1.13)
|
||||
node-fetch: 2.6.9
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
dev: true
|
||||
@@ -5731,6 +5730,17 @@ packages:
|
||||
ms: 2.1.2
|
||||
dev: true
|
||||
|
||||
/debug@4.3.4:
|
||||
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
||||
engines: {node: '>=6.0'}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
dependencies:
|
||||
ms: 2.1.2
|
||||
|
||||
/debug@4.3.4(supports-color@8.1.1):
|
||||
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
||||
engines: {node: '>=6.0'}
|
||||
@@ -5770,7 +5780,6 @@ packages:
|
||||
resolution: {integrity: sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==}
|
||||
dependencies:
|
||||
character-entities: 2.0.2
|
||||
dev: true
|
||||
|
||||
/decompress-response@6.0.0:
|
||||
resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==}
|
||||
@@ -5850,7 +5859,6 @@ packages:
|
||||
/dequal@2.0.3:
|
||||
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/destroy@1.2.0:
|
||||
resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==}
|
||||
@@ -5879,7 +5887,6 @@ packages:
|
||||
/diff@5.1.0:
|
||||
resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==}
|
||||
engines: {node: '>=0.3.1'}
|
||||
dev: true
|
||||
|
||||
/dir-glob@3.0.1:
|
||||
resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
|
||||
@@ -6210,7 +6217,7 @@ packages:
|
||||
'@es-joy/jsdoccomment': 0.37.1
|
||||
are-docs-informative: 0.0.2
|
||||
comment-parser: 1.3.1
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
escape-string-regexp: 4.0.0
|
||||
eslint: 8.39.0
|
||||
esquery: 1.5.0
|
||||
@@ -6328,7 +6335,7 @@ packages:
|
||||
ajv: 6.12.6
|
||||
chalk: 4.1.2
|
||||
cross-spawn: 7.0.3
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
doctrine: 3.0.0
|
||||
escape-string-regexp: 4.0.0
|
||||
eslint-scope: 7.2.0
|
||||
@@ -6792,7 +6799,7 @@ packages:
|
||||
dependencies:
|
||||
chalk: 4.1.2
|
||||
commander: 5.1.0
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
@@ -6849,7 +6856,7 @@ packages:
|
||||
debug:
|
||||
optional: true
|
||||
dependencies:
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
dev: true
|
||||
|
||||
/foreground-child@2.0.0:
|
||||
@@ -7050,7 +7057,7 @@ packages:
|
||||
dependencies:
|
||||
'@tootallnate/once': 1.1.2
|
||||
data-uri-to-buffer: 3.0.1
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
file-uri-to-path: 2.0.0
|
||||
fs-extra: 8.1.0
|
||||
ftp: 0.3.10
|
||||
@@ -7378,7 +7385,7 @@ packages:
|
||||
dependencies:
|
||||
'@tootallnate/once': 1.1.2
|
||||
agent-base: 6.0.2
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
@@ -7389,7 +7396,7 @@ packages:
|
||||
dependencies:
|
||||
'@tootallnate/once': 2.0.0
|
||||
agent-base: 6.0.2
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
@@ -7455,7 +7462,7 @@ packages:
|
||||
engines: {node: '>= 6'}
|
||||
dependencies:
|
||||
agent-base: 6.0.2
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
@@ -7828,7 +7835,7 @@ packages:
|
||||
resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==}
|
||||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
istanbul-lib-coverage: 3.2.0
|
||||
source-map: 0.6.1
|
||||
transitivePeerDependencies:
|
||||
@@ -8551,7 +8558,6 @@ packages:
|
||||
/kleur@4.1.5:
|
||||
resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/ky@0.30.0:
|
||||
resolution: {integrity: sha512-X/u76z4JtDVq10u1JA5UQfatPxgPaVDMYTrgHyiTpGN2z4TMEJkIHsoSBBSg9SWZEIXTKsi9kHgiQ9o3Y/4yog==}
|
||||
@@ -8633,7 +8639,7 @@ packages:
|
||||
chalk: 5.2.0
|
||||
cli-truncate: 3.1.0
|
||||
commander: 10.0.1
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
execa: 7.1.1
|
||||
lilconfig: 2.1.0
|
||||
listr2: 5.0.8
|
||||
@@ -8941,8 +8947,8 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/mdast-util-from-markdown@1.2.0:
|
||||
resolution: {integrity: sha512-iZJyyvKD1+K7QX1b5jXdE7Sc5dtoTry1vzV28UZZe8Z1xVnB/czKntJ7ZAkG0tANqRnBF6p3p7GpU1y19DTf2Q==}
|
||||
/mdast-util-from-markdown@1.3.0:
|
||||
resolution: {integrity: sha512-HN3W1gRIuN/ZW295c7zi7g9lVBllMgZE40RxCX37wrTPWXCWtpvOZdfnuK+1WNpvZje6XuJeI3Wnb4TJEUem+g==}
|
||||
dependencies:
|
||||
'@types/mdast': 3.0.11
|
||||
'@types/unist': 2.0.6
|
||||
@@ -8958,7 +8964,6 @@ packages:
|
||||
uvu: 0.5.6
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/mdast-util-frontmatter@1.0.0:
|
||||
resolution: {integrity: sha512-7itKvp0arEVNpCktOET/eLFAYaZ+0cNjVtFtIPxgQ5tV+3i+D4SDDTjTzPWl44LT59PC+xdx+glNTawBdF98Mw==}
|
||||
@@ -8995,7 +9000,7 @@ packages:
|
||||
dependencies:
|
||||
'@types/mdast': 3.0.11
|
||||
markdown-table: 3.0.3
|
||||
mdast-util-from-markdown: 1.2.0
|
||||
mdast-util-from-markdown: 1.3.0
|
||||
mdast-util-to-markdown: 1.3.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -9011,7 +9016,7 @@ packages:
|
||||
/mdast-util-gfm@2.0.1:
|
||||
resolution: {integrity: sha512-42yHBbfWIFisaAfV1eixlabbsa6q7vHeSPY+cg+BBjX51M8xhgMacqH9g6TftB/9+YkcI0ooV4ncfrJslzm/RQ==}
|
||||
dependencies:
|
||||
mdast-util-from-markdown: 1.2.0
|
||||
mdast-util-from-markdown: 1.3.0
|
||||
mdast-util-gfm-autolink-literal: 1.0.2
|
||||
mdast-util-gfm-footnote: 1.0.1
|
||||
mdast-util-gfm-strikethrough: 1.0.2
|
||||
@@ -9040,7 +9045,6 @@ packages:
|
||||
|
||||
/mdast-util-to-string@3.1.0:
|
||||
resolution: {integrity: sha512-n4Vypz/DZgwo0iMHLQL49dJzlp7YtAJP+N07MZHpjPf/5XJuHUWstviF4Mn2jEiR/GNmtnRRqnwsXExk3igfFA==}
|
||||
dev: true
|
||||
|
||||
/mdn-data@2.0.30:
|
||||
resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==}
|
||||
@@ -9134,7 +9138,6 @@ packages:
|
||||
micromark-util-symbol: 1.0.1
|
||||
micromark-util-types: 1.0.2
|
||||
uvu: 0.5.6
|
||||
dev: true
|
||||
|
||||
/micromark-extension-frontmatter@1.0.0:
|
||||
resolution: {integrity: sha512-EXjmRnupoX6yYuUJSQhrQ9ggK0iQtQlpi6xeJzVD5xscyAI+giqco5fdymayZhJMbIFecjnE2yz85S9NzIgQpg==}
|
||||
@@ -9223,7 +9226,6 @@ packages:
|
||||
micromark-util-character: 1.1.0
|
||||
micromark-util-symbol: 1.0.1
|
||||
micromark-util-types: 1.0.2
|
||||
dev: true
|
||||
|
||||
/micromark-factory-label@1.0.2:
|
||||
resolution: {integrity: sha512-CTIwxlOnU7dEshXDQ+dsr2n+yxpP0+fn271pu0bwDIS8uqfFcumXpj5mLn3hSC8iw2MUr6Gx8EcKng1dD7i6hg==}
|
||||
@@ -9232,14 +9234,12 @@ packages:
|
||||
micromark-util-symbol: 1.0.1
|
||||
micromark-util-types: 1.0.2
|
||||
uvu: 0.5.6
|
||||
dev: true
|
||||
|
||||
/micromark-factory-space@1.0.0:
|
||||
resolution: {integrity: sha512-qUmqs4kj9a5yBnk3JMLyjtWYN6Mzfcx8uJfi5XAveBniDevmZasdGBba5b4QsvRcAkmvGo5ACmSUmyGiKTLZew==}
|
||||
dependencies:
|
||||
micromark-util-character: 1.1.0
|
||||
micromark-util-types: 1.0.2
|
||||
dev: true
|
||||
|
||||
/micromark-factory-title@1.0.2:
|
||||
resolution: {integrity: sha512-zily+Nr4yFqgMGRKLpTVsNl5L4PMu485fGFDOQJQBl2NFpjGte1e86zC0da93wf97jrc4+2G2GQudFMHn3IX+A==}
|
||||
@@ -9249,7 +9249,6 @@ packages:
|
||||
micromark-util-symbol: 1.0.1
|
||||
micromark-util-types: 1.0.2
|
||||
uvu: 0.5.6
|
||||
dev: true
|
||||
|
||||
/micromark-factory-whitespace@1.0.0:
|
||||
resolution: {integrity: sha512-Qx7uEyahU1lt1RnsECBiuEbfr9INjQTGa6Err+gF3g0Tx4YEviPbqqGKNv/NrBaE7dVHdn1bVZKM/n5I/Bak7A==}
|
||||
@@ -9258,20 +9257,17 @@ packages:
|
||||
micromark-util-character: 1.1.0
|
||||
micromark-util-symbol: 1.0.1
|
||||
micromark-util-types: 1.0.2
|
||||
dev: true
|
||||
|
||||
/micromark-util-character@1.1.0:
|
||||
resolution: {integrity: sha512-agJ5B3unGNJ9rJvADMJ5ZiYjBRyDpzKAOk01Kpi1TKhlT1APx3XZk6eN7RtSz1erbWHC2L8T3xLZ81wdtGRZzg==}
|
||||
dependencies:
|
||||
micromark-util-symbol: 1.0.1
|
||||
micromark-util-types: 1.0.2
|
||||
dev: true
|
||||
|
||||
/micromark-util-chunked@1.0.0:
|
||||
resolution: {integrity: sha512-5e8xTis5tEZKgesfbQMKRCyzvffRRUX+lK/y+DvsMFdabAicPkkZV6gO+FEWi9RfuKKoxxPwNL+dFF0SMImc1g==}
|
||||
dependencies:
|
||||
micromark-util-symbol: 1.0.1
|
||||
dev: true
|
||||
|
||||
/micromark-util-classify-character@1.0.0:
|
||||
resolution: {integrity: sha512-F8oW2KKrQRb3vS5ud5HIqBVkCqQi224Nm55o5wYLzY/9PwHGXC01tr3d7+TqHHz6zrKQ72Okwtvm/xQm6OVNZA==}
|
||||
@@ -9279,20 +9275,17 @@ packages:
|
||||
micromark-util-character: 1.1.0
|
||||
micromark-util-symbol: 1.0.1
|
||||
micromark-util-types: 1.0.2
|
||||
dev: true
|
||||
|
||||
/micromark-util-combine-extensions@1.0.0:
|
||||
resolution: {integrity: sha512-J8H058vFBdo/6+AsjHp2NF7AJ02SZtWaVUjsayNFeAiydTxUwViQPxN0Hf8dp4FmCQi0UUFovFsEyRSUmFH3MA==}
|
||||
dependencies:
|
||||
micromark-util-chunked: 1.0.0
|
||||
micromark-util-types: 1.0.2
|
||||
dev: true
|
||||
|
||||
/micromark-util-decode-numeric-character-reference@1.0.0:
|
||||
resolution: {integrity: sha512-OzO9AI5VUtrTD7KSdagf4MWgHMtET17Ua1fIpXTpuhclCqD8egFWo85GxSGvxgkGS74bEahvtM0WP0HjvV0e4w==}
|
||||
dependencies:
|
||||
micromark-util-symbol: 1.0.1
|
||||
dev: true
|
||||
|
||||
/micromark-util-decode-string@1.0.2:
|
||||
resolution: {integrity: sha512-DLT5Ho02qr6QWVNYbRZ3RYOSSWWFuH3tJexd3dgN1odEuPNxCngTCXJum7+ViRAd9BbdxCvMToPOD/IvVhzG6Q==}
|
||||
@@ -9301,27 +9294,22 @@ packages:
|
||||
micromark-util-character: 1.1.0
|
||||
micromark-util-decode-numeric-character-reference: 1.0.0
|
||||
micromark-util-symbol: 1.0.1
|
||||
dev: true
|
||||
|
||||
/micromark-util-encode@1.0.1:
|
||||
resolution: {integrity: sha512-U2s5YdnAYexjKDel31SVMPbfi+eF8y1U4pfiRW/Y8EFVCy/vgxk/2wWTxzcqE71LHtCuCzlBDRU2a5CQ5j+mQA==}
|
||||
dev: true
|
||||
|
||||
/micromark-util-html-tag-name@1.1.0:
|
||||
resolution: {integrity: sha512-BKlClMmYROy9UiV03SwNmckkjn8QHVaWkqoAqzivabvdGcwNGMMMH/5szAnywmsTBUzDsU57/mFi0sp4BQO6dA==}
|
||||
dev: true
|
||||
|
||||
/micromark-util-normalize-identifier@1.0.0:
|
||||
resolution: {integrity: sha512-yg+zrL14bBTFrQ7n35CmByWUTFsgst5JhA4gJYoty4Dqzj4Z4Fr/DHekSS5aLfH9bdlfnSvKAWsAgJhIbogyBg==}
|
||||
dependencies:
|
||||
micromark-util-symbol: 1.0.1
|
||||
dev: true
|
||||
|
||||
/micromark-util-resolve-all@1.0.0:
|
||||
resolution: {integrity: sha512-CB/AGk98u50k42kvgaMM94wzBqozSzDDaonKU7P7jwQIuH2RU0TeBqGYJz2WY1UdihhjweivStrJ2JdkdEmcfw==}
|
||||
dependencies:
|
||||
micromark-util-types: 1.0.2
|
||||
dev: true
|
||||
|
||||
/micromark-util-sanitize-uri@1.0.0:
|
||||
resolution: {integrity: sha512-cCxvBKlmac4rxCGx6ejlIviRaMKZc0fWm5HdCHEeDWRSkn44l6NdYVRyU+0nT1XC72EQJMZV8IPHF+jTr56lAg==}
|
||||
@@ -9329,7 +9317,6 @@ packages:
|
||||
micromark-util-character: 1.1.0
|
||||
micromark-util-encode: 1.0.1
|
||||
micromark-util-symbol: 1.0.1
|
||||
dev: true
|
||||
|
||||
/micromark-util-subtokenize@1.0.2:
|
||||
resolution: {integrity: sha512-d90uqCnXp/cy4G881Ub4psE57Sf8YD0pim9QdjCRNjfas2M1u6Lbt+XZK9gnHL2XFhnozZiEdCa9CNfXSfQ6xA==}
|
||||
@@ -9338,20 +9325,17 @@ packages:
|
||||
micromark-util-symbol: 1.0.1
|
||||
micromark-util-types: 1.0.2
|
||||
uvu: 0.5.6
|
||||
dev: true
|
||||
|
||||
/micromark-util-symbol@1.0.1:
|
||||
resolution: {integrity: sha512-oKDEMK2u5qqAptasDAwWDXq0tG9AssVwAx3E9bBF3t/shRIGsWIRG+cGafs2p/SnDSOecnt6hZPCE2o6lHfFmQ==}
|
||||
dev: true
|
||||
|
||||
/micromark-util-types@1.0.2:
|
||||
resolution: {integrity: sha512-DCfg/T8fcrhrRKTPjRrw/5LLvdGV7BHySf/1LOZx7TzWZdYRjogNtyNq885z3nNallwr3QUKARjqvHqX1/7t+w==}
|
||||
dev: true
|
||||
|
||||
/micromark@2.11.4:
|
||||
resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==}
|
||||
dependencies:
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
parse-entities: 2.0.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -9361,7 +9345,7 @@ packages:
|
||||
resolution: {integrity: sha512-ryTDy6UUunOXy2HPjelppgJ2sNfcPz1pLlMdA6Rz9jPzhLikWXv/irpWV/I2jd68Uhmny7hHxAlAhk4+vWggpg==}
|
||||
dependencies:
|
||||
'@types/debug': 4.1.7
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
decode-named-character-reference: 1.0.2
|
||||
micromark-core-commonmark: 1.0.6
|
||||
micromark-factory-space: 1.0.0
|
||||
@@ -9379,7 +9363,6 @@ packages:
|
||||
uvu: 0.5.6
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/micromatch@4.0.5:
|
||||
resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==}
|
||||
@@ -9501,7 +9484,6 @@ packages:
|
||||
/mri@1.2.0:
|
||||
resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/mrmime@1.0.1:
|
||||
resolution: {integrity: sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==}
|
||||
@@ -9514,7 +9496,6 @@ packages:
|
||||
|
||||
/ms@2.1.2:
|
||||
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
||||
dev: true
|
||||
|
||||
/ms@2.1.3:
|
||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||
@@ -9580,6 +9561,18 @@ packages:
|
||||
whatwg-url: 5.0.0
|
||||
dev: true
|
||||
|
||||
/node-fetch@2.6.9:
|
||||
resolution: {integrity: sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==}
|
||||
engines: {node: 4.x || >=6.0.0}
|
||||
peerDependencies:
|
||||
encoding: ^0.1.0
|
||||
peerDependenciesMeta:
|
||||
encoding:
|
||||
optional: true
|
||||
dependencies:
|
||||
whatwg-url: 5.0.0
|
||||
dev: true
|
||||
|
||||
/node-fetch@2.6.9(encoding@0.1.13):
|
||||
resolution: {integrity: sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==}
|
||||
engines: {node: 4.x || >=6.0.0}
|
||||
@@ -9872,7 +9865,7 @@ packages:
|
||||
dependencies:
|
||||
'@tootallnate/once': 1.1.2
|
||||
agent-base: 6.0.2
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
get-uri: 3.0.2
|
||||
http-proxy-agent: 4.0.1
|
||||
https-proxy-agent: 5.0.1
|
||||
@@ -10168,7 +10161,7 @@ packages:
|
||||
dependencies:
|
||||
binary-searching: 2.0.5
|
||||
comment-parser: 1.3.1
|
||||
mdast-util-from-markdown: 1.2.0
|
||||
mdast-util-from-markdown: 1.3.0
|
||||
prettier: 2.8.8
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -10239,7 +10232,7 @@ packages:
|
||||
engines: {node: '>= 8'}
|
||||
dependencies:
|
||||
agent-base: 6.0.2
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
http-proxy-agent: 4.0.1
|
||||
https-proxy-agent: 5.0.1
|
||||
lru-cache: 5.1.1
|
||||
@@ -10519,7 +10512,7 @@ packages:
|
||||
resolution: {integrity: sha512-1fUyHr2jLsVOkhbvPRBJ5zTKZZyD6yZzYaWCS6BPBdQ8vEMBCH+9zNCDA6tET/zHCi/jLqjCWtlJZUPk+DbnFw==}
|
||||
dependencies:
|
||||
'@types/mdast': 3.0.11
|
||||
mdast-util-from-markdown: 1.2.0
|
||||
mdast-util-from-markdown: 1.3.0
|
||||
unified: 10.1.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -10761,7 +10754,6 @@ packages:
|
||||
engines: {node: '>=6'}
|
||||
dependencies:
|
||||
mri: 1.2.0
|
||||
dev: true
|
||||
|
||||
/safe-buffer@5.1.2:
|
||||
resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
|
||||
@@ -11076,7 +11068,7 @@ packages:
|
||||
engines: {node: '>= 6'}
|
||||
dependencies:
|
||||
agent-base: 6.0.2
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
socks: 2.7.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -11252,7 +11244,7 @@ packages:
|
||||
arg: 5.0.2
|
||||
bluebird: 3.7.2
|
||||
check-more-types: 2.24.0
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
execa: 5.1.1
|
||||
lazy-ass: 1.6.0
|
||||
ps-tree: 1.2.0
|
||||
@@ -11899,7 +11891,6 @@ packages:
|
||||
resolution: {integrity: sha512-7A6eiDCs9UtjcwZOcCpM4aPII3bAAGv13E96IkawkOAW0OhH+yRxtY0lzo8KiHpzEMfH7Q+FizUmwp8Iqy5EWg==}
|
||||
dependencies:
|
||||
'@types/unist': 2.0.6
|
||||
dev: true
|
||||
|
||||
/unist-util-visit-parents@5.1.1:
|
||||
resolution: {integrity: sha512-gks4baapT/kNRaWxuGkl5BIhoanZo7sC/cUT/JToSRNL1dYoXRFl75d++NkjYk4TAu2uv2Px+l8guMajogeuiw==}
|
||||
@@ -11999,7 +11990,6 @@ packages:
|
||||
diff: 5.1.0
|
||||
kleur: 4.1.5
|
||||
sade: 1.8.1
|
||||
dev: true
|
||||
|
||||
/v8-compile-cache-lib@3.0.1:
|
||||
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
|
||||
@@ -12057,7 +12047,7 @@ packages:
|
||||
hasBin: true
|
||||
dependencies:
|
||||
cac: 6.7.14
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
mlly: 1.2.0
|
||||
pathe: 1.1.0
|
||||
picocolors: 1.0.0
|
||||
@@ -12072,7 +12062,7 @@ packages:
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/vite@4.2.2(@types/node@18.16.0):
|
||||
/vite@4.2.2:
|
||||
resolution: {integrity: sha512-PcNtT5HeDxb3QaSqFYkEum8f5sCVe0R3WK20qxgIvNBZPXU/Obxs/+ubBMeE7nLWeCo2LDzv+8hRYSlcaSehig==}
|
||||
engines: {node: ^14.18.0 || >=16.0.0}
|
||||
hasBin: true
|
||||
@@ -12097,7 +12087,6 @@ packages:
|
||||
terser:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@types/node': 18.16.0
|
||||
esbuild: 0.17.18
|
||||
postcss: 8.4.21
|
||||
resolve: 1.22.1
|
||||
@@ -12152,11 +12141,11 @@ packages:
|
||||
flexsearch: 0.7.31
|
||||
glob-to-regexp: 0.4.1
|
||||
markdown-it: 13.0.1
|
||||
vitepress: 1.0.0-alpha.72(@algolia/client-search@4.14.2)(@types/node@18.16.0)(react-dom@16.14.0)(react@16.14.0)
|
||||
vitepress: 1.0.0-alpha.72(@algolia/client-search@4.14.2)(react-dom@16.14.0)(react@16.14.0)
|
||||
vue: 3.2.47
|
||||
dev: true
|
||||
|
||||
/vitepress@1.0.0-alpha.72(@algolia/client-search@4.14.2)(@types/node@18.16.0)(react-dom@16.14.0)(react@16.14.0):
|
||||
/vitepress@1.0.0-alpha.72(@algolia/client-search@4.14.2)(react-dom@16.14.0)(react@16.14.0):
|
||||
resolution: {integrity: sha512-Ou7fNE/OVYLrKGQMHSTVG6AcNsdv7tm4ACrdhx93SPMzEDj8UgIb4RFa5CTTowaYf3jeDGi2EAJlzXVC+IE3dg==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
@@ -12169,7 +12158,7 @@ packages:
|
||||
mark.js: 8.11.1
|
||||
minisearch: 6.0.1
|
||||
shiki: 0.14.1
|
||||
vite: 4.2.2(@types/node@18.16.0)
|
||||
vite: 4.2.2
|
||||
vue: 3.2.47
|
||||
transitivePeerDependencies:
|
||||
- '@algolia/client-search'
|
||||
@@ -12230,7 +12219,7 @@ packages:
|
||||
cac: 6.7.14
|
||||
chai: 4.3.7
|
||||
concordance: 5.0.4
|
||||
debug: 4.3.4(supports-color@8.1.1)
|
||||
debug: 4.3.4
|
||||
jsdom: 21.1.1
|
||||
local-pkg: 0.4.3
|
||||
magic-string: 0.30.0
|
||||
|
Reference in New Issue
Block a user