@oxide/react-asciidoc 1.2.0 → 1.3.0-canary.5535dcb
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 +361 -74
- package/dist/react-asciidoc.js +3142 -1077
- package/dist/react-asciidoc.umd.cjs +21 -23
- package/dist/types/RenderInline.d.ts +93 -0
- package/dist/types/index.d.ts +7 -2
- package/dist/types/inline/index.d.ts +4 -0
- package/dist/types/inline/parser.d.ts +90 -0
- package/dist/types/inline/quotes.d.ts +5 -0
- package/dist/types/inline/renderer.d.ts +3 -0
- package/dist/types/inline/rx.d.ts +28 -0
- package/dist/types/inline/types.d.ts +105 -0
- package/dist/types/templates/FloatingTitle.d.ts +5 -1
- package/dist/types/templates/Stem.d.ts +5 -0
- package/dist/types/templates/index.d.ts +2 -1
- package/dist/types/utils/prepareDocument.d.ts +32 -5
- package/package.json +10 -18
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import parse from 'html-react-parser';
|
|
2
|
-
import
|
|
2
|
+
import RenderInline, { type InlineOverrides, inlineHtml } from './RenderInline';
|
|
3
|
+
import * as Inline from './inline';
|
|
4
|
+
import { Admonition, Audio, CoList, DList, Document, Example, FloatingTitle, Image, Listing, Literal, OList, Open, PageBreak, Paragraph, Pass, Preamble, Quote, Section, Sidebar, Stem, Table, TableOfContents, ThematicBreak, UList, Verse, Video } from './templates';
|
|
3
5
|
import { Title } from './templates/util';
|
|
4
6
|
import { isOption, prepareDocument, processDocument } from './utils/prepareDocument';
|
|
5
7
|
import type { AdmonitionBlock, AudioBlock, Block, CoListBlock, DListBlock, DocumentBlock, DocumentSection, ImageBlock, ListBlock, LiteralBlock, ParagraphBlock, SectionBlock, TableBlock, VideoBlock } from './utils/prepareDocument';
|
|
@@ -22,6 +24,7 @@ type Overrides = {
|
|
|
22
24
|
quote?: typeof Quote;
|
|
23
25
|
section?: typeof Section;
|
|
24
26
|
sidebar?: typeof Sidebar;
|
|
27
|
+
stem?: typeof Stem;
|
|
25
28
|
table?: typeof Table;
|
|
26
29
|
toc?: typeof TableOfContents;
|
|
27
30
|
thematic_break?: typeof ThematicBreak;
|
|
@@ -31,6 +34,7 @@ type Overrides = {
|
|
|
31
34
|
};
|
|
32
35
|
export type Options = {
|
|
33
36
|
overrides?: Overrides;
|
|
37
|
+
inlineOverrides?: InlineOverrides;
|
|
34
38
|
customDocument?: typeof Document;
|
|
35
39
|
};
|
|
36
40
|
export declare const Context: import("react").Context<Options & {
|
|
@@ -52,6 +56,7 @@ export declare const useConverterContext: () => Options & {
|
|
|
52
56
|
sections?: DocumentSection[];
|
|
53
57
|
};
|
|
54
58
|
};
|
|
55
|
-
export { Asciidoc, Content, prepareDocument, Title, parse, processDocument, isOption };
|
|
59
|
+
export { Asciidoc, Content, prepareDocument, Title, parse, processDocument, isOption, RenderInline, inlineHtml, Inline, };
|
|
60
|
+
export type { InlineOverrides };
|
|
56
61
|
export type { AdmonitionBlock, AudioBlock, Block, CoListBlock, DListBlock, DocumentBlock, DocumentSection, ImageBlock, ListBlock, LiteralBlock, ParagraphBlock, SectionBlock, TableBlock, VideoBlock, };
|
|
57
62
|
export * from './templates';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { InlineNode } from './types';
|
|
2
|
+
export interface ParseOptions {
|
|
3
|
+
compatMode?: boolean;
|
|
4
|
+
attributes?: Record<string, string>;
|
|
5
|
+
/** Shared state for cross-call numbering (footnotes, etc.). If not
|
|
6
|
+
* provided, a fresh state is allocated for the call. */
|
|
7
|
+
state?: ParseState;
|
|
8
|
+
/** Internal: true when this parseInline call is processing text that
|
|
9
|
+
* has already been through subSpecialchars (e.g. recursive call from
|
|
10
|
+
* subQuotes on inner text). Skip specialchars to avoid double-escape. */
|
|
11
|
+
_alreadyEscaped?: boolean;
|
|
12
|
+
/** Internal: true when parsing the inner content of a quoted span. The
|
|
13
|
+
* email macro uses this to suppress linkification at position 0 (the
|
|
14
|
+
* quote tag's `>` is a non-linking context in stock asciidoctor). */
|
|
15
|
+
_quoted?: boolean;
|
|
16
|
+
/** Internal: index into the quote-subs list to start from when parsing the
|
|
17
|
+
* inner content of a quoted span. Asciidoctor applies the substitution
|
|
18
|
+
* passes sequentially over the whole string, so a span's content is only
|
|
19
|
+
* subject to the passes that come AFTER the one that matched it — earlier
|
|
20
|
+
* passes already ran (replacing their matches with placeholders) and the
|
|
21
|
+
* matching pass itself never re-scans its own replacement. Re-applying
|
|
22
|
+
* earlier passes here would wrongly re-format literal content such as the
|
|
23
|
+
* `_un_` inside `\__un__` → `<em>_un_</em>`. */
|
|
24
|
+
_quoteFromIndex?: number;
|
|
25
|
+
/** Internal: restrict which substitution steps run, by asciidoctor sub name
|
|
26
|
+
* (`specialcharacters`, `quotes`, `attributes`, `replacements`, `macros`,
|
|
27
|
+
* `post_replacements`). Used for verbatim blocks with an explicit `subs`
|
|
28
|
+
* list (e.g. a listing with `subs=+macros` runs macros but NOT quotes). When
|
|
29
|
+
* undefined, all normal subs run. */
|
|
30
|
+
_subs?: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface ParseState {
|
|
33
|
+
footnoteIndex: number;
|
|
34
|
+
footnotesById: Map<string, number>;
|
|
35
|
+
/** Collected footnote definitions (in source order) so that the document
|
|
36
|
+
* template can render a footnote section without calling
|
|
37
|
+
* asciidoctor's `getFootnotes()`. Each entry carries the 1-based
|
|
38
|
+
* index and the parsed-inline `text` array. */
|
|
39
|
+
footnoteDefs?: InlineNode[][];
|
|
40
|
+
/** Document-wide counters for `{counter:name}` / `{counter2:name}`. Shared
|
|
41
|
+
* across the whole document (including titles) so values increment in
|
|
42
|
+
* source order, matching asciidoctor. */
|
|
43
|
+
counters?: Map<string, number | string>;
|
|
44
|
+
/** Source-order resets for counters. A `:!name:` (or `:name!:`) attribute
|
|
45
|
+
* entry in the document body unsets the attribute; the next `{counter:name}`
|
|
46
|
+
* then restarts from 1. Those entries aren't AST blocks, so the inline
|
|
47
|
+
* parser can't see them — `prepareDocument` pre-scans the raw source and
|
|
48
|
+
* records, per name, the set of use-indices BEFORE which the counter must
|
|
49
|
+
* reset. `counterUses` tracks how many times each counter has been used. */
|
|
50
|
+
counterResets?: Map<string, Set<number>>;
|
|
51
|
+
counterUses?: Map<string, number>;
|
|
52
|
+
/** Attribute-set counter seeds: when `:name: VALUE` appears in the document
|
|
53
|
+
* body with a non-empty value, the next `{counter:name}` after that point
|
|
54
|
+
* uses `succ(VALUE)` as its value (e.g. `:c: 10` → 11, `:c: @` → A) instead
|
|
55
|
+
* of starting at 1. Maps counter name → (use-index → raw seed value). */
|
|
56
|
+
counterSeeds?: Map<string, Map<number, string>>;
|
|
57
|
+
}
|
|
58
|
+
export declare function subSpecialchars(text: string): string;
|
|
59
|
+
/** Replace callout markers in specialchars-escaped text.
|
|
60
|
+
* `iconsFont=true` uses `<i>` / `<b>` (font-icons mode, the default in
|
|
61
|
+
* tests). Otherwise asciidoctor emits bare `<N>` text.
|
|
62
|
+
*
|
|
63
|
+
* In listing/literal/verse source, callout markers look like `<1>`, `<.>`
|
|
64
|
+
* (auto-numbered), and can be preceded by a comment prefix (`//`, `#`,
|
|
65
|
+
* `--`, or `;;`). When icons=font (the default test mode), the prefix is
|
|
66
|
+
* stripped and the marker is replaced with an icon+badge. When icons is
|
|
67
|
+
* not font-mode, the marker is preserved as `<N>`.
|
|
68
|
+
*
|
|
69
|
+
* Callouts can also appear inside HTML comment guards: `<!--1-->`. After
|
|
70
|
+
* subSpecialchars these become `<!--1-->`. When icons=font the
|
|
71
|
+
* guard is stripped and the callout is rendered as an icon; otherwise the
|
|
72
|
+
* guard is preserved around `<N>`. */
|
|
73
|
+
export declare function subCallouts(text: string, iconsFont?: boolean, lineComment?: string): string;
|
|
74
|
+
/** Like {@link subCallouts}, but keyed to RAW (un-escaped) callout markers.
|
|
75
|
+
*
|
|
76
|
+
* `subCallouts` matches specialchars-escaped markers (`<N>`) because it
|
|
77
|
+
* runs on the escaped content the default `innerHTML` renderer needs.
|
|
78
|
+
* Consumers that post-process the raw `block.source` instead — e.g. a syntax
|
|
79
|
+
* highlighter — need callouts resolved against the original `<N>` markers,
|
|
80
|
+
* which never went through specialchars. This is that counterpart: same
|
|
81
|
+
* matching rules (comment-guard callouts, comment-prefix stripping, escape
|
|
82
|
+
* with `\`, end-of-line lookahead, auto-numbered `.`), but the literal
|
|
83
|
+
* delimiters are `<`/`>` rather than `<`/`>`.
|
|
84
|
+
*
|
|
85
|
+
* With `iconsFont=true` the marker is replaced with conum markup
|
|
86
|
+
* (`<i class="conum" data-value="N"></i><b>(N)</b>`); otherwise the bare
|
|
87
|
+
* `<N>` marker is preserved (with any comment prefix). All non-callout text
|
|
88
|
+
* is returned untouched and un-escaped, ready to feed to a highlighter. */
|
|
89
|
+
export declare function subCalloutsRaw(text: string, iconsFont?: boolean, lineComment?: string): string;
|
|
90
|
+
export declare function parseInline(text: string, opts?: ParseOptions): InlineNode[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const InlineAnchorRx: RegExp;
|
|
2
|
+
export declare const InlineBiblioAnchorRx: RegExp;
|
|
3
|
+
export declare const InlineEmailRx: RegExp;
|
|
4
|
+
export declare const InlineFootnoteMacroRx: RegExp;
|
|
5
|
+
export declare const InlineImageMacroRx: RegExp;
|
|
6
|
+
export declare const InlineIndextermMacroRx: RegExp;
|
|
7
|
+
export declare const InlineKbdBtnMacroRx: RegExp;
|
|
8
|
+
export declare const InlineLinkRx: RegExp;
|
|
9
|
+
export declare const InlineLinkMacroRx: RegExp;
|
|
10
|
+
export declare const InlineMenuMacroRx: RegExp;
|
|
11
|
+
export declare const InlineMenuRx: RegExp;
|
|
12
|
+
export declare const InlinePassRxNonCompat: RegExp;
|
|
13
|
+
export declare const InlinePassRxCompat: RegExp;
|
|
14
|
+
export declare const InlinePassMacroRx: RegExp;
|
|
15
|
+
export declare const InlineStemMacroRx: RegExp;
|
|
16
|
+
export declare const InlineXrefMacroRx: RegExp;
|
|
17
|
+
export declare const HardLineBreakRx: RegExp;
|
|
18
|
+
export declare const CalloutSourceRx: RegExp;
|
|
19
|
+
export declare const SpecialCharsRx: RegExp;
|
|
20
|
+
export declare const AttributeReferenceRx: RegExp;
|
|
21
|
+
export declare const QuotedTextSniffRx: Record<string, RegExp>;
|
|
22
|
+
export declare const PassSlotRx: RegExp;
|
|
23
|
+
export declare const ReplaceableTextRx: RegExp;
|
|
24
|
+
export declare const SpecialCharsTr: Record<string, string>;
|
|
25
|
+
export declare const REPLACEMENTS: Array<[RegExp, string]>;
|
|
26
|
+
export declare const NORMAL_SUBS: readonly ["specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"];
|
|
27
|
+
export declare const HARD_LINE_BREAK = " +";
|
|
28
|
+
export declare const ATTR_REF_HEAD = "{";
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export type QuoteSubType = 'emphasis' | 'strong' | 'monospaced' | 'double' | 'single' | 'superscript' | 'subscript' | 'mark' | 'asciimath' | 'latexmath' | 'unquoted';
|
|
2
|
+
export interface QSubEntry {
|
|
3
|
+
type: QuoteSubType;
|
|
4
|
+
scope: 'constrained' | 'unconstrained';
|
|
5
|
+
rx: RegExp;
|
|
6
|
+
}
|
|
7
|
+
export type InlineNode = TextNode | QuotedNode | AnchorNode | ImageNode | FootnoteNode | IndexTermNode | CalloutNode | BreakNode | ButtonNode | KeyboardNode | MenuNode;
|
|
8
|
+
export interface TextNode {
|
|
9
|
+
type: 'text';
|
|
10
|
+
text: string;
|
|
11
|
+
/** Raw HTML from a no-subs passthrough (`+++…+++`, `pass:[…]`). Must be
|
|
12
|
+
* emitted verbatim — the React renderer parses it into elements rather
|
|
13
|
+
* than escaping it as text. */
|
|
14
|
+
raw?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface QuotedNode {
|
|
17
|
+
type: 'quoted';
|
|
18
|
+
subtype: 'emphasis' | 'strong' | 'monospaced' | 'double' | 'single' | 'superscript' | 'subscript' | 'mark' | 'asciimath' | 'latexmath' | 'unquoted';
|
|
19
|
+
text: InlineNode[];
|
|
20
|
+
id?: string;
|
|
21
|
+
role?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AnchorNode {
|
|
24
|
+
type: 'anchor';
|
|
25
|
+
subtype: 'link' | 'ref' | 'xref' | 'bibref';
|
|
26
|
+
text: InlineNode[];
|
|
27
|
+
target: string;
|
|
28
|
+
id?: string;
|
|
29
|
+
role?: string;
|
|
30
|
+
window?: string;
|
|
31
|
+
/** Per-xref display style from `xref:id[xrefstyle=short|full]`. Overrides
|
|
32
|
+
* the document `:xrefstyle:` when computing the fallback label. */
|
|
33
|
+
xrefstyle?: string;
|
|
34
|
+
/** Set when the xref carried an explicit reftext (e.g. `<<id,text>>` or
|
|
35
|
+
* `xref:id[text]`). Distinguishes a user-typed label that happens to equal
|
|
36
|
+
* `[id]` from the auto-generated fallback, so `resolveXrefs` leaves it be. */
|
|
37
|
+
explicitText?: boolean;
|
|
38
|
+
/** Set for the macro form (`xref:target[]`) as opposed to the shorthand
|
|
39
|
+
* (`<<target>>`). Only the macro form treats a target with a file extension
|
|
40
|
+
* (`.adoc`, …) as an inter-document path. */
|
|
41
|
+
macro?: boolean;
|
|
42
|
+
/** Resolved external URL when an xref points at a `[bibliography]` entry
|
|
43
|
+
* whose citation carries a link. Set by `prepareDocument`; the default
|
|
44
|
+
* renderer ignores it (preserving stock parity), but an
|
|
45
|
+
* `inlineOverrides.anchor` can read it to link straight to the resource. */
|
|
46
|
+
externalHref?: string;
|
|
47
|
+
/** Inline content of the `[bibliography]` entry an xref resolves to, with
|
|
48
|
+
* the leading `[[[id]]]` bibref label stripped (the citation body: free
|
|
49
|
+
* text + links). Set by `prepareDocument` alongside `externalHref`; the
|
|
50
|
+
* default renderer ignores it (preserving stock parity), but an
|
|
51
|
+
* `inlineOverrides.anchor` can read it to show the reference's content in a
|
|
52
|
+
* hover tooltip. */
|
|
53
|
+
referenceInlines?: InlineNode[];
|
|
54
|
+
}
|
|
55
|
+
export interface ImageNode {
|
|
56
|
+
type: 'image';
|
|
57
|
+
subtype: 'image' | 'icon';
|
|
58
|
+
target: string;
|
|
59
|
+
alt?: string;
|
|
60
|
+
width?: string;
|
|
61
|
+
height?: string;
|
|
62
|
+
id?: string;
|
|
63
|
+
role?: string;
|
|
64
|
+
title?: string;
|
|
65
|
+
/** `float` attribute — rendered as an extra class on the wrapper span. */
|
|
66
|
+
float?: string;
|
|
67
|
+
/** `link` attribute — wraps the image/icon in `<a class="image" href>`. */
|
|
68
|
+
link?: string;
|
|
69
|
+
/** `window` (`^` or `window=`) for the link wrapper. */
|
|
70
|
+
window?: string;
|
|
71
|
+
iconType?: 'text' | 'image' | 'font';
|
|
72
|
+
}
|
|
73
|
+
export interface FootnoteNode {
|
|
74
|
+
type: 'footnote';
|
|
75
|
+
text: InlineNode[];
|
|
76
|
+
id?: string;
|
|
77
|
+
refid?: string;
|
|
78
|
+
/** Sequential index assigned during parsing (1-based). */
|
|
79
|
+
index?: number;
|
|
80
|
+
}
|
|
81
|
+
export interface IndexTermNode {
|
|
82
|
+
type: 'indexterm';
|
|
83
|
+
terms: string[];
|
|
84
|
+
visible?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface CalloutNode {
|
|
87
|
+
type: 'callout';
|
|
88
|
+
number: string;
|
|
89
|
+
}
|
|
90
|
+
export interface BreakNode {
|
|
91
|
+
type: 'break';
|
|
92
|
+
subtype: 'line';
|
|
93
|
+
}
|
|
94
|
+
export interface ButtonNode {
|
|
95
|
+
type: 'button';
|
|
96
|
+
text: InlineNode[];
|
|
97
|
+
}
|
|
98
|
+
export interface KeyboardNode {
|
|
99
|
+
type: 'kbd';
|
|
100
|
+
keys: string[];
|
|
101
|
+
}
|
|
102
|
+
export interface MenuNode {
|
|
103
|
+
type: 'menu';
|
|
104
|
+
items: string[];
|
|
105
|
+
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type BaseBlock } from '../utils/prepareDocument';
|
|
2
2
|
declare const FloatingTitle: ({ node }: {
|
|
3
3
|
node: BaseBlock;
|
|
4
|
-
}) => import("react
|
|
4
|
+
}) => import("react").ReactElement<{
|
|
5
|
+
'data-lineno'?: number | undefined;
|
|
6
|
+
id: string | undefined;
|
|
7
|
+
className: string;
|
|
8
|
+
}, string | import("react").JSXElementConstructor<any>>;
|
|
5
9
|
export default FloatingTitle;
|
|
@@ -18,10 +18,11 @@ import Preamble from './Preamble';
|
|
|
18
18
|
import Quote from './Quote';
|
|
19
19
|
import Section from './Section';
|
|
20
20
|
import Sidebar from './Sidebar';
|
|
21
|
+
import Stem from './Stem';
|
|
21
22
|
import Table from './Table';
|
|
22
23
|
import TableOfContents from './TableOfContents';
|
|
23
24
|
import ThematicBreak from './ThematicBreak';
|
|
24
25
|
import UList from './UList';
|
|
25
26
|
import Verse from './Verse';
|
|
26
27
|
import Video from './Video';
|
|
27
|
-
export { Audio, Admonition, CoList, Document, DList, Example, Outline, FloatingTitle, Listing, Literal, Image, OList, Open, PageBreak, Pass, Paragraph, Preamble, Section, Sidebar, Table, ThematicBreak, UList, Quote, Verse, TableOfContents, Video, };
|
|
28
|
+
export { Audio, Admonition, CoList, Document, DList, Example, Outline, FloatingTitle, Listing, Literal, Image, OList, Open, PageBreak, Pass, Paragraph, Preamble, Section, Sidebar, Stem, Table, ThematicBreak, UList, Quote, Verse, TableOfContents, Video, };
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type * as AdocTypes from '@asciidoctor/core';
|
|
2
|
+
import type { InlineNode } from '../inline';
|
|
2
3
|
type NodeType = 'audio' | 'admonition' | 'colist' | 'cell' | 'dlist' | 'document' | 'embedded' | 'example' | 'floating_title' | 'image' | 'inline_anchor' | 'inline_break' | 'inline_button' | 'inline_callout' | 'inline_footnote' | 'inline_image' | 'inline_kbd' | 'inline_menu' | 'inline_quoted' | 'listing' | 'list_item' | 'literal' | 'olist' | 'open' | 'outline' | 'page_break' | 'paragraph' | 'pass' | 'preamble' | 'quote' | 'section' | 'sidebar' | 'stem' | 'table' | 'table_cell' | 'thematic_break' | 'toc' | 'ulist' | 'verse' | 'video';
|
|
3
4
|
type ContentModel = 'compound' | 'simple' | 'verbatim' | 'raw' | 'empty';
|
|
4
5
|
export type BaseBlock = {
|
|
5
6
|
id?: string;
|
|
6
7
|
type: NodeType;
|
|
7
8
|
blocks: Block[];
|
|
8
|
-
content?: string | undefined;
|
|
9
|
+
content?: string | string[] | undefined;
|
|
10
|
+
/** Inline AST parsed from this block's source (only set for simple-content
|
|
11
|
+
* leaves). Templates may render this directly to compose React inline
|
|
12
|
+
* components, or fall back to `content` (HTML). */
|
|
13
|
+
inlines?: InlineNode[] | undefined;
|
|
14
|
+
/** Inline AST for the block's title, if present. */
|
|
15
|
+
titleInlines?: InlineNode[] | undefined;
|
|
9
16
|
attributes: Record<string, string | number>;
|
|
10
17
|
contentModel: ContentModel | undefined;
|
|
11
18
|
lineNumber?: number | undefined;
|
|
@@ -20,10 +27,15 @@ export type DocumentSection = {
|
|
|
20
27
|
title: string;
|
|
21
28
|
level: number;
|
|
22
29
|
num: string;
|
|
30
|
+
numbered: boolean;
|
|
31
|
+
hasCaption: boolean;
|
|
23
32
|
sections: DocumentSection[];
|
|
24
33
|
};
|
|
25
34
|
export type DocumentBlock = {
|
|
26
35
|
type: 'document';
|
|
36
|
+
/** Explicit id on the document title (`[[abstract]]` / `[#abstract]`),
|
|
37
|
+
* emitted on the title `<h1>`. */
|
|
38
|
+
id?: string;
|
|
27
39
|
title: string;
|
|
28
40
|
hasHeader: boolean;
|
|
29
41
|
noHeader: boolean;
|
|
@@ -31,8 +43,8 @@ export type DocumentBlock = {
|
|
|
31
43
|
blocks: Block[];
|
|
32
44
|
contentModel: ContentModel | undefined;
|
|
33
45
|
footnotes: {
|
|
34
|
-
|
|
35
|
-
|
|
46
|
+
index: number;
|
|
47
|
+
textInlines: InlineNode[];
|
|
36
48
|
}[];
|
|
37
49
|
sections: DocumentSection[];
|
|
38
50
|
authors: {
|
|
@@ -65,9 +77,13 @@ export interface VideoBlock extends BaseBlock {
|
|
|
65
77
|
export interface ImageBlock extends BaseBlock {
|
|
66
78
|
type: 'image';
|
|
67
79
|
imageUri: string;
|
|
80
|
+
/** Substituted alt text (asciidoctor `getAlt()` — entities like `’`
|
|
81
|
+
* already applied). Must be emitted verbatim, not via a JSX attribute,
|
|
82
|
+
* which would re-escape the `&`. */
|
|
83
|
+
alt: string;
|
|
68
84
|
}
|
|
69
85
|
export interface ListItemBlock extends BaseBlock {
|
|
70
|
-
|
|
86
|
+
textInlines?: InlineNode[] | undefined;
|
|
71
87
|
}
|
|
72
88
|
export interface ListBlock extends BaseBlock {
|
|
73
89
|
items: ListItemBlock[];
|
|
@@ -91,6 +107,7 @@ export interface SectionBlock extends BaseBlock {
|
|
|
91
107
|
title: string;
|
|
92
108
|
num: string;
|
|
93
109
|
name: string;
|
|
110
|
+
hasCaption: boolean;
|
|
94
111
|
}
|
|
95
112
|
export interface TableBlock extends BaseBlock {
|
|
96
113
|
type: 'table';
|
|
@@ -121,7 +138,17 @@ export interface Cell extends BaseBlock {
|
|
|
121
138
|
type: 'table_cell';
|
|
122
139
|
columnSpan: number | undefined;
|
|
123
140
|
rowSpan: number | undefined;
|
|
124
|
-
text: string;
|
|
141
|
+
text: string | undefined;
|
|
142
|
+
textInlines?: InlineNode[] | undefined;
|
|
143
|
+
/** Per-paragraph HTML strings for cell rendering. Empty array for asciidoc
|
|
144
|
+
* cells (rendered via `<Content>`) and for empty cells. */
|
|
145
|
+
content: string[] | undefined;
|
|
146
|
+
/** Per-paragraph inline ASTs mirroring the paragraph boundaries of
|
|
147
|
+
* `content`. Lets the Table template render cell inline content through
|
|
148
|
+
* `<RenderInline>` (so `inlineOverrides` apply) instead of injecting the
|
|
149
|
+
* serialized HTML string. Undefined for asciidoc/literal cells, which
|
|
150
|
+
* don't go through the inline-string path. */
|
|
151
|
+
contentInlines?: InlineNode[][] | undefined;
|
|
125
152
|
source: string;
|
|
126
153
|
lines: string[];
|
|
127
154
|
column: Column | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxide/react-asciidoc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-canary.5535dcb",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -23,9 +23,8 @@
|
|
|
23
23
|
"dev": "vite --port 8000",
|
|
24
24
|
"clean": "rimraf dist/",
|
|
25
25
|
"build": "npm run clean && vite build && tsc",
|
|
26
|
-
"test
|
|
27
|
-
"test:
|
|
28
|
-
"release": "auto shipit",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest",
|
|
29
28
|
"fmt": "prettier --write --ignore-path ./.gitignore .",
|
|
30
29
|
"fmt:check": "prettier --check --ignore-path ./.gitignore . ",
|
|
31
30
|
"tsc": "tsc"
|
|
@@ -33,45 +32,38 @@
|
|
|
33
32
|
"author": "Oxide Computer Company <bots@oxidecomputer.com>",
|
|
34
33
|
"license": "MPL 2.0",
|
|
35
34
|
"dependencies": {
|
|
35
|
+
"entities": "^6.0.1",
|
|
36
36
|
"html-react-parser": "^5.2.6"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@
|
|
39
|
+
"@asciidoctor/core": "^3.0.4",
|
|
40
40
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
41
41
|
"@types/node": "^24.5.2",
|
|
42
42
|
"@types/react": "^18.0.18",
|
|
43
43
|
"@types/react-dom": "^18.0.6",
|
|
44
44
|
"@vitejs/plugin-react": "^5.0.3",
|
|
45
|
-
"auto": "^11.3.0",
|
|
46
45
|
"classnames": "^2.5.1",
|
|
47
46
|
"eslint": "^9.36.0",
|
|
48
47
|
"html-entities": "^2.6.0",
|
|
48
|
+
"jsdom": "^29.1.1",
|
|
49
49
|
"npm-run-all": "^4.1.5",
|
|
50
50
|
"prettier": "^3.6.2",
|
|
51
|
+
"react": "^19.2.6",
|
|
52
|
+
"react-dom": "^19.2.6",
|
|
51
53
|
"rimraf": "^6.0.1",
|
|
52
54
|
"rollup-plugin-dts": "^6.2.3",
|
|
53
55
|
"typescript": "^5.9.2",
|
|
54
56
|
"vite": "^7.1.7",
|
|
55
57
|
"vite-dts": "^1.0.4",
|
|
56
58
|
"vite-plugin-dts": "^4.5.4",
|
|
57
|
-
"vite-tsconfig-paths": "^5.1.4"
|
|
59
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
60
|
+
"vitest": "^4.1.7"
|
|
58
61
|
},
|
|
59
62
|
"peerDependencies": {
|
|
60
63
|
"@asciidoctor/core": "^3.0.0",
|
|
61
64
|
"react": ">=18.0.0",
|
|
62
65
|
"react-dom": ">=18.0.0"
|
|
63
66
|
},
|
|
64
|
-
"auto": {
|
|
65
|
-
"plugins": [
|
|
66
|
-
[
|
|
67
|
-
"npm",
|
|
68
|
-
{
|
|
69
|
-
"setRcToken": false
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
"released"
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
67
|
"publishConfig": {
|
|
76
68
|
"registry": "https://registry.npmjs.org/",
|
|
77
69
|
"access": "public"
|