@gmb/bitmark-parser-generator 5.37.0 → 5.38.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/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/browser/cjs/index.cjs +223 -19
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +411 -380
- package/dist/browser/esm/index.d.ts +411 -380
- package/dist/browser/esm/index.js +223 -19
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/cli/main.js +226 -19
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +226 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +411 -380
- package/dist/index.d.ts +411 -380
- package/dist/index.js +226 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -705,6 +705,7 @@ type BitTagConfigKeyTypeType = EnumType<typeof BitTagConfigKeyType>;
|
|
|
705
705
|
*
|
|
706
706
|
*/
|
|
707
707
|
declare const ConfigKey: {
|
|
708
|
+
readonly group_accessibilityDecorative: "group_accessibilityDecorative";
|
|
708
709
|
readonly group_standardAllBits: "group_standardAllBits";
|
|
709
710
|
readonly group_standardItemLead: "group_standardItemLead";
|
|
710
711
|
readonly group_standardItemLeadInstructionHint: "group_standardItemLeadInstructionHint";
|
|
@@ -762,6 +763,8 @@ declare const ConfigKey: {
|
|
|
762
763
|
readonly group_resourceWebsiteLink: "group_resourceWebsiteLink";
|
|
763
764
|
readonly group_previewImages: "group_previewImages";
|
|
764
765
|
readonly group_previewVideos: "group_previewVideos";
|
|
766
|
+
readonly property_accessibilityGroupTag: "@accessibilityGroupTag";
|
|
767
|
+
readonly property_accessibilityTag: "@accessibilityTag";
|
|
765
768
|
readonly property_action: "@action";
|
|
766
769
|
readonly property_activityType: "@activityType";
|
|
767
770
|
readonly property_additionalSolutions: "@additionalSolutions";
|
|
@@ -1754,6 +1757,8 @@ interface BitJson {
|
|
|
1754
1757
|
slug: string;
|
|
1755
1758
|
tag: string | string[];
|
|
1756
1759
|
groupTag: GroupTagJson[];
|
|
1760
|
+
accessibilityTag: string | string[];
|
|
1761
|
+
accessibilityGroupTag: GroupTagJson[];
|
|
1757
1762
|
reviewTag: string | string[];
|
|
1758
1763
|
reviewerTag: string | string[];
|
|
1759
1764
|
reductionTag: string | string[];
|
|
@@ -1954,7 +1959,7 @@ interface BitJson {
|
|
|
1954
1959
|
level: number;
|
|
1955
1960
|
toc: boolean;
|
|
1956
1961
|
progress: boolean;
|
|
1957
|
-
isCollapsible: boolean;
|
|
1962
|
+
isCollapsible: boolean | null;
|
|
1958
1963
|
anchor: string;
|
|
1959
1964
|
reference: string | string[];
|
|
1960
1965
|
referenceEnd: string;
|
|
@@ -2390,6 +2395,8 @@ interface Bit {
|
|
|
2390
2395
|
slug?: Property;
|
|
2391
2396
|
tag?: Property;
|
|
2392
2397
|
groupTag?: GroupTagJson[];
|
|
2398
|
+
accessibilityTag?: Property;
|
|
2399
|
+
accessibilityGroupTag?: GroupTagJson[];
|
|
2393
2400
|
reviewTag?: Property;
|
|
2394
2401
|
reviewerTag?: Property;
|
|
2395
2402
|
reductionTag?: Property;
|
|
@@ -2689,6 +2696,10 @@ declare const NodeType: {
|
|
|
2689
2696
|
readonly unknown: "unknown";
|
|
2690
2697
|
readonly __isDefaultExample: "__isDefaultExample";
|
|
2691
2698
|
readonly __typeAlias: "__typeAlias";
|
|
2699
|
+
readonly accessibilityGroupTag: "accessibilityGroupTag";
|
|
2700
|
+
readonly accessibilityGroupTagValue: "accessibilityGroupTagValue";
|
|
2701
|
+
readonly accessibilityTag: "accessibilityTag";
|
|
2702
|
+
readonly accessibilityTagValue: "accessibilityTagValue";
|
|
2692
2703
|
readonly action: "action";
|
|
2693
2704
|
readonly actionValue: "actionValue";
|
|
2694
2705
|
readonly activityType: "activityType";
|
|
@@ -3553,345 +3564,6 @@ declare class Ast {
|
|
|
3553
3564
|
private isValue;
|
|
3554
3565
|
}
|
|
3555
3566
|
|
|
3556
|
-
declare const BodyTextFormat: {
|
|
3557
|
-
readonly plainText: "text";
|
|
3558
|
-
readonly latex: "latex";
|
|
3559
|
-
readonly json: "json";
|
|
3560
|
-
readonly xml: "xml";
|
|
3561
|
-
readonly bitmarkPlusPlus: "bitmark++";
|
|
3562
|
-
};
|
|
3563
|
-
type BodyTextFormatType = EnumType<typeof BodyTextFormat>;
|
|
3564
|
-
|
|
3565
|
-
/**
|
|
3566
|
-
* The location of text.
|
|
3567
|
-
*
|
|
3568
|
-
* The location of the text affects how breakscaping is applied.
|
|
3569
|
-
*/
|
|
3570
|
-
declare const TextLocation: {
|
|
3571
|
-
readonly tag: "tag";
|
|
3572
|
-
readonly body: "body";
|
|
3573
|
-
};
|
|
3574
|
-
type TextLocationType = EnumType<typeof TextLocation>;
|
|
3575
|
-
|
|
3576
|
-
/**
|
|
3577
|
-
* Configuration options for breakscape and unbreakscape operations.
|
|
3578
|
-
*
|
|
3579
|
-
* @public
|
|
3580
|
-
*/
|
|
3581
|
-
interface BreakscapeOptions$1 {
|
|
3582
|
-
/**
|
|
3583
|
-
* The text format to use for processing.
|
|
3584
|
-
* @defaultValue TextFormat.bitmarkPlusPlus
|
|
3585
|
-
*/
|
|
3586
|
-
format?: BodyTextFormatType;
|
|
3587
|
-
/**
|
|
3588
|
-
* The text location context for processing.
|
|
3589
|
-
* @defaultValue TextLocation.body
|
|
3590
|
-
*/
|
|
3591
|
-
location?: TextLocationType;
|
|
3592
|
-
/**
|
|
3593
|
-
* Whether to mutate the input array in-place when processing arrays.
|
|
3594
|
-
* If false, a new array will be created.
|
|
3595
|
-
* @defaultValue false
|
|
3596
|
-
*/
|
|
3597
|
-
inPlaceArray?: boolean;
|
|
3598
|
-
/**
|
|
3599
|
-
* Legacy: if true, perform v2 breakscaping from JSON
|
|
3600
|
-
*/
|
|
3601
|
-
v2?: boolean;
|
|
3602
|
-
}
|
|
3603
|
-
|
|
3604
|
-
type BreakscapedString = string & {
|
|
3605
|
-
readonly __isBreakscaped: unique symbol;
|
|
3606
|
-
};
|
|
3607
|
-
|
|
3608
|
-
declare const BitmarkVersion: {
|
|
3609
|
-
readonly v2: 2;
|
|
3610
|
-
readonly v3: 3;
|
|
3611
|
-
};
|
|
3612
|
-
type BitmarkVersionType = EnumType<typeof BitmarkVersion>;
|
|
3613
|
-
|
|
3614
|
-
interface Generator<T extends Node, R = void> {
|
|
3615
|
-
generate: (ast: T, param1?: unknown, param2?: unknown) => Promise<R>;
|
|
3616
|
-
generateSync: (ast: T, param1?: unknown, param2?: unknown) => R;
|
|
3617
|
-
}
|
|
3618
|
-
|
|
3619
|
-
/**
|
|
3620
|
-
* Generator that walks bitmark AST.
|
|
3621
|
-
*
|
|
3622
|
-
* The implementation should implement functions with the correct naming, and these will be called when
|
|
3623
|
-
* walking the AST:
|
|
3624
|
-
*
|
|
3625
|
-
* enter_<nodeKey>() - called when entering a branch node
|
|
3626
|
-
* between_<nodeKey>() - called when between child nodes
|
|
3627
|
-
* exit_<nodeKey>() - called when exiting a branch node
|
|
3628
|
-
* leaf_<nodeKey>() - called when entering a leaf node
|
|
3629
|
-
*/
|
|
3630
|
-
declare abstract class AstWalkerGenerator<AstType, R, Context = undefined> implements Generator<AstType, R>, AstWalkCallbacks<Context> {
|
|
3631
|
-
protected ast: Ast;
|
|
3632
|
-
protected debugGenerationInline: boolean;
|
|
3633
|
-
protected printed: boolean;
|
|
3634
|
-
abstract generate(ast: AstType, param1?: unknown, param2?: unknown): Promise<R>;
|
|
3635
|
-
abstract generateSync(ast: AstType, param1?: unknown, param2?: unknown): R;
|
|
3636
|
-
enter(node: NodeInfo, route: NodeInfo[], context: Context): boolean | void;
|
|
3637
|
-
between(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[], context: Context): boolean | void;
|
|
3638
|
-
exit(node: NodeInfo, route: NodeInfo[], context: Context): void;
|
|
3639
|
-
leaf(node: NodeInfo, route: NodeInfo[], context: Context): void;
|
|
3640
|
-
protected getParentNode(route: NodeInfo[], nodesBack?: number): NodeInfo | undefined;
|
|
3641
|
-
protected getSiblingNodes(route: NodeInfo[]): {
|
|
3642
|
-
left?: unknown;
|
|
3643
|
-
right?: unknown;
|
|
3644
|
-
};
|
|
3645
|
-
protected isEmptyParagraph(node: TextNode): boolean;
|
|
3646
|
-
protected abstract writeInlineDebug(key: string, state: {
|
|
3647
|
-
open?: boolean;
|
|
3648
|
-
close?: boolean;
|
|
3649
|
-
single?: boolean;
|
|
3650
|
-
}): void;
|
|
3651
|
-
}
|
|
3652
|
-
|
|
3653
|
-
/**
|
|
3654
|
-
* Text generation options
|
|
3655
|
-
*/
|
|
3656
|
-
interface TextOptions {
|
|
3657
|
-
/**
|
|
3658
|
-
* Callback for writing text
|
|
3659
|
-
*
|
|
3660
|
-
* If set, the callback will be called, rather than writing to the output string
|
|
3661
|
-
*/
|
|
3662
|
-
writeCallback?: WriteCallback;
|
|
3663
|
-
/**
|
|
3664
|
-
* Callback for rendering body bits
|
|
3665
|
-
*/
|
|
3666
|
-
bodyBitCallback?: BodyBitCallback;
|
|
3667
|
-
/**
|
|
3668
|
-
* [development only]
|
|
3669
|
-
* Generate debug information in the output.
|
|
3670
|
-
*/
|
|
3671
|
-
debugGenerationInline?: boolean;
|
|
3672
|
-
}
|
|
3673
|
-
type GenerateOptions = {
|
|
3674
|
-
plainTextDividerAllowed?: boolean;
|
|
3675
|
-
noBreakscaping?: boolean;
|
|
3676
|
-
forceInline?: boolean;
|
|
3677
|
-
noMarkup?: boolean;
|
|
3678
|
-
};
|
|
3679
|
-
declare const Stage: {
|
|
3680
|
-
enter: string;
|
|
3681
|
-
between: string;
|
|
3682
|
-
exit: string;
|
|
3683
|
-
};
|
|
3684
|
-
type StageType = EnumType<typeof Stage>;
|
|
3685
|
-
type WriteCallback = (s: string) => void;
|
|
3686
|
-
type BodyBitCallback = (bodyBit: BodyBitJson, index: number, route: NodeInfo[]) => string;
|
|
3687
|
-
interface MediaAttributeOptions {
|
|
3688
|
-
ignoreAttributes?: Set<string>;
|
|
3689
|
-
}
|
|
3690
|
-
/**
|
|
3691
|
-
* Generate text from a bitmark text AST
|
|
3692
|
-
*/
|
|
3693
|
-
declare class TextGenerator extends AstWalkerGenerator<TextAst, BreakscapedString> {
|
|
3694
|
-
protected ast: Ast;
|
|
3695
|
-
private bitmarkVersion;
|
|
3696
|
-
private options;
|
|
3697
|
-
private internalTextGenerator;
|
|
3698
|
-
private generateOptions;
|
|
3699
|
-
private textFormat;
|
|
3700
|
-
private textLocation;
|
|
3701
|
-
private writerText;
|
|
3702
|
-
private nodeIndex;
|
|
3703
|
-
private currentIndent;
|
|
3704
|
-
private prevIndent;
|
|
3705
|
-
private indentationStringCache;
|
|
3706
|
-
private inParagraph;
|
|
3707
|
-
private inHeading;
|
|
3708
|
-
private inCodeBlock;
|
|
3709
|
-
private inBulletList;
|
|
3710
|
-
private inInline;
|
|
3711
|
-
private markDepth;
|
|
3712
|
-
private textDepth;
|
|
3713
|
-
private placeholderIndex;
|
|
3714
|
-
private placeholders;
|
|
3715
|
-
private rootParagraphNodeContentIndex;
|
|
3716
|
-
private previousRootParagraphContextType;
|
|
3717
|
-
private inPreText;
|
|
3718
|
-
private thisNodeIsPreText;
|
|
3719
|
-
private preTextIndexTemp;
|
|
3720
|
-
private havePreText;
|
|
3721
|
-
private preTextIndex;
|
|
3722
|
-
/**
|
|
3723
|
-
* Generate text from a bitmark text AST
|
|
3724
|
-
*
|
|
3725
|
-
* @param bitmarkVersion - bitmark version, use null to use latest version
|
|
3726
|
-
* @param options - text generation options
|
|
3727
|
-
*/
|
|
3728
|
-
constructor(bitmarkVersion?: BitmarkVersionType, options?: TextOptions);
|
|
3729
|
-
/**
|
|
3730
|
-
* Generate text from a bitmark text AST
|
|
3731
|
-
*
|
|
3732
|
-
* @param ast bitmark text AST
|
|
3733
|
-
*/
|
|
3734
|
-
generate(ast: TextAst, textFormat: TextFormatType, textLocation: TextLocationType, options?: GenerateOptions): Promise<BreakscapedString>;
|
|
3735
|
-
/**
|
|
3736
|
-
* Generate text from a bitmark text AST synchronously
|
|
3737
|
-
*
|
|
3738
|
-
* @param ast bitmark text AST
|
|
3739
|
-
*/
|
|
3740
|
-
generateSync(ast: TextAst, textFormat: TextFormatType, textLocation: TextLocationType, options?: GenerateOptions): BreakscapedString;
|
|
3741
|
-
getPlaceholders(): BodyBitsJson;
|
|
3742
|
-
private resetState;
|
|
3743
|
-
private walkAndWrite;
|
|
3744
|
-
protected enter_textAstValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3745
|
-
protected between_textAstValue(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void | false;
|
|
3746
|
-
protected exit_textAstValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3747
|
-
protected enter_contentValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3748
|
-
protected between_contentValue(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void;
|
|
3749
|
-
protected exit_contentValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3750
|
-
protected enter_contentValueValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3751
|
-
protected between_contentValueValue(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void;
|
|
3752
|
-
protected exit_contentValueValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3753
|
-
protected enter_marks(_node: NodeInfo, _route: NodeInfo[]): void | false;
|
|
3754
|
-
protected exit_marks(_node: NodeInfo, _route: NodeInfo[]): void | false;
|
|
3755
|
-
protected handleEnterNode(node: TextNode, route: NodeInfo[]): void | false;
|
|
3756
|
-
protected handleBetweenNode(node: TextNode, _left: NodeInfo, _right: NodeInfo, _route: NodeInfo[]): void;
|
|
3757
|
-
protected handleExitNode(node: TextNode, _route: NodeInfo[]): void | false;
|
|
3758
|
-
protected handleIndent(node: TextNode): void;
|
|
3759
|
-
protected handleDedent(node: TextNode): void;
|
|
3760
|
-
protected handleEnterContentValueNode(_node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3761
|
-
protected handleBetweenContentValueNode(_node: NodeInfo, left: NodeInfo, _right: NodeInfo, route: NodeInfo[]): void;
|
|
3762
|
-
protected handleExitContentValueNode(_node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3763
|
-
private updatePreTextState;
|
|
3764
|
-
protected handleEnterNodePreTextCheck(node: TextNode, route: NodeInfo[]): void;
|
|
3765
|
-
/**
|
|
3766
|
-
* Check if a text node has a link mark, and if so, return the href
|
|
3767
|
-
*
|
|
3768
|
-
* @param node the node to check for a link mark
|
|
3769
|
-
* @returns the href, or false if no link mark
|
|
3770
|
-
*/
|
|
3771
|
-
protected getLinkHref(node: TextNode): string | false;
|
|
3772
|
-
/**
|
|
3773
|
-
* Get the current indentation string
|
|
3774
|
-
* @returns
|
|
3775
|
-
*/
|
|
3776
|
-
protected getIndentationString(): string;
|
|
3777
|
-
protected writeBodyBit(node: TextNode, route: NodeInfo[]): void;
|
|
3778
|
-
protected writeText(node: TextNode): void;
|
|
3779
|
-
/**
|
|
3780
|
-
* Check if a node is a link node and if so and the node has only the link mark, and the link without the
|
|
3781
|
-
* protocol is the same as the text, return true. Otherwise return false.
|
|
3782
|
-
*
|
|
3783
|
-
* @param node
|
|
3784
|
-
* @returns true if a simple link, otherwise false
|
|
3785
|
-
*/
|
|
3786
|
-
protected isSimpleLink(node: TextNode): boolean;
|
|
3787
|
-
/**
|
|
3788
|
-
* Get the link text if the node is a link, otherwise return false
|
|
3789
|
-
*
|
|
3790
|
-
* @param node
|
|
3791
|
-
* @returns
|
|
3792
|
-
*/
|
|
3793
|
-
protected getLinkText(node: TextNode): string | false;
|
|
3794
|
-
/**
|
|
3795
|
-
* If the existing written text ends with a half-mark, and the new text starts with the same half-mark, insert a
|
|
3796
|
-
* breakscape ^ between them to break the sequence.
|
|
3797
|
-
*
|
|
3798
|
-
* Only applies to bitmark version > 2
|
|
3799
|
-
*
|
|
3800
|
-
* @param s
|
|
3801
|
-
*/
|
|
3802
|
-
protected getInterTextBreakscape(s: string): string;
|
|
3803
|
-
protected validateGenerateOptions(ast: TextNode[]): void;
|
|
3804
|
-
/**
|
|
3805
|
-
* Write the marks for the node.
|
|
3806
|
-
*
|
|
3807
|
-
* All marks need to be considered at once, because if there are multiple marks, they need to be written in
|
|
3808
|
-
* a combined manner.
|
|
3809
|
-
*
|
|
3810
|
-
* e.g. if there are bold and italic marks, they need to be written as
|
|
3811
|
-
*
|
|
3812
|
-
* ==the text==|bold|italic|
|
|
3813
|
-
* rather than
|
|
3814
|
-
* **__the text__**
|
|
3815
|
-
* or
|
|
3816
|
-
* **__the text**__
|
|
3817
|
-
*
|
|
3818
|
-
* @param node the text node
|
|
3819
|
-
* @param start true if starting (before) the text, false if ending (after) the text
|
|
3820
|
-
*/
|
|
3821
|
-
protected writeMarks(node: TextNode, stage: StageType): void | false;
|
|
3822
|
-
protected writeParagraph(node: TextNode, route: NodeInfo[]): void;
|
|
3823
|
-
protected writeHardBreak(_node: TextNode): void;
|
|
3824
|
-
protected writeHeading(node: HeadingTextNode): void;
|
|
3825
|
-
protected writeSection(node: SectionTextNode): void;
|
|
3826
|
-
protected writeBullet(node: TextNode, route: NodeInfo[]): void;
|
|
3827
|
-
protected writeImage(node: ImageTextNode | ImageInlineTextNode): void;
|
|
3828
|
-
protected writeCodeBlock(node: CodeBlockTextNode): void;
|
|
3829
|
-
protected writeLatex(node: LatexTextNode): void;
|
|
3830
|
-
protected writeMarkTextWrapper(s: string): void;
|
|
3831
|
-
protected writeInlineMark(mark: TextMark): void;
|
|
3832
|
-
/**
|
|
3833
|
-
* Resolve the marks of a text node into the marks that will actually be written.
|
|
3834
|
-
*
|
|
3835
|
-
* - Merges a legacy standalone 'duration' mark into its sibling 'timer' mark.
|
|
3836
|
-
* - Drops marks the current grammar cannot express (standalone 'duration', 'timer'
|
|
3837
|
-
* without a duration).
|
|
3838
|
-
* - Moves a 'textStyle'/'color' mark before a preceding bare 'highlight'/'userHighlight'
|
|
3839
|
-
* mark when its color is a valid highlight color; written in the original order the
|
|
3840
|
-
* output would re-parse as a highlight-with-color compound mark and change meaning.
|
|
3841
|
-
*/
|
|
3842
|
-
protected getWritableMarks(nodeMarks: TextMark[]): TextMark[];
|
|
3843
|
-
/**
|
|
3844
|
-
* True if the mark is written using its standard form (e.g. **bold**, !!highlight!!)
|
|
3845
|
-
* when it is the only mark. A highlight mark with a color attribute is excluded - it
|
|
3846
|
-
* can only be expressed using the inline chain form (==text==|highlight|color:x|).
|
|
3847
|
-
*/
|
|
3848
|
-
protected isStandardMark(mark: TextMark): boolean;
|
|
3849
|
-
/**
|
|
3850
|
-
* True if the mark is written using the inline chain form (==text==|mark|).
|
|
3851
|
-
*/
|
|
3852
|
-
protected isInlineMark(mark: TextMark): boolean;
|
|
3853
|
-
protected writeCommentMark(mark: CommentMark): void;
|
|
3854
|
-
protected writeLinkMark(mark: LinkMark): void;
|
|
3855
|
-
protected writeRefMark(mark: RefMark): void;
|
|
3856
|
-
protected writeXRefMark(mark: XRefMark): void;
|
|
3857
|
-
protected writeExtRefMark(mark: ExtRefMark): void;
|
|
3858
|
-
protected writeFootnoteMark(mark: FootnoteMark): void;
|
|
3859
|
-
protected writeFootnoteStarMark(mark: FootnoteMark): void;
|
|
3860
|
-
protected writeSymbolMark(mark: SymbolMark): void;
|
|
3861
|
-
protected writeInlineMarkStartEnd(): void;
|
|
3862
|
-
protected writePlainTextDivider(): void;
|
|
3863
|
-
protected writeString(s?: string): void;
|
|
3864
|
-
protected writeNL(): void;
|
|
3865
|
-
protected writeInlineDebug(key: string, state: {
|
|
3866
|
-
open?: boolean;
|
|
3867
|
-
close?: boolean;
|
|
3868
|
-
single?: boolean;
|
|
3869
|
-
}): void;
|
|
3870
|
-
protected getMediaAttrs(mediaType: string, attrs: MediaAttributes, options?: MediaAttributeOptions): string | undefined;
|
|
3871
|
-
protected breakscape(s: string, options: BreakscapeOptions$1): string;
|
|
3872
|
-
protected getBitType(route: NodeInfo[]): BitTypeType | undefined;
|
|
3873
|
-
/**
|
|
3874
|
-
* Writes a string value to the output.
|
|
3875
|
-
* @param value - The string value to be written.
|
|
3876
|
-
*/
|
|
3877
|
-
write(value: string): this;
|
|
3878
|
-
/**
|
|
3879
|
-
* Writes a new line to the output. The line is indented automatically. The line is ended with the endOfLineString.
|
|
3880
|
-
* @param value - The line to write. When omitted, only the endOfLineString is written.
|
|
3881
|
-
*/
|
|
3882
|
-
writeLine(value?: string): this;
|
|
3883
|
-
/**
|
|
3884
|
-
* Writes a collection of lines to the output. Each line is indented automatically and ended with the endOfLineString.
|
|
3885
|
-
* @param values - The lines to write.
|
|
3886
|
-
* @param delimiter - An optional delimiter to be written at the end of each line, except for the last one.
|
|
3887
|
-
*/
|
|
3888
|
-
writeLines(values: string[], delimiter?: string): this;
|
|
3889
|
-
/**
|
|
3890
|
-
* Writes a single whitespace character to the output.
|
|
3891
|
-
*/
|
|
3892
|
-
writeWhiteSpace(): this;
|
|
3893
|
-
}
|
|
3894
|
-
|
|
3895
3567
|
declare const ExampleType: {
|
|
3896
3568
|
readonly none: "none";
|
|
3897
3569
|
readonly string: "string";
|
|
@@ -4171,41 +3843,380 @@ interface ToStringOptions {
|
|
|
4171
3843
|
includeChains?: boolean;
|
|
4172
3844
|
includeConfigs?: boolean;
|
|
4173
3845
|
}
|
|
4174
|
-
declare class BitConfig {
|
|
4175
|
-
readonly since: string;
|
|
4176
|
-
readonly bitType: BitTypeType;
|
|
4177
|
-
readonly inheritedBitTypes: BitTypeType[];
|
|
4178
|
-
readonly inheritedBitTypesSet: Set<BitTypeType>;
|
|
4179
|
-
readonly textFormatDefault: TextFormatType;
|
|
4180
|
-
readonly tags: TagsConfig;
|
|
4181
|
-
readonly cardSet?: CardSetConfig;
|
|
4182
|
-
readonly quizBit?: boolean;
|
|
4183
|
-
readonly deprecated?: string;
|
|
4184
|
-
readonly bodyAllowed?: boolean;
|
|
4185
|
-
readonly bodyRequired?: boolean;
|
|
4186
|
-
readonly footerAllowed?: boolean;
|
|
4187
|
-
readonly footerRequired?: boolean;
|
|
4188
|
-
readonly resourceAttachmentAllowed?: boolean;
|
|
4189
|
-
readonly rootExampleType?: ExampleTypeType;
|
|
4190
|
-
readonly comboResourceConfigKey?: ConfigKeyType;
|
|
4191
|
-
constructor(config: {
|
|
4192
|
-
since: string;
|
|
4193
|
-
bitType: BitTypeType;
|
|
4194
|
-
inheritedBitTypes: BitTypeType[];
|
|
4195
|
-
textFormatDefault: TextFormatType;
|
|
4196
|
-
tags: TagsConfig;
|
|
4197
|
-
cardSet: CardSetConfig | undefined;
|
|
4198
|
-
quizBit: boolean | undefined;
|
|
4199
|
-
deprecated: string | undefined;
|
|
4200
|
-
bodyAllowed: boolean | undefined;
|
|
4201
|
-
bodyRequired: boolean | undefined;
|
|
4202
|
-
footerAllowed: boolean | undefined;
|
|
4203
|
-
footerRequired: boolean | undefined;
|
|
4204
|
-
resourceAttachmentAllowed: boolean | undefined;
|
|
4205
|
-
rootExampleType: ExampleTypeType | undefined;
|
|
4206
|
-
comboResourceConfigKey: ConfigKeyType | undefined;
|
|
4207
|
-
});
|
|
4208
|
-
toString(options?: ToStringOptions): string;
|
|
3846
|
+
declare class BitConfig {
|
|
3847
|
+
readonly since: string;
|
|
3848
|
+
readonly bitType: BitTypeType;
|
|
3849
|
+
readonly inheritedBitTypes: BitTypeType[];
|
|
3850
|
+
readonly inheritedBitTypesSet: Set<BitTypeType>;
|
|
3851
|
+
readonly textFormatDefault: TextFormatType;
|
|
3852
|
+
readonly tags: TagsConfig;
|
|
3853
|
+
readonly cardSet?: CardSetConfig;
|
|
3854
|
+
readonly quizBit?: boolean;
|
|
3855
|
+
readonly deprecated?: string;
|
|
3856
|
+
readonly bodyAllowed?: boolean;
|
|
3857
|
+
readonly bodyRequired?: boolean;
|
|
3858
|
+
readonly footerAllowed?: boolean;
|
|
3859
|
+
readonly footerRequired?: boolean;
|
|
3860
|
+
readonly resourceAttachmentAllowed?: boolean;
|
|
3861
|
+
readonly rootExampleType?: ExampleTypeType;
|
|
3862
|
+
readonly comboResourceConfigKey?: ConfigKeyType;
|
|
3863
|
+
constructor(config: {
|
|
3864
|
+
since: string;
|
|
3865
|
+
bitType: BitTypeType;
|
|
3866
|
+
inheritedBitTypes: BitTypeType[];
|
|
3867
|
+
textFormatDefault: TextFormatType;
|
|
3868
|
+
tags: TagsConfig;
|
|
3869
|
+
cardSet: CardSetConfig | undefined;
|
|
3870
|
+
quizBit: boolean | undefined;
|
|
3871
|
+
deprecated: string | undefined;
|
|
3872
|
+
bodyAllowed: boolean | undefined;
|
|
3873
|
+
bodyRequired: boolean | undefined;
|
|
3874
|
+
footerAllowed: boolean | undefined;
|
|
3875
|
+
footerRequired: boolean | undefined;
|
|
3876
|
+
resourceAttachmentAllowed: boolean | undefined;
|
|
3877
|
+
rootExampleType: ExampleTypeType | undefined;
|
|
3878
|
+
comboResourceConfigKey: ConfigKeyType | undefined;
|
|
3879
|
+
});
|
|
3880
|
+
toString(options?: ToStringOptions): string;
|
|
3881
|
+
}
|
|
3882
|
+
|
|
3883
|
+
declare const BodyTextFormat: {
|
|
3884
|
+
readonly plainText: "text";
|
|
3885
|
+
readonly latex: "latex";
|
|
3886
|
+
readonly json: "json";
|
|
3887
|
+
readonly xml: "xml";
|
|
3888
|
+
readonly bitmarkPlusPlus: "bitmark++";
|
|
3889
|
+
};
|
|
3890
|
+
type BodyTextFormatType = EnumType<typeof BodyTextFormat>;
|
|
3891
|
+
|
|
3892
|
+
/**
|
|
3893
|
+
* The location of text.
|
|
3894
|
+
*
|
|
3895
|
+
* The location of the text affects how breakscaping is applied.
|
|
3896
|
+
*/
|
|
3897
|
+
declare const TextLocation: {
|
|
3898
|
+
readonly tag: "tag";
|
|
3899
|
+
readonly body: "body";
|
|
3900
|
+
};
|
|
3901
|
+
type TextLocationType = EnumType<typeof TextLocation>;
|
|
3902
|
+
|
|
3903
|
+
/**
|
|
3904
|
+
* Configuration options for breakscape and unbreakscape operations.
|
|
3905
|
+
*
|
|
3906
|
+
* @public
|
|
3907
|
+
*/
|
|
3908
|
+
interface BreakscapeOptions$1 {
|
|
3909
|
+
/**
|
|
3910
|
+
* The text format to use for processing.
|
|
3911
|
+
* @defaultValue TextFormat.bitmarkPlusPlus
|
|
3912
|
+
*/
|
|
3913
|
+
format?: BodyTextFormatType;
|
|
3914
|
+
/**
|
|
3915
|
+
* The text location context for processing.
|
|
3916
|
+
* @defaultValue TextLocation.body
|
|
3917
|
+
*/
|
|
3918
|
+
location?: TextLocationType;
|
|
3919
|
+
/**
|
|
3920
|
+
* Whether to mutate the input array in-place when processing arrays.
|
|
3921
|
+
* If false, a new array will be created.
|
|
3922
|
+
* @defaultValue false
|
|
3923
|
+
*/
|
|
3924
|
+
inPlaceArray?: boolean;
|
|
3925
|
+
/**
|
|
3926
|
+
* Legacy: if true, perform v2 breakscaping from JSON
|
|
3927
|
+
*/
|
|
3928
|
+
v2?: boolean;
|
|
3929
|
+
}
|
|
3930
|
+
|
|
3931
|
+
type BreakscapedString = string & {
|
|
3932
|
+
readonly __isBreakscaped: unique symbol;
|
|
3933
|
+
};
|
|
3934
|
+
|
|
3935
|
+
declare const BitmarkVersion: {
|
|
3936
|
+
readonly v2: 2;
|
|
3937
|
+
readonly v3: 3;
|
|
3938
|
+
};
|
|
3939
|
+
type BitmarkVersionType = EnumType<typeof BitmarkVersion>;
|
|
3940
|
+
|
|
3941
|
+
interface Generator<T extends Node, R = void> {
|
|
3942
|
+
generate: (ast: T, param1?: unknown, param2?: unknown) => Promise<R>;
|
|
3943
|
+
generateSync: (ast: T, param1?: unknown, param2?: unknown) => R;
|
|
3944
|
+
}
|
|
3945
|
+
|
|
3946
|
+
/**
|
|
3947
|
+
* Generator that walks bitmark AST.
|
|
3948
|
+
*
|
|
3949
|
+
* The implementation should implement functions with the correct naming, and these will be called when
|
|
3950
|
+
* walking the AST:
|
|
3951
|
+
*
|
|
3952
|
+
* enter_<nodeKey>() - called when entering a branch node
|
|
3953
|
+
* between_<nodeKey>() - called when between child nodes
|
|
3954
|
+
* exit_<nodeKey>() - called when exiting a branch node
|
|
3955
|
+
* leaf_<nodeKey>() - called when entering a leaf node
|
|
3956
|
+
*/
|
|
3957
|
+
declare abstract class AstWalkerGenerator<AstType, R, Context = undefined> implements Generator<AstType, R>, AstWalkCallbacks<Context> {
|
|
3958
|
+
protected ast: Ast;
|
|
3959
|
+
protected debugGenerationInline: boolean;
|
|
3960
|
+
protected printed: boolean;
|
|
3961
|
+
abstract generate(ast: AstType, param1?: unknown, param2?: unknown): Promise<R>;
|
|
3962
|
+
abstract generateSync(ast: AstType, param1?: unknown, param2?: unknown): R;
|
|
3963
|
+
enter(node: NodeInfo, route: NodeInfo[], context: Context): boolean | void;
|
|
3964
|
+
between(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[], context: Context): boolean | void;
|
|
3965
|
+
exit(node: NodeInfo, route: NodeInfo[], context: Context): void;
|
|
3966
|
+
leaf(node: NodeInfo, route: NodeInfo[], context: Context): void;
|
|
3967
|
+
protected getParentNode(route: NodeInfo[], nodesBack?: number): NodeInfo | undefined;
|
|
3968
|
+
protected getSiblingNodes(route: NodeInfo[]): {
|
|
3969
|
+
left?: unknown;
|
|
3970
|
+
right?: unknown;
|
|
3971
|
+
};
|
|
3972
|
+
protected isEmptyParagraph(node: TextNode): boolean;
|
|
3973
|
+
protected abstract writeInlineDebug(key: string, state: {
|
|
3974
|
+
open?: boolean;
|
|
3975
|
+
close?: boolean;
|
|
3976
|
+
single?: boolean;
|
|
3977
|
+
}): void;
|
|
3978
|
+
}
|
|
3979
|
+
|
|
3980
|
+
/**
|
|
3981
|
+
* Text generation options
|
|
3982
|
+
*/
|
|
3983
|
+
interface TextOptions {
|
|
3984
|
+
/**
|
|
3985
|
+
* Callback for writing text
|
|
3986
|
+
*
|
|
3987
|
+
* If set, the callback will be called, rather than writing to the output string
|
|
3988
|
+
*/
|
|
3989
|
+
writeCallback?: WriteCallback;
|
|
3990
|
+
/**
|
|
3991
|
+
* Callback for rendering body bits
|
|
3992
|
+
*/
|
|
3993
|
+
bodyBitCallback?: BodyBitCallback;
|
|
3994
|
+
/**
|
|
3995
|
+
* [development only]
|
|
3996
|
+
* Generate debug information in the output.
|
|
3997
|
+
*/
|
|
3998
|
+
debugGenerationInline?: boolean;
|
|
3999
|
+
}
|
|
4000
|
+
type GenerateOptions = {
|
|
4001
|
+
plainTextDividerAllowed?: boolean;
|
|
4002
|
+
noBreakscaping?: boolean;
|
|
4003
|
+
forceInline?: boolean;
|
|
4004
|
+
noMarkup?: boolean;
|
|
4005
|
+
};
|
|
4006
|
+
declare const Stage: {
|
|
4007
|
+
enter: string;
|
|
4008
|
+
between: string;
|
|
4009
|
+
exit: string;
|
|
4010
|
+
};
|
|
4011
|
+
type StageType = EnumType<typeof Stage>;
|
|
4012
|
+
type WriteCallback = (s: string) => void;
|
|
4013
|
+
type BodyBitCallback = (bodyBit: BodyBitJson, index: number, route: NodeInfo[]) => string;
|
|
4014
|
+
interface MediaAttributeOptions {
|
|
4015
|
+
ignoreAttributes?: Set<string>;
|
|
4016
|
+
}
|
|
4017
|
+
/**
|
|
4018
|
+
* Generate text from a bitmark text AST
|
|
4019
|
+
*/
|
|
4020
|
+
declare class TextGenerator extends AstWalkerGenerator<TextAst, BreakscapedString> {
|
|
4021
|
+
protected ast: Ast;
|
|
4022
|
+
private bitmarkVersion;
|
|
4023
|
+
private options;
|
|
4024
|
+
private internalTextGenerator;
|
|
4025
|
+
private generateOptions;
|
|
4026
|
+
private textFormat;
|
|
4027
|
+
private textLocation;
|
|
4028
|
+
private writerText;
|
|
4029
|
+
private nodeIndex;
|
|
4030
|
+
private currentIndent;
|
|
4031
|
+
private prevIndent;
|
|
4032
|
+
private indentationStringCache;
|
|
4033
|
+
private inParagraph;
|
|
4034
|
+
private inHeading;
|
|
4035
|
+
private inCodeBlock;
|
|
4036
|
+
private inBulletList;
|
|
4037
|
+
private inInline;
|
|
4038
|
+
private markDepth;
|
|
4039
|
+
private textDepth;
|
|
4040
|
+
private placeholderIndex;
|
|
4041
|
+
private placeholders;
|
|
4042
|
+
private rootParagraphNodeContentIndex;
|
|
4043
|
+
private previousRootParagraphContextType;
|
|
4044
|
+
private inPreText;
|
|
4045
|
+
private thisNodeIsPreText;
|
|
4046
|
+
private preTextIndexTemp;
|
|
4047
|
+
private havePreText;
|
|
4048
|
+
private preTextIndex;
|
|
4049
|
+
/**
|
|
4050
|
+
* Generate text from a bitmark text AST
|
|
4051
|
+
*
|
|
4052
|
+
* @param bitmarkVersion - bitmark version, use null to use latest version
|
|
4053
|
+
* @param options - text generation options
|
|
4054
|
+
*/
|
|
4055
|
+
constructor(bitmarkVersion?: BitmarkVersionType, options?: TextOptions);
|
|
4056
|
+
/**
|
|
4057
|
+
* Generate text from a bitmark text AST
|
|
4058
|
+
*
|
|
4059
|
+
* @param ast bitmark text AST
|
|
4060
|
+
*/
|
|
4061
|
+
generate(ast: TextAst, textFormat: TextFormatType, textLocation: TextLocationType, options?: GenerateOptions): Promise<BreakscapedString>;
|
|
4062
|
+
/**
|
|
4063
|
+
* Generate text from a bitmark text AST synchronously
|
|
4064
|
+
*
|
|
4065
|
+
* @param ast bitmark text AST
|
|
4066
|
+
*/
|
|
4067
|
+
generateSync(ast: TextAst, textFormat: TextFormatType, textLocation: TextLocationType, options?: GenerateOptions): BreakscapedString;
|
|
4068
|
+
getPlaceholders(): BodyBitsJson;
|
|
4069
|
+
private resetState;
|
|
4070
|
+
private walkAndWrite;
|
|
4071
|
+
protected enter_textAstValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
4072
|
+
protected between_textAstValue(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void | false;
|
|
4073
|
+
protected exit_textAstValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
4074
|
+
protected enter_contentValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
4075
|
+
protected between_contentValue(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void;
|
|
4076
|
+
protected exit_contentValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
4077
|
+
protected enter_contentValueValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
4078
|
+
protected between_contentValueValue(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void;
|
|
4079
|
+
protected exit_contentValueValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
4080
|
+
protected enter_marks(_node: NodeInfo, _route: NodeInfo[]): void | false;
|
|
4081
|
+
protected exit_marks(_node: NodeInfo, _route: NodeInfo[]): void | false;
|
|
4082
|
+
protected handleEnterNode(node: TextNode, route: NodeInfo[]): void | false;
|
|
4083
|
+
protected handleBetweenNode(node: TextNode, _left: NodeInfo, _right: NodeInfo, _route: NodeInfo[]): void;
|
|
4084
|
+
protected handleExitNode(node: TextNode, _route: NodeInfo[]): void | false;
|
|
4085
|
+
protected handleIndent(node: TextNode): void;
|
|
4086
|
+
protected handleDedent(node: TextNode): void;
|
|
4087
|
+
protected handleEnterContentValueNode(_node: NodeInfo, route: NodeInfo[]): void | false;
|
|
4088
|
+
protected handleBetweenContentValueNode(_node: NodeInfo, left: NodeInfo, _right: NodeInfo, route: NodeInfo[]): void;
|
|
4089
|
+
protected handleExitContentValueNode(_node: NodeInfo, route: NodeInfo[]): void | false;
|
|
4090
|
+
private updatePreTextState;
|
|
4091
|
+
protected handleEnterNodePreTextCheck(node: TextNode, route: NodeInfo[]): void;
|
|
4092
|
+
/**
|
|
4093
|
+
* Check if a text node has a link mark, and if so, return the href
|
|
4094
|
+
*
|
|
4095
|
+
* @param node the node to check for a link mark
|
|
4096
|
+
* @returns the href, or false if no link mark
|
|
4097
|
+
*/
|
|
4098
|
+
protected getLinkHref(node: TextNode): string | false;
|
|
4099
|
+
/**
|
|
4100
|
+
* Get the current indentation string
|
|
4101
|
+
* @returns
|
|
4102
|
+
*/
|
|
4103
|
+
protected getIndentationString(): string;
|
|
4104
|
+
protected writeBodyBit(node: TextNode, route: NodeInfo[]): void;
|
|
4105
|
+
protected writeText(node: TextNode): void;
|
|
4106
|
+
/**
|
|
4107
|
+
* Check if a node is a link node and if so and the node has only the link mark, and the link without the
|
|
4108
|
+
* protocol is the same as the text, return true. Otherwise return false.
|
|
4109
|
+
*
|
|
4110
|
+
* @param node
|
|
4111
|
+
* @returns true if a simple link, otherwise false
|
|
4112
|
+
*/
|
|
4113
|
+
protected isSimpleLink(node: TextNode): boolean;
|
|
4114
|
+
/**
|
|
4115
|
+
* Get the link text if the node is a link, otherwise return false
|
|
4116
|
+
*
|
|
4117
|
+
* @param node
|
|
4118
|
+
* @returns
|
|
4119
|
+
*/
|
|
4120
|
+
protected getLinkText(node: TextNode): string | false;
|
|
4121
|
+
/**
|
|
4122
|
+
* If the existing written text ends with a half-mark, and the new text starts with the same half-mark, insert a
|
|
4123
|
+
* breakscape ^ between them to break the sequence.
|
|
4124
|
+
*
|
|
4125
|
+
* Only applies to bitmark version > 2
|
|
4126
|
+
*
|
|
4127
|
+
* @param s
|
|
4128
|
+
*/
|
|
4129
|
+
protected getInterTextBreakscape(s: string): string;
|
|
4130
|
+
protected validateGenerateOptions(ast: TextNode[]): void;
|
|
4131
|
+
/**
|
|
4132
|
+
* Write the marks for the node.
|
|
4133
|
+
*
|
|
4134
|
+
* All marks need to be considered at once, because if there are multiple marks, they need to be written in
|
|
4135
|
+
* a combined manner.
|
|
4136
|
+
*
|
|
4137
|
+
* e.g. if there are bold and italic marks, they need to be written as
|
|
4138
|
+
*
|
|
4139
|
+
* ==the text==|bold|italic|
|
|
4140
|
+
* rather than
|
|
4141
|
+
* **__the text__**
|
|
4142
|
+
* or
|
|
4143
|
+
* **__the text**__
|
|
4144
|
+
*
|
|
4145
|
+
* @param node the text node
|
|
4146
|
+
* @param start true if starting (before) the text, false if ending (after) the text
|
|
4147
|
+
*/
|
|
4148
|
+
protected writeMarks(node: TextNode, stage: StageType): void | false;
|
|
4149
|
+
protected writeParagraph(node: TextNode, route: NodeInfo[]): void;
|
|
4150
|
+
protected writeHardBreak(_node: TextNode): void;
|
|
4151
|
+
protected writeHeading(node: HeadingTextNode): void;
|
|
4152
|
+
protected writeSection(node: SectionTextNode): void;
|
|
4153
|
+
protected writeBullet(node: TextNode, route: NodeInfo[]): void;
|
|
4154
|
+
protected writeImage(node: ImageTextNode | ImageInlineTextNode): void;
|
|
4155
|
+
protected writeCodeBlock(node: CodeBlockTextNode): void;
|
|
4156
|
+
protected writeLatex(node: LatexTextNode): void;
|
|
4157
|
+
protected writeMarkTextWrapper(s: string): void;
|
|
4158
|
+
protected writeInlineMark(mark: TextMark): void;
|
|
4159
|
+
/**
|
|
4160
|
+
* Resolve the marks of a text node into the marks that will actually be written.
|
|
4161
|
+
*
|
|
4162
|
+
* - Merges a legacy standalone 'duration' mark into its sibling 'timer' mark.
|
|
4163
|
+
* - Drops marks the current grammar cannot express (standalone 'duration', 'timer'
|
|
4164
|
+
* without a duration).
|
|
4165
|
+
* - Moves a 'textStyle'/'color' mark before a preceding bare 'highlight'/'userHighlight'
|
|
4166
|
+
* mark when its color is a valid highlight color; written in the original order the
|
|
4167
|
+
* output would re-parse as a highlight-with-color compound mark and change meaning.
|
|
4168
|
+
*/
|
|
4169
|
+
protected getWritableMarks(nodeMarks: TextMark[]): TextMark[];
|
|
4170
|
+
/**
|
|
4171
|
+
* True if the mark is written using its standard form (e.g. **bold**, !!highlight!!)
|
|
4172
|
+
* when it is the only mark. A highlight mark with a color attribute is excluded - it
|
|
4173
|
+
* can only be expressed using the inline chain form (==text==|highlight|color:x|).
|
|
4174
|
+
*/
|
|
4175
|
+
protected isStandardMark(mark: TextMark): boolean;
|
|
4176
|
+
/**
|
|
4177
|
+
* True if the mark is written using the inline chain form (==text==|mark|).
|
|
4178
|
+
*/
|
|
4179
|
+
protected isInlineMark(mark: TextMark): boolean;
|
|
4180
|
+
protected writeCommentMark(mark: CommentMark): void;
|
|
4181
|
+
protected writeLinkMark(mark: LinkMark): void;
|
|
4182
|
+
protected writeRefMark(mark: RefMark): void;
|
|
4183
|
+
protected writeXRefMark(mark: XRefMark): void;
|
|
4184
|
+
protected writeExtRefMark(mark: ExtRefMark): void;
|
|
4185
|
+
protected writeFootnoteMark(mark: FootnoteMark): void;
|
|
4186
|
+
protected writeFootnoteStarMark(mark: FootnoteMark): void;
|
|
4187
|
+
protected writeSymbolMark(mark: SymbolMark): void;
|
|
4188
|
+
protected writeInlineMarkStartEnd(): void;
|
|
4189
|
+
protected writePlainTextDivider(): void;
|
|
4190
|
+
protected writeString(s?: string): void;
|
|
4191
|
+
protected writeNL(): void;
|
|
4192
|
+
protected writeInlineDebug(key: string, state: {
|
|
4193
|
+
open?: boolean;
|
|
4194
|
+
close?: boolean;
|
|
4195
|
+
single?: boolean;
|
|
4196
|
+
}): void;
|
|
4197
|
+
protected getMediaAttrs(mediaType: string, attrs: MediaAttributes, options?: MediaAttributeOptions): string | undefined;
|
|
4198
|
+
protected breakscape(s: string, options: BreakscapeOptions$1): string;
|
|
4199
|
+
protected getBitType(route: NodeInfo[]): BitTypeType | undefined;
|
|
4200
|
+
/**
|
|
4201
|
+
* Writes a string value to the output.
|
|
4202
|
+
* @param value - The string value to be written.
|
|
4203
|
+
*/
|
|
4204
|
+
write(value: string): this;
|
|
4205
|
+
/**
|
|
4206
|
+
* Writes a new line to the output. The line is indented automatically. The line is ended with the endOfLineString.
|
|
4207
|
+
* @param value - The line to write. When omitted, only the endOfLineString is written.
|
|
4208
|
+
*/
|
|
4209
|
+
writeLine(value?: string): this;
|
|
4210
|
+
/**
|
|
4211
|
+
* Writes a collection of lines to the output. Each line is indented automatically and ended with the endOfLineString.
|
|
4212
|
+
* @param values - The lines to write.
|
|
4213
|
+
* @param delimiter - An optional delimiter to be written at the end of each line, except for the last one.
|
|
4214
|
+
*/
|
|
4215
|
+
writeLines(values: string[], delimiter?: string): this;
|
|
4216
|
+
/**
|
|
4217
|
+
* Writes a single whitespace character to the output.
|
|
4218
|
+
*/
|
|
4219
|
+
writeWhiteSpace(): this;
|
|
4209
4220
|
}
|
|
4210
4221
|
|
|
4211
4222
|
interface BitmarkTextParserOptions {
|
|
@@ -4408,6 +4419,8 @@ declare class Builder extends BaseBuilder {
|
|
|
4408
4419
|
slug?: string;
|
|
4409
4420
|
tag?: string | string[];
|
|
4410
4421
|
groupTag?: Partial<GroupTagJson> | Partial<GroupTagJson>[];
|
|
4422
|
+
accessibilityTag?: string | string[];
|
|
4423
|
+
accessibilityGroupTag?: Partial<GroupTagJson> | Partial<GroupTagJson>[];
|
|
4411
4424
|
reviewTag?: string | string[];
|
|
4412
4425
|
reviewerTag?: string | string[];
|
|
4413
4426
|
reductionTag?: string | string[];
|
|
@@ -4612,7 +4625,7 @@ declare class Builder extends BaseBuilder {
|
|
|
4612
4625
|
level?: number | string;
|
|
4613
4626
|
toc?: boolean;
|
|
4614
4627
|
progress?: boolean;
|
|
4615
|
-
isCollapsible?: boolean;
|
|
4628
|
+
isCollapsible?: boolean | null;
|
|
4616
4629
|
anchor?: string;
|
|
4617
4630
|
reference?: string;
|
|
4618
4631
|
referenceEnd?: string;
|
|
@@ -4675,6 +4688,19 @@ declare class Builder extends BaseBuilder {
|
|
|
4675
4688
|
* @returns
|
|
4676
4689
|
*/
|
|
4677
4690
|
protected buildBook(_context: BuildContext, data: Partial<BookJson> | undefined): BookJson | undefined;
|
|
4691
|
+
/**
|
|
4692
|
+
* Resolve the accessibilityGroupTag data, materialising the bit type's default when absent.
|
|
4693
|
+
*
|
|
4694
|
+
* PLAN-019: `group_accessibilityDecorative` re-declares `@accessibilityGroupTag` with a
|
|
4695
|
+
* `defaultValue`, and its chained `@accessibilityTag` likewise. When the bit carries no
|
|
4696
|
+
* authored value, synthesize the default group so it reaches both generators. An authored
|
|
4697
|
+
* value always wins.
|
|
4698
|
+
*
|
|
4699
|
+
* @param bitConfig - the resolved config for the bit
|
|
4700
|
+
* @param data - authored data for the node, if any
|
|
4701
|
+
* @returns
|
|
4702
|
+
*/
|
|
4703
|
+
protected resolveAccessibilityGroupTag(bitConfig: BitConfig, data: Partial<GroupTagJson> | Partial<GroupTagJson>[] | undefined): Partial<GroupTagJson> | Partial<GroupTagJson>[] | undefined;
|
|
4678
4704
|
/**
|
|
4679
4705
|
* Build groupTag[] node
|
|
4680
4706
|
*
|
|
@@ -5762,6 +5788,7 @@ declare class BitmarkGenerator extends AstWalkerGenerator<BitmarkAst, void> {
|
|
|
5762
5788
|
protected exit_bitsValue(_node: NodeInfo, _route: NodeInfo[]): void;
|
|
5763
5789
|
protected enter_internalComment(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
5764
5790
|
protected enter_groupTag(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
5791
|
+
protected enter_accessibilityGroupTag(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
5765
5792
|
protected leaf_labelTrue(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
5766
5793
|
protected leaf_labelFalse(_node: NodeInfo, _route: NodeInfo[]): boolean;
|
|
5767
5794
|
protected enter_imageSource(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
@@ -6197,10 +6224,14 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
|
|
|
6197
6224
|
protected enter_sourceBB(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6198
6225
|
protected enter_productId(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6199
6226
|
/**
|
|
6200
|
-
*
|
|
6201
|
-
*
|
|
6202
|
-
*
|
|
6203
|
-
*
|
|
6227
|
+
* `isCollapsible` is emitted only when explicitly set on the bit — an explicit
|
|
6228
|
+
* `true`/`false` in the source is emitted as-is, and an absent tag yields no
|
|
6229
|
+
* JSON key (the tag is nullable in the config: no default, unset when absent).
|
|
6230
|
+
*
|
|
6231
|
+
* Two exceptions always carry a value: chapter bits default to `false`
|
|
6232
|
+
* (`defaultValue: 'false'` in the bit config, applied in `cleanBitJson()`),
|
|
6233
|
+
* and the deprecated `*-collapsible` bit types default to `true` (materialised
|
|
6234
|
+
* into the AST by the Builder).
|
|
6204
6235
|
*
|
|
6205
6236
|
* Defining these handlers suppresses the generic property handlers that
|
|
6206
6237
|
* `generatePropertyHandlers()` would otherwise install for this tag.
|