Skip to content

Commit

Permalink
Adding the code for inline code block and fenced code block
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavik001 committed Sep 29, 2023
1 parent 33d4a87 commit 525e313
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ function processMdFile(inputFilePath, outputDir) {
.replace(/^(?!<h[1-6]>|<ul>|<ol>|<li>|<a>).+$/gm, "<p>$&</p>") // paragraph
.replace(/\[(.+?)\]\((.+?)\)/g, '<a href=$2">$1</a>') // link
.replace(/\*(.*?)\*/g, "<i>$1</i>") // italic
.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>"); // bold
.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>") // bold
.replace(/`(.*?)`/g, "<code>$1</code>") // inline code
.replace(/```([\s\S]*?)```/g, "<pre><code>$1</code></pre>"); // fenced code block

const fileName = path.basename(inputFilePath, ".md");
const outputFile = path.join(outputDir, `${fileName}.html`);
Expand Down

0 comments on commit 525e313

Please sign in to comment.