250x250
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- HTML
- nextJS
- graphQL
- Ethereum
- API
- Props
- typeScript
- tailwindcss
- bitcoin
- node.js
- Interface
- express.js
- CSS
- useState
- error
- REACT
- 기준
- blockchain
- concept
- Redux
- CLASS
- evm
- solidity
- built in object
- web
- hardhat
- JavaScript
- 삶
- SSR
- middleware
Archives
- Today
- Total
ReasonJun
remark / remark-html 본문
728x90
remark and remark-html are two JavaScript libraries that can be used to process Markdown.
remark is a general-purpose Markdown processor that can be used to do a variety of things, such as:
- Parsing Markdown into an abstract syntax tree (AST)
- Transforming the AST into different formats, such as HTML, JSON, or XML
- Linting Markdown for errors or inconsistencies
- Adding custom extensions to Markdown
remark-html is a plugin for remark that can be used to transform Markdown into HTML. It provides a number of features, such as:
- Support for GFM (GitHub Flavored Markdown)
- Support for custom extensions
- Configurable output
remark and remark-html are both open source and available on GitHub. They are widely used by developers and are well-supported.
Here is a table that summarizes the key differences between remark and remark-html:
| Feature | remark | remark-html |
| Purpose | General-purpose Markdown processor | Markdown to HTML converter |
| Features | Parsing, transforming, linting, extending | GFM, custom extensions, configurable output |
| Use cases | A variety of tasks, such as parsing, transforming, linting, and extending Markdown | Converting Markdown to HTML |
export async function getPostData(id: string) {
const fullPath = path.join(postsDirectory, `${id}.md`);
const fileContents = fs.readFileSync(fullPath, 'utf8');
const matterResult = matter(fileContents);
const processedContent = await remark()
.use(remarkHtml)
.process(matterResult.content);
const contentHTML = processedContent.toString();
return {
id,
contentHTML,
...(matterResult.data as { date: string; title: string }),
};
}
728x90
'Frontend > Library' 카테고리의 다른 글
| React Syntax Highlighter Demo (MDX : Markdown for the component era) (0) | 2023.06.20 |
|---|---|
| Date-fns : (a comprehensive set of date and time utilities) (0) | 2023.06.19 |
| fs / path / gray-matter (0) | 2023.06.17 |
| Styled Components (0) | 2023.06.13 |
| Axios (0) | 2023.06.13 |
Comments