Skip to content

Commit

Permalink
Render inline items inside heading
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Oct 28, 2021
1 parent 8b8cfa2 commit 52f9e4f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/ReactParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ class ReactParser {
return null;
}

case 'hr': {
return this.renderer.hr();
}

case 'heading': {
return this.renderer.heading(token.text, token.depth);
return this.renderer.heading(this.parseInline(token.tokens), token.depth);
}

case 'paragraph': {
Expand Down Expand Up @@ -91,6 +87,10 @@ class ReactParser {
return this.renderer.table([header, body]);
}

case 'hr': {
return this.renderer.hr();
}

default: {
console.warn(`Token with "${token.type}" type was not found`); // eslint-disable-line no-console
return null;
Expand All @@ -108,10 +108,6 @@ class ReactParser {
return this.renderer.text(unescape(token.text));
}

case 'escape': {
return this.renderer.text(token.text);
}

case 'strong': {
return this.renderer.strong(this.parseInline(token.tokens));
}
Expand All @@ -128,10 +124,6 @@ class ReactParser {
return this.renderer.codespan(unescape(token.text));
}

case 'br': {
return this.renderer.br();
}

case 'link': {
const href = joinBase(token.href, baseURL);
return this.renderer.link(href, this.parseInline(token.tokens), openLinksInNewTab);
Expand All @@ -146,6 +138,14 @@ class ReactParser {
return this.renderer.html(token.text);
}

case 'br': {
return this.renderer.br();
}

case 'escape': {
return this.renderer.text(token.text);
}

default:
console.warn(`Token with "${token.type}" type was not found`); // eslint-disable-line no-console
return null;
Expand Down

0 comments on commit 52f9e4f

Please sign in to comment.