0

I am trying to build a Static site Generator, and want to extend the markdown with bit of my own syntax using my own syntax.

This is the Markdown

> section
# Section Title1
This is a sample markdown text
### Title
This is content of the section

> section
# Section Title2
This is a sample markdown text
### Title
This is content of the section

> section
# Section Title3
This is a sample markdown text
### Title
This is content of the section

Expected Parsed HTML

<div id="section-title1">
  <h1>Section Title1</h1>
  <p>This is a sample markdown text</p>
  <h3>Title</h3>
  <p>This is content of the section</p>
</div>
<div id="section-title2">
 <h1>Section Title2</h1>
  <p>This is a sample markdown text</p>
  <h3>Title</h3>
  <p>This is content of the section</p>
</div>
<div id="section-title3">
   <h1>Section Title3</h1>
  <p>This is a sample markdown text</p>
  <h3>Title</h3>
  <p>This is content of the section</p>
</div>

As a summary i want to group the content by > section delimiter, I am using MarkedJs to parse the markdown files in my code.

I tried using custom tokenizer but unable to group them.

Suraj Kumar
  • 281
  • 6
  • 13

0 Answers0