@easy-cms/richtext 0.21.0 → 0.22.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 +19 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
# @easy-cms/richtext
|
|
2
2
|
|
|
3
|
-
Renders [Easy CMS](https://github.com/maritonx/easy-cms)
|
|
3
|
+
Renders Easy CMS rich text (Tiptap JSON) to safe HTML, plain text or Markdown. Part of [Easy CMS](https://github.com/maritonx/easy-cms), the embedded, code-first headless CMS for Nuxt and Next.js.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @easy-cms/richtext
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or `pnpm add`, `yarn add` or `bun add`.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
4
14
|
|
|
5
15
|
```ts
|
|
6
|
-
import { renderRichText, richTextToPlainText } from '@easy-cms/richtext'
|
|
16
|
+
import { renderMarkdown, renderRichText, richTextToPlainText } from '@easy-cms/richtext'
|
|
7
17
|
|
|
8
18
|
const html = renderRichText(post.body) // escaped, unsafe URLs removed
|
|
9
19
|
const text = richTextToPlainText(post.body)
|
|
20
|
+
const markdown = renderMarkdown(post.body) // e.g. for llms.txt or AI assistants
|
|
10
21
|
```
|
|
11
22
|
|
|
12
23
|
Supports headings, paragraphs, bold, italic, underline, strike, code, links, lists, quotes, code
|
|
13
24
|
blocks, hard breaks, rules and images. Pass `{ nodes: { image: (node, children) => '…' } }` to
|
|
14
25
|
customize a node. No dependencies; works in Node and browsers.
|
|
26
|
+
|
|
27
|
+
## Links
|
|
28
|
+
|
|
29
|
+
[Rich text](https://maritonx.github.io/easy-cms/guide/rich-text) · [Documentation](https://maritonx.github.io/easy-cms/) ([ภาษาไทย](https://maritonx.github.io/easy-cms/th/)) · [GitHub](https://github.com/maritonx/easy-cms)
|
|
30
|
+
|
|
31
|
+
MIT License
|