/markdownToHtml.ts Secret
Created
June 21, 2021 07:24
Next + Nx series
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//libs/markdown/src/lib/markdownToHtml.ts | |
import remark from 'remark'; | |
import html from 'remark-html'; | |
export async function markdownToHtml(markdown) { | |
const result = await remark().use(html).process(markdown); | |
return result.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In this file you have small mistake which will cause static props rendering to be failed.
remark
should be imported like an instance from propertyimport { remark } from 'remark'
to make call as a function available, or you can useremark.remark()
in line #6 which will also works but not so elegant.