https://github.com/dev-pengi/mark-parse
a package that parses Markdown syntax and converts it into HTML
https://github.com/dev-pengi/mark-parse
converter formatter html markdown markdown-to-html markup markup-converter parser text-to-html
Last synced: about 1 month ago
JSON representation
a package that parses Markdown syntax and converts it into HTML
- Host: GitHub
- URL: https://github.com/dev-pengi/mark-parse
- Owner: dev-pengi
- Created: 2023-05-23T21:09:36.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-24T05:17:36.000Z (about 3 years ago)
- Last Synced: 2025-10-11T01:45:39.258Z (8 months ago)
- Topics: converter, formatter, html, markdown, markdown-to-html, markup, markup-converter, parser, text-to-html
- Language: TypeScript
- Homepage: https://npmjs.com/mark-parse
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mark parse
Mark parse is a JavaScript module that allows you to parse Markdown text and convert it into HTML.
## Installation
You can install the Make parse module using npm:
```bash
npm install mark-parse
```
## Usage
Import the `Make parse` class into your JavaScript file:
```javascript
import { MarkdownParser } from 'mark-parse';
```
Create an instance of the `MarkdownParser` class:
```javascript
const parser = new MarkdownParser();
```
Parse Markdown text:
```javascript
const markdown = '# Hello, World!';
const html = parser.parse(markdown);
console.log(html);
```
### Options
The `MarkdownParser` constructor accepts an optional `options` parameter that allows you to customize the parsing behavior. The available options are:
- `parseList` (default: `true`): Set to `false` to disable parsing of lists.
- `parseCodeBlock` (default: `true`): Set to `false` to disable parsing of code blocks.
- `parseBlockQuote` (default: `true`): Set to `false` to disable parsing of block quotes.
- `parseHeading` (default: `true`): Set to `false` to disable parsing of headings.
- `parseInlineCode` (default: `true`): Set to `false` to disable parsing of inline code.
- `parseHorizontalRule` (default: `true`): Set to `false` to disable parsing of horizontal rules.
- `parseBold` (default: `true`): Set to `false` to disable parsing of bold text.
- `parseItalic` (default: `true`): Set to `false` to disable parsing of italic text.
- `parseUnderline` (default: `true`): Set to `false` to disable parsing of underline text.
- `parseStrikethrough` (default: `true`): Set to `false` to disable parsing of strikethrough text.
- `parseLink` (default: `true`): Set to `false` to disable parsing of links.
- `parseImage` (default: `true`): Set to `false` to disable parsing of images.
You can customize the parsing behavior by providing an options object when creating the `MarkdownParser` instance:
```javascript
const options = {
parseList: true,
parseCodeBlock: true,
parseBlockQuote: true,
parseHeading: true,
parseInlineCode: true,
parseHorizontalRule: true,
parseBold: true,
parseItalic: true,
parseUnderline: true,
parseStrikethrough: true,
parseLink: true,
parseImage: true,
};
const parser = new MarkdownParser(options);
```
### Example
Here's an example of parsing Markdown text and rendering the HTML output:
```javascript
import { MarkdownParser } from 'markdown-parser';
const options = {
parseHeading: false,
};
const parser = new MarkdownParser(options);
const markdown = '# Hello, World!';
const html = parser.parse(markdown);
console.log(html);
```
This output:
```
Hello, World!
```