mdream 1.1.1 → 1.2.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 +21 -0
- package/dist/iife.js +1 -1
- package/package.json +15 -15
- package/wasm/mdream_edge_bg.wasm +0 -0
- package/wasm/package.json +1 -1
- package/wasm-bundler/mdream_edge_bg.wasm +0 -0
- package/wasm-bundler/package.json +1 -1
package/README.md
CHANGED
|
@@ -302,6 +302,13 @@ interface FrontmatterConfig {
|
|
|
302
302
|
|
|
303
303
|
Override how specific HTML tags are rendered in Markdown. String values act as aliases.
|
|
304
304
|
|
|
305
|
+
> **Unknown tags pass through as plain text.** Tag matching is strict: only the standard HTML tags ship with built-in Markdown semantics. Custom elements (`<my-widget>`), web components, and any non-standard tag emit their text content verbatim, with the surrounding tag dropped. To render a custom tag with Markdown semantics, alias it with `tagOverrides`:
|
|
306
|
+
>
|
|
307
|
+
> ```ts
|
|
308
|
+
> htmlToMarkdown('<my-em>hi</my-em>', { tagOverrides: { 'my-em': 'em' } })
|
|
309
|
+
> // → "_hi_"
|
|
310
|
+
> ```
|
|
311
|
+
|
|
305
312
|
```ts
|
|
306
313
|
interface TagOverride {
|
|
307
314
|
/** Markdown string to insert when entering this tag */
|
|
@@ -338,6 +345,20 @@ const markdown = htmlToMarkdown(html, {
|
|
|
338
345
|
})
|
|
339
346
|
```
|
|
340
347
|
|
|
348
|
+
**Output is GitHub Flavored Markdown.** Mdream emits a fixed GFM dialect tuned for LLM input: ATX headings (`#`), fenced code blocks (` ``` `), `-` bullets, `_` emphasis, `**` strong, `---` horizontal rules, inline links. These are not configurable. For simple delimiter swaps you can use `tagOverrides`:
|
|
349
|
+
|
|
350
|
+
```ts
|
|
351
|
+
htmlToMarkdown(html, {
|
|
352
|
+
tagOverrides: {
|
|
353
|
+
em: { enter: '*', exit: '*', isInline: true }, // _x_ → *x*
|
|
354
|
+
strong: { enter: '__', exit: '__', isInline: true }, // **x** → __x__
|
|
355
|
+
hr: { enter: '* * *', exit: '' }, // --- → * * *
|
|
356
|
+
},
|
|
357
|
+
})
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Structural style differences (setext headings, indented code blocks, reference-style links, `~~~` fences, dynamic list markers) are out of scope. If you need turndown-style configurability, use [turndown](https://github.com/mixmark-io/turndown). If you have a use case for these in mdream, please open an issue.
|
|
361
|
+
|
|
341
362
|
### FilterOptions
|
|
342
363
|
|
|
343
364
|
```ts
|