@readme/markdown 15.3.0 → 15.5.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.
@@ -1,5 +1,17 @@
1
1
  import postcss from 'postcss';
2
- export declare function tailwindCompiler(classes: string[], { prefix, darkModeDataAttribute }: {
2
+ export declare function tailwindCompiler(classes: string[], { prefix, darkModeDataAttribute, darkModeRootSelector, }: {
3
3
  darkModeDataAttribute?: string | null;
4
+ /**
5
+ * Scopes the `dark:` variant to `darkModeRootSelector[darkModeDataAttribute=dark]`
6
+ * (self or descendant) instead of matching `[darkModeDataAttribute=dark]` on *any*
7
+ * ancestor. Matches `when-color-mode-dark($root)` in `styles/mixins/when-color-mode-dark.scss`
8
+ * — see that mixin's doc comment for the full rationale (two independent
9
+ * `data-color-mode` scopes on one page, e.g. readme's SuperHub admin shell vs. the
10
+ * hub content it's previewing) and why there's no default: this package ships one
11
+ * precompiled stylesheet, so whatever a caller passes is permanent for every
12
+ * installer, and readme (this package's only real consumer today) is expected to
13
+ * pass its hub color-mode root, `.rm-ReadMe`.
14
+ */
15
+ darkModeRootSelector?: string | null;
4
16
  prefix: string;
5
17
  }): Promise<postcss.Result<postcss.Root>>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@readme/markdown",
3
3
  "description": "ReadMe's React-based Markdown parser",
4
4
  "author": "Rafe Goldberg <rafe@readme.io>",
5
- "version": "15.3.0",
5
+ "version": "15.5.0",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",
@@ -1,21 +0,0 @@
1
- import type { Parent } from 'mdast';
2
- import type { Plugin } from 'unified';
3
- /**
4
- * Transform paragraph-wrapped self-closing JSX components into mdxJsxFlowElement nodes.
5
- *
6
- * CommonMark wraps multi-line JSX in paragraphs when the opening tag isn't complete
7
- * on one line. This plugin detects these structures and unwraps them for components
8
- * in the SELF_CLOSING_BLOCK_TAGS allowlist.
9
- *
10
- * Input structure:
11
- * ```
12
- * paragraph > html: "<Embed\n typeOfEmbed=\"youtube\"\n/>"
13
- * ```
14
- *
15
- * Output structure:
16
- * ```
17
- * mdxJsxFlowElement: { name: "Embed", attributes: [...], children: [] }
18
- * ```
19
- */
20
- declare const mdxishSelfClosingBlocks: Plugin<[], Parent>;
21
- export default mdxishSelfClosingBlocks;
@@ -1,28 +0,0 @@
1
- export type SnakeCaseMapping = Record<string, string>;
2
- export interface SnakeCasePreprocessResult {
3
- content: string;
4
- mapping: SnakeCaseMapping;
5
- }
6
- export interface ProcessSnakeCaseOptions {
7
- /**
8
- * Set of known component names
9
- * Used to filter which snake_case components to transform
10
- */
11
- knownComponents?: Set<string>;
12
- }
13
- /**
14
- * Replaces snake_case component names with valid HTML placeholders.
15
- * Required because remark-parse rejects tags with underscores.
16
- * Example: `<Snake_case />` → `<MDXishSnakeCase0 />`
17
- *
18
- * Code blocks and inline code are protected and will not be transformed.
19
- *
20
- * @param content - The markdown content to process
21
- * @param options - Options including knownComponents to filter by
22
- */
23
- export declare function processSnakeCaseComponent(content: string, options?: ProcessSnakeCaseOptions): SnakeCasePreprocessResult;
24
- /**
25
- * Restores placeholder name to original snake_case name.
26
- * Uses case-insensitive matching since HTML parsers normalize to lowercase.
27
- */
28
- export declare function restoreSnakeCase(placeholderName: string, mapping: SnakeCaseMapping): string;
@@ -1,12 +0,0 @@
1
- import type { SnakeCaseMapping } from './components/snake-case-components';
2
- import type { Parent } from 'mdast';
3
- import type { Plugin } from 'unified';
4
- interface Options {
5
- mapping: SnakeCaseMapping;
6
- }
7
- /**
8
- * Restores snake_case component names from placeholders after parsing.
9
- * Runs after mdxishComponentBlocks converts HTML nodes to mdxJsxFlowElement.
10
- */
11
- declare const restoreSnakeCaseComponentNames: Plugin<[Options], Parent>;
12
- export default restoreSnakeCaseComponentNames;