@readme/markdown 14.10.3 → 14.11.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/dist/index.d.ts +1 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/micromark/mdx-expression-lenient/index.d.ts +1 -0
- package/dist/lib/micromark/mdx-expression-lenient/syntax.d.ts +2 -0
- package/dist/main.js +430 -237
- package/dist/main.node.js +430 -237
- package/dist/main.node.js.map +1 -1
- package/dist/processor/transform/mdxish/evaluate-style-block-expressions.d.ts +18 -0
- package/dist/processor/transform/mdxish/remove-jsx-comments.d.ts +11 -0
- package/dist/processor/transform/mdxish/resolve-esm-imports.d.ts +13 -0
- package/dist/processor/transform/mdxish/style-object-to-css.d.ts +11 -0
- package/dist/processor/transform/mdxish/tables/utils.d.ts +5 -0
- package/dist/render-fixture.node.js +430 -237
- package/dist/render-fixture.node.js.map +1 -1
- package/dist/utils/common-html-words.d.ts +7 -0
- package/package.json +2 -2
- package/dist/processor/transform/mdxish/preprocess-jsx-expressions.d.ts +0 -23
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Root } from 'mdast';
|
|
2
|
+
import type { Plugin } from 'unified';
|
|
3
|
+
/**
|
|
4
|
+
* Evaluate the JSX expression wrapping a `<style>` tag's contents (typically a template
|
|
5
|
+
* literal, e.g. `<style>{\`.foo { color: red; }\`}</style>`) so the tag ends up holding plain
|
|
6
|
+
* CSS text instead of the literal `{`...`}` wrapper — which the browser treats as invalid CSS
|
|
7
|
+
* and drops the entire stylesheet for.
|
|
8
|
+
*
|
|
9
|
+
* `<style>` is one of CommonMark's "raw text" HTML elements (along with script/pre/textarea):
|
|
10
|
+
* its contents are captured verbatim as a single `html` mdast node with no inner tokenization,
|
|
11
|
+
* so this expression never reaches the mdxFlowExpression tokenizer or `evaluateExpressions` —
|
|
12
|
+
* it has to be matched and evaluated directly against the raw node's string value.
|
|
13
|
+
*
|
|
14
|
+
* Must run after `evaluateExports` (needs `file.data.mdxishScope`) and before `remarkRehype`
|
|
15
|
+
* turns `html` mdast nodes into raw hast strings. Skipped in safeMode.
|
|
16
|
+
*/
|
|
17
|
+
declare const evaluateStyleBlockExpressions: Plugin<[], Root>;
|
|
18
|
+
export default evaluateStyleBlockExpressions;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes JSX-style comments (e.g., { /* comment *\/ }) from content.
|
|
3
|
+
*
|
|
4
|
+
* `@param` content
|
|
5
|
+
* `@returns` Content with JSX comments removed
|
|
6
|
+
* `@example`
|
|
7
|
+
* ```typescript
|
|
8
|
+
* removeJSXComments('Text {/* comment *\/} more text') // => 'Text more text'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function removeJSXComments(content: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ImportDeclaration } from 'estree';
|
|
2
|
+
export type ModuleRegistry = Record<string, unknown>;
|
|
3
|
+
export declare const defaultModuleRegistry: ModuleRegistry;
|
|
4
|
+
/**
|
|
5
|
+
* Turn `import` declarations into a flat map of binding → value.
|
|
6
|
+
*
|
|
7
|
+
* A "binding" is a mapping of a local name to the value of it in the module exports
|
|
8
|
+
* Example: `import { useState } from 'react'` yields `{ useState: React.useState }`.
|
|
9
|
+
*
|
|
10
|
+
* Unsupported specifiers are skipped with a warning rather than throwing, so a
|
|
11
|
+
* single unknown import can't break the rest of the document.
|
|
12
|
+
*/
|
|
13
|
+
export declare const collectImportValues: (importDeclarations: ImportDeclaration[], registry?: ModuleRegistry) => Record<string, unknown>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True for a value that should be serialized as a style object rather than passed through
|
|
3
|
+
* as an already-CSS string. React elements are excluded since they're valid objects too.
|
|
4
|
+
*/
|
|
5
|
+
export declare const isPlainObject: (value: unknown) => value is Record<string, unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Serialize a React-style inline style object (`{ color: "red", fontSize: 12 }`) into a
|
|
8
|
+
* CSS declaration string (`color:red;font-size:12px`), the shape hast/HTML expects for a
|
|
9
|
+
* `style` attribute. Empty (`undefined`/`null`/`''`) entries are dropped.
|
|
10
|
+
*/
|
|
11
|
+
export declare const styleObjectToCssText: (style: Record<string, unknown>) => string;
|
|
@@ -9,6 +9,11 @@ export interface RepairResult {
|
|
|
9
9
|
value: string;
|
|
10
10
|
}
|
|
11
11
|
export declare const tableTags: Set<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Replaces every paragraph node with its inline children. Used where paragraphs
|
|
14
|
+
* are parser artifacts (remarkMdx wrapping inline JSX), not real content.
|
|
15
|
+
*/
|
|
16
|
+
export declare const unwrapParagraphNodes: (children: Node[]) => Node[];
|
|
12
17
|
/**
|
|
13
18
|
* If the cell has exactly one paragraph child, unwrap it so its inline children sit
|
|
14
19
|
* directly under the cell (matches GFM table cell shape and avoids stray `<p>` wrappers).
|