A custom-built parser for DrewMark, developed with Vanilla JavaScript — zero dependencies. Parses DrewMark-formatted plain text into standard HTML.
<script src="js/drewmark-parser.min.js"></script> <!-- Include the DrewMark JS Parser -->
<script>
const html = drewmarkParser(content); // Parse DrewMark source text into HTML
</script>Parsing can be done by just two lines of code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<main>
<div id="source" hidden>
# Heading
This is a paragraph with **bold** and %%italic%%.
</div>
</main>
<!-- Include the DrewMark JS Parser -->
<script src="js/drewmark-parser.min.js"></script>
<script>
// Output the parsed result into the <main> tag, replacing the original source text
document.getElementsByTagName('main')[0].innerHTML =
drewmarkParser(document.getElementById('source').innerText);
</script>
</body>
</html>drewmarkParser(content, options?)| Parameter | Type | Required | Description |
|---|---|---|---|
content |
string | string[] |
Yes | DrewMark source text |
options |
object |
No | Configuration (see below) |
| Option | Type | Default | Description |
|---|---|---|---|
enable_emoji |
boolean |
false |
Parse emoji syntax (::smile:: 🡒 😄) |
enable_style |
boolean |
false |
Parse style blocks and style attributes |
enhance_codeblock |
boolean |
true |
Append language label + copy button to code blocks |
enhance_progress |
boolean |
true |
Append numeric values after progress bars |
disable_syntax |
string[] |
[] |
Disable specific syntaxes or syntax groups |
// Disable entire groups
drewmarkParser(content, { disable_syntax: ['headings', 'lists', 'embeds'] });
// Disable specific items
drewmarkParser(content, { disable_syntax: ['highlight', 'audio', 'video', 'deflist'] });
// Mixed
drewmarkParser(content, { disable_syntax: ['text-decors', 'table', 'link'] });See the full documentation for all supported syntax names and aliases.
- Full DrewMark syntax support (v2.3 spec)
- Compatible with Markdown table and emoji syntax
- No third-party dependencies — pure Vanilla JS
- Lightweight minified build (less than 100kb)
See docs/doc.md for the full API reference.
中文文档: docs/doc-cn.md
- DrewMark (syntax specification)
- DrewMark JS Editor (WYSIWYG editor)
- DrewMark JS Converter (convert between three formats)
MIT
