Skip to content

Commit

Permalink
fix: filter out HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 committed May 11, 2024
1 parent a71168f commit 9e72c1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DocsParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class DocsParser {
| ElementDocumentationContainer
)[] = [];
const contents = await fs.readFile(filePath, 'utf8');
const md = new MarkdownIt();
const md = new MarkdownIt({ html: true });

const allTokens = md.parse(contents, {});

Expand Down Expand Up @@ -263,7 +263,7 @@ export class DocsParser {

private async parseStructure(filePath: string): Promise<StructureDocumentationContainer> {
const contents = await fs.readFile(filePath, 'utf8');
const md = new MarkdownIt();
const md = new MarkdownIt({ html: true });

const tokens = md.parse(contents, {});
const baseInfos = await this.parseBaseContainers(filePath, contents, tokens);
Expand Down
4 changes: 4 additions & 0 deletions src/markdown-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,8 @@ export const safelyJoinTokens = (tokens: Token[], options: JoinTokenOptions = {}
's_close',
'blockquote_open',
'blockquote_close',
'html_block',
'html_inline',
],
'We only support plain text, links, softbreaks, inline code, strong tags and paragraphs inside joinable tokens',
);
Expand Down Expand Up @@ -640,6 +642,8 @@ export const safelyJoinTokens = (tokens: Token[], options: JoinTokenOptions = {}
break;
case 'paragraph_open':
case 'blockquote_close':
case 'html_block':
case 'html_inline':
break;
case 'fence':
if (options.parseCodeFences) {
Expand Down

0 comments on commit 9e72c1f

Please sign in to comment.