@stacksjs/ts-md 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ High-performance markdown parser and sanitizer built for Bun.
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
bun add ts-md
|
|
17
|
+
bun add @stacksjs/ts-md
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
@@ -22,7 +22,7 @@ bun add ts-md
|
|
|
22
22
|
### Basic Markdown Parsing
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
|
-
import { parseMarkdown } from 'ts-md'
|
|
25
|
+
import { parseMarkdown } from '@stacksjs/ts-md'
|
|
26
26
|
|
|
27
27
|
const html = parseMarkdown('# Hello **world**')
|
|
28
28
|
// <h1 id="hello-world">Hello <strong>world</strong></h1>
|
|
@@ -47,7 +47,7 @@ const html = parseMarkdown(markdown, {
|
|
|
47
47
|
### HTML Sanitization
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
50
|
-
import { sanitizeHtml } from 'ts-md'
|
|
50
|
+
import { sanitizeHtml } from '@stacksjs/ts-md'
|
|
51
51
|
|
|
52
52
|
const clean = sanitizeHtml(userInput, {
|
|
53
53
|
allowedTags: ['p', 'strong', 'em', 'a', 'code'],
|
|
@@ -61,7 +61,7 @@ const clean = sanitizeHtml(userInput, {
|
|
|
61
61
|
### Frontmatter Parsing
|
|
62
62
|
|
|
63
63
|
```typescript
|
|
64
|
-
import { parseFrontmatter } from 'ts-md'
|
|
64
|
+
import { parseFrontmatter } from '@stacksjs/ts-md'
|
|
65
65
|
|
|
66
66
|
const content = `---
|
|
67
67
|
title: My Post
|
|
@@ -78,7 +78,7 @@ console.log(data.title) // 'My Post'
|
|
|
78
78
|
|
|
79
79
|
Benchmark results against popular markdown parsers:
|
|
80
80
|
|
|
81
|
-
| Document Size | ts-md | markdown-it | marked | showdown |
|
|
81
|
+
| Document Size | @stacksjs/ts-md | markdown-it | marked | showdown |
|
|
82
82
|
|--------------|-------------------|-------------|---------|----------|
|
|
83
83
|
| Small (< 1KB) | 324B ops/sec | 112B ops/sec | 26B ops/sec | 14B ops/sec |
|
|
84
84
|
| Medium (~3KB) | 34.7B ops/sec | 17.7B ops/sec | 2.8B ops/sec | 2.8B ops/sec |
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/ts-md",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "A fast, native Bun-powered markdown parser with frontmatter support. Replaces gray-matter, marked, and yaml.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|