@nifrajs/content 5.5.1 → 5.7.0
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/CHANGELOG.md +12 -0
- package/README.md +15 -0
- package/package.json +1 -1
- package/src/index.ts +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @nifrajs/content
|
|
2
2
|
|
|
3
|
+
## 5.7.0
|
|
4
|
+
|
|
5
|
+
No changes in this release.
|
|
6
|
+
|
|
7
|
+
## 5.6.0
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 9ebcb1f: Every `nifra mcp` project tool carries MCP tool annotations, so a host can tell the tools that only read the project from the ones that write files or run project code and ask before those. A tool that writes only under a flag, such as `nifra_review` with `fix` and `write`, is marked as a writer. A tool that imports the project's config or backend runs its top-level code, so `nifra_routes`, `nifra_context`, `nifra_openapi`, `nifra_diff`, `nifra_prove` and the `nifra_db_*` tools are marked as running project code. Each tool's input fields that had no description now have one. The `nifra --help` line for `nifra docs-mcp` names all six tools that server offers.
|
|
12
|
+
|
|
13
|
+
`entry.html` from `@nifrajs/content` is documented as unsanitized Markdown output: render it with `trustHtml(entry.html)` for content you wrote, or run it through `sanitizeHtml(entry.html, yourSanitizer)` when contributors or a CMS write it. The `<Content>` examples in the React, Preact and Solid adapters show the `trustHtml` call.
|
|
14
|
+
|
|
3
15
|
## 5.5.1
|
|
4
16
|
|
|
5
17
|
No changes in this release.
|
package/README.md
CHANGED
|
@@ -10,6 +10,21 @@ Part of the **[nifra](https://nifra.dev)** full-stack TypeScript framework - one
|
|
|
10
10
|
bun add @nifrajs/content
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Rendering an entry
|
|
14
|
+
|
|
15
|
+
`entry.html` is `marked` output, unsanitized: raw HTML and `javascript:` links in the Markdown pass
|
|
16
|
+
through. That is right for content you author. Mark it trusted for an adapter's `<Content>`:
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { trustHtml } from "@nifrajs/web"
|
|
20
|
+
import { Content } from "@nifrajs/web-react/content"
|
|
21
|
+
|
|
22
|
+
<Content html={trustHtml(entry.html)} />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For a collection that contributors or a CMS write, pass `sanitizeHtml(entry.html, sanitizer)` with an
|
|
26
|
+
allowlist sanitizer you choose instead.
|
|
27
|
+
|
|
13
28
|
## Docs
|
|
14
29
|
|
|
15
30
|
- Reference: <https://nifra.dev/docs>
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -52,7 +52,12 @@ export interface Entry<Frontmatter> {
|
|
|
52
52
|
readonly slug: string
|
|
53
53
|
/** Frontmatter, validated + typed by the collection's schema. */
|
|
54
54
|
readonly frontmatter: Frontmatter
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* The body rendered to HTML (Markdown → HTML), unsanitized: raw HTML and `javascript:` links in the
|
|
57
|
+
* Markdown pass through. Render it as-is only for content you author, with
|
|
58
|
+
* `<Content html={trustHtml(entry.html)} />`; run anything contributors or a CMS write through
|
|
59
|
+
* `sanitizeHtml(entry.html, yourSanitizer)` (both from `@nifrajs/web`).
|
|
60
|
+
*/
|
|
56
61
|
readonly html: string
|
|
57
62
|
/** The raw Markdown body, with the frontmatter block stripped. */
|
|
58
63
|
readonly body: string
|