@gmb/bitmark-parser-generator 5.36.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 +823 -77
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +426 -376
- package/dist/browser/esm/index.d.ts +426 -376
- package/dist/browser/esm/index.js +823 -77
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/cli/main.js +826 -77
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +826 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +426 -376
- package/dist/index.d.ts +426 -376
- package/dist/index.js +826 -77
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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";
|
|
@@ -1048,6 +1051,8 @@ declare const ConfigKey: {
|
|
|
1048
1051
|
readonly property_trim: "@trim";
|
|
1049
1052
|
readonly property_unit: "@unit";
|
|
1050
1053
|
readonly property_unitAbbr: "@unitAbbr";
|
|
1054
|
+
readonly property_unitAbbrPlural: "@unitAbbrPlural";
|
|
1055
|
+
readonly property_unitPlural: "@unitPlural";
|
|
1051
1056
|
readonly property_vendorDashboardId: "@vendorDashboardId";
|
|
1052
1057
|
readonly property_vendorSurveyId: "@vendorSurveyId";
|
|
1053
1058
|
readonly property_vendorUrl: "@vendorUrl";
|
|
@@ -1752,6 +1757,8 @@ interface BitJson {
|
|
|
1752
1757
|
slug: string;
|
|
1753
1758
|
tag: string | string[];
|
|
1754
1759
|
groupTag: GroupTagJson[];
|
|
1760
|
+
accessibilityTag: string | string[];
|
|
1761
|
+
accessibilityGroupTag: GroupTagJson[];
|
|
1755
1762
|
reviewTag: string | string[];
|
|
1756
1763
|
reviewerTag: string | string[];
|
|
1757
1764
|
reductionTag: string | string[];
|
|
@@ -1952,7 +1959,7 @@ interface BitJson {
|
|
|
1952
1959
|
level: number;
|
|
1953
1960
|
toc: boolean;
|
|
1954
1961
|
progress: boolean;
|
|
1955
|
-
isCollapsible: boolean;
|
|
1962
|
+
isCollapsible: boolean | null;
|
|
1956
1963
|
anchor: string;
|
|
1957
1964
|
reference: string | string[];
|
|
1958
1965
|
referenceEnd: string;
|
|
@@ -2249,7 +2256,9 @@ interface TechnicalTermJson {
|
|
|
2249
2256
|
interface ServingsJson {
|
|
2250
2257
|
servings: number;
|
|
2251
2258
|
unit: string;
|
|
2259
|
+
unitPlural: string;
|
|
2252
2260
|
unitAbbr: string;
|
|
2261
|
+
unitAbbrPlural: string;
|
|
2253
2262
|
decimalPlaces: number;
|
|
2254
2263
|
disableCalculation: boolean;
|
|
2255
2264
|
hint: string;
|
|
@@ -2260,7 +2269,9 @@ interface IngredientJson {
|
|
|
2260
2269
|
ingredient: string;
|
|
2261
2270
|
quantity: number;
|
|
2262
2271
|
unit: string;
|
|
2272
|
+
unitPlural: string;
|
|
2263
2273
|
unitAbbr: string;
|
|
2274
|
+
unitAbbrPlural: string;
|
|
2264
2275
|
decimalPlaces: number;
|
|
2265
2276
|
disableCalculation: boolean;
|
|
2266
2277
|
item: JsonText;
|
|
@@ -2384,6 +2395,8 @@ interface Bit {
|
|
|
2384
2395
|
slug?: Property;
|
|
2385
2396
|
tag?: Property;
|
|
2386
2397
|
groupTag?: GroupTagJson[];
|
|
2398
|
+
accessibilityTag?: Property;
|
|
2399
|
+
accessibilityGroupTag?: GroupTagJson[];
|
|
2387
2400
|
reviewTag?: Property;
|
|
2388
2401
|
reviewerTag?: Property;
|
|
2389
2402
|
reductionTag?: Property;
|
|
@@ -2683,6 +2696,10 @@ declare const NodeType: {
|
|
|
2683
2696
|
readonly unknown: "unknown";
|
|
2684
2697
|
readonly __isDefaultExample: "__isDefaultExample";
|
|
2685
2698
|
readonly __typeAlias: "__typeAlias";
|
|
2699
|
+
readonly accessibilityGroupTag: "accessibilityGroupTag";
|
|
2700
|
+
readonly accessibilityGroupTagValue: "accessibilityGroupTagValue";
|
|
2701
|
+
readonly accessibilityTag: "accessibilityTag";
|
|
2702
|
+
readonly accessibilityTagValue: "accessibilityTagValue";
|
|
2686
2703
|
readonly action: "action";
|
|
2687
2704
|
readonly actionValue: "actionValue";
|
|
2688
2705
|
readonly activityType: "activityType";
|
|
@@ -3380,6 +3397,8 @@ declare const NodeType: {
|
|
|
3380
3397
|
readonly type: "type";
|
|
3381
3398
|
readonly unit: "unit";
|
|
3382
3399
|
readonly unitAbbr: "unitAbbr";
|
|
3400
|
+
readonly unitAbbrPlural: "unitAbbrPlural";
|
|
3401
|
+
readonly unitPlural: "unitPlural";
|
|
3383
3402
|
readonly url: "url";
|
|
3384
3403
|
readonly validationDate: "validationDate";
|
|
3385
3404
|
readonly validationDateValue: "validationDateValue";
|
|
@@ -3545,345 +3564,6 @@ declare class Ast {
|
|
|
3545
3564
|
private isValue;
|
|
3546
3565
|
}
|
|
3547
3566
|
|
|
3548
|
-
declare const BodyTextFormat: {
|
|
3549
|
-
readonly plainText: "text";
|
|
3550
|
-
readonly latex: "latex";
|
|
3551
|
-
readonly json: "json";
|
|
3552
|
-
readonly xml: "xml";
|
|
3553
|
-
readonly bitmarkPlusPlus: "bitmark++";
|
|
3554
|
-
};
|
|
3555
|
-
type BodyTextFormatType = EnumType<typeof BodyTextFormat>;
|
|
3556
|
-
|
|
3557
|
-
/**
|
|
3558
|
-
* The location of text.
|
|
3559
|
-
*
|
|
3560
|
-
* The location of the text affects how breakscaping is applied.
|
|
3561
|
-
*/
|
|
3562
|
-
declare const TextLocation: {
|
|
3563
|
-
readonly tag: "tag";
|
|
3564
|
-
readonly body: "body";
|
|
3565
|
-
};
|
|
3566
|
-
type TextLocationType = EnumType<typeof TextLocation>;
|
|
3567
|
-
|
|
3568
|
-
/**
|
|
3569
|
-
* Configuration options for breakscape and unbreakscape operations.
|
|
3570
|
-
*
|
|
3571
|
-
* @public
|
|
3572
|
-
*/
|
|
3573
|
-
interface BreakscapeOptions$1 {
|
|
3574
|
-
/**
|
|
3575
|
-
* The text format to use for processing.
|
|
3576
|
-
* @defaultValue TextFormat.bitmarkPlusPlus
|
|
3577
|
-
*/
|
|
3578
|
-
format?: BodyTextFormatType;
|
|
3579
|
-
/**
|
|
3580
|
-
* The text location context for processing.
|
|
3581
|
-
* @defaultValue TextLocation.body
|
|
3582
|
-
*/
|
|
3583
|
-
location?: TextLocationType;
|
|
3584
|
-
/**
|
|
3585
|
-
* Whether to mutate the input array in-place when processing arrays.
|
|
3586
|
-
* If false, a new array will be created.
|
|
3587
|
-
* @defaultValue false
|
|
3588
|
-
*/
|
|
3589
|
-
inPlaceArray?: boolean;
|
|
3590
|
-
/**
|
|
3591
|
-
* Legacy: if true, perform v2 breakscaping from JSON
|
|
3592
|
-
*/
|
|
3593
|
-
v2?: boolean;
|
|
3594
|
-
}
|
|
3595
|
-
|
|
3596
|
-
type BreakscapedString = string & {
|
|
3597
|
-
readonly __isBreakscaped: unique symbol;
|
|
3598
|
-
};
|
|
3599
|
-
|
|
3600
|
-
declare const BitmarkVersion: {
|
|
3601
|
-
readonly v2: 2;
|
|
3602
|
-
readonly v3: 3;
|
|
3603
|
-
};
|
|
3604
|
-
type BitmarkVersionType = EnumType<typeof BitmarkVersion>;
|
|
3605
|
-
|
|
3606
|
-
interface Generator<T extends Node, R = void> {
|
|
3607
|
-
generate: (ast: T, param1?: unknown, param2?: unknown) => Promise<R>;
|
|
3608
|
-
generateSync: (ast: T, param1?: unknown, param2?: unknown) => R;
|
|
3609
|
-
}
|
|
3610
|
-
|
|
3611
|
-
/**
|
|
3612
|
-
* Generator that walks bitmark AST.
|
|
3613
|
-
*
|
|
3614
|
-
* The implementation should implement functions with the correct naming, and these will be called when
|
|
3615
|
-
* walking the AST:
|
|
3616
|
-
*
|
|
3617
|
-
* enter_<nodeKey>() - called when entering a branch node
|
|
3618
|
-
* between_<nodeKey>() - called when between child nodes
|
|
3619
|
-
* exit_<nodeKey>() - called when exiting a branch node
|
|
3620
|
-
* leaf_<nodeKey>() - called when entering a leaf node
|
|
3621
|
-
*/
|
|
3622
|
-
declare abstract class AstWalkerGenerator<AstType, R, Context = undefined> implements Generator<AstType, R>, AstWalkCallbacks<Context> {
|
|
3623
|
-
protected ast: Ast;
|
|
3624
|
-
protected debugGenerationInline: boolean;
|
|
3625
|
-
protected printed: boolean;
|
|
3626
|
-
abstract generate(ast: AstType, param1?: unknown, param2?: unknown): Promise<R>;
|
|
3627
|
-
abstract generateSync(ast: AstType, param1?: unknown, param2?: unknown): R;
|
|
3628
|
-
enter(node: NodeInfo, route: NodeInfo[], context: Context): boolean | void;
|
|
3629
|
-
between(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[], context: Context): boolean | void;
|
|
3630
|
-
exit(node: NodeInfo, route: NodeInfo[], context: Context): void;
|
|
3631
|
-
leaf(node: NodeInfo, route: NodeInfo[], context: Context): void;
|
|
3632
|
-
protected getParentNode(route: NodeInfo[], nodesBack?: number): NodeInfo | undefined;
|
|
3633
|
-
protected getSiblingNodes(route: NodeInfo[]): {
|
|
3634
|
-
left?: unknown;
|
|
3635
|
-
right?: unknown;
|
|
3636
|
-
};
|
|
3637
|
-
protected isEmptyParagraph(node: TextNode): boolean;
|
|
3638
|
-
protected abstract writeInlineDebug(key: string, state: {
|
|
3639
|
-
open?: boolean;
|
|
3640
|
-
close?: boolean;
|
|
3641
|
-
single?: boolean;
|
|
3642
|
-
}): void;
|
|
3643
|
-
}
|
|
3644
|
-
|
|
3645
|
-
/**
|
|
3646
|
-
* Text generation options
|
|
3647
|
-
*/
|
|
3648
|
-
interface TextOptions {
|
|
3649
|
-
/**
|
|
3650
|
-
* Callback for writing text
|
|
3651
|
-
*
|
|
3652
|
-
* If set, the callback will be called, rather than writing to the output string
|
|
3653
|
-
*/
|
|
3654
|
-
writeCallback?: WriteCallback;
|
|
3655
|
-
/**
|
|
3656
|
-
* Callback for rendering body bits
|
|
3657
|
-
*/
|
|
3658
|
-
bodyBitCallback?: BodyBitCallback;
|
|
3659
|
-
/**
|
|
3660
|
-
* [development only]
|
|
3661
|
-
* Generate debug information in the output.
|
|
3662
|
-
*/
|
|
3663
|
-
debugGenerationInline?: boolean;
|
|
3664
|
-
}
|
|
3665
|
-
type GenerateOptions = {
|
|
3666
|
-
plainTextDividerAllowed?: boolean;
|
|
3667
|
-
noBreakscaping?: boolean;
|
|
3668
|
-
forceInline?: boolean;
|
|
3669
|
-
noMarkup?: boolean;
|
|
3670
|
-
};
|
|
3671
|
-
declare const Stage: {
|
|
3672
|
-
enter: string;
|
|
3673
|
-
between: string;
|
|
3674
|
-
exit: string;
|
|
3675
|
-
};
|
|
3676
|
-
type StageType = EnumType<typeof Stage>;
|
|
3677
|
-
type WriteCallback = (s: string) => void;
|
|
3678
|
-
type BodyBitCallback = (bodyBit: BodyBitJson, index: number, route: NodeInfo[]) => string;
|
|
3679
|
-
interface MediaAttributeOptions {
|
|
3680
|
-
ignoreAttributes?: Set<string>;
|
|
3681
|
-
}
|
|
3682
|
-
/**
|
|
3683
|
-
* Generate text from a bitmark text AST
|
|
3684
|
-
*/
|
|
3685
|
-
declare class TextGenerator extends AstWalkerGenerator<TextAst, BreakscapedString> {
|
|
3686
|
-
protected ast: Ast;
|
|
3687
|
-
private bitmarkVersion;
|
|
3688
|
-
private options;
|
|
3689
|
-
private internalTextGenerator;
|
|
3690
|
-
private generateOptions;
|
|
3691
|
-
private textFormat;
|
|
3692
|
-
private textLocation;
|
|
3693
|
-
private writerText;
|
|
3694
|
-
private nodeIndex;
|
|
3695
|
-
private currentIndent;
|
|
3696
|
-
private prevIndent;
|
|
3697
|
-
private indentationStringCache;
|
|
3698
|
-
private inParagraph;
|
|
3699
|
-
private inHeading;
|
|
3700
|
-
private inCodeBlock;
|
|
3701
|
-
private inBulletList;
|
|
3702
|
-
private inInline;
|
|
3703
|
-
private markDepth;
|
|
3704
|
-
private textDepth;
|
|
3705
|
-
private placeholderIndex;
|
|
3706
|
-
private placeholders;
|
|
3707
|
-
private rootParagraphNodeContentIndex;
|
|
3708
|
-
private previousRootParagraphContextType;
|
|
3709
|
-
private inPreText;
|
|
3710
|
-
private thisNodeIsPreText;
|
|
3711
|
-
private preTextIndexTemp;
|
|
3712
|
-
private havePreText;
|
|
3713
|
-
private preTextIndex;
|
|
3714
|
-
/**
|
|
3715
|
-
* Generate text from a bitmark text AST
|
|
3716
|
-
*
|
|
3717
|
-
* @param bitmarkVersion - bitmark version, use null to use latest version
|
|
3718
|
-
* @param options - text generation options
|
|
3719
|
-
*/
|
|
3720
|
-
constructor(bitmarkVersion?: BitmarkVersionType, options?: TextOptions);
|
|
3721
|
-
/**
|
|
3722
|
-
* Generate text from a bitmark text AST
|
|
3723
|
-
*
|
|
3724
|
-
* @param ast bitmark text AST
|
|
3725
|
-
*/
|
|
3726
|
-
generate(ast: TextAst, textFormat: TextFormatType, textLocation: TextLocationType, options?: GenerateOptions): Promise<BreakscapedString>;
|
|
3727
|
-
/**
|
|
3728
|
-
* Generate text from a bitmark text AST synchronously
|
|
3729
|
-
*
|
|
3730
|
-
* @param ast bitmark text AST
|
|
3731
|
-
*/
|
|
3732
|
-
generateSync(ast: TextAst, textFormat: TextFormatType, textLocation: TextLocationType, options?: GenerateOptions): BreakscapedString;
|
|
3733
|
-
getPlaceholders(): BodyBitsJson;
|
|
3734
|
-
private resetState;
|
|
3735
|
-
private walkAndWrite;
|
|
3736
|
-
protected enter_textAstValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3737
|
-
protected between_textAstValue(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void | false;
|
|
3738
|
-
protected exit_textAstValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3739
|
-
protected enter_contentValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3740
|
-
protected between_contentValue(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void;
|
|
3741
|
-
protected exit_contentValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3742
|
-
protected enter_contentValueValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3743
|
-
protected between_contentValueValue(node: NodeInfo, left: NodeInfo, right: NodeInfo, route: NodeInfo[]): void;
|
|
3744
|
-
protected exit_contentValueValue(node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3745
|
-
protected enter_marks(_node: NodeInfo, _route: NodeInfo[]): void | false;
|
|
3746
|
-
protected exit_marks(_node: NodeInfo, _route: NodeInfo[]): void | false;
|
|
3747
|
-
protected handleEnterNode(node: TextNode, route: NodeInfo[]): void | false;
|
|
3748
|
-
protected handleBetweenNode(node: TextNode, _left: NodeInfo, _right: NodeInfo, _route: NodeInfo[]): void;
|
|
3749
|
-
protected handleExitNode(node: TextNode, _route: NodeInfo[]): void | false;
|
|
3750
|
-
protected handleIndent(node: TextNode): void;
|
|
3751
|
-
protected handleDedent(node: TextNode): void;
|
|
3752
|
-
protected handleEnterContentValueNode(_node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3753
|
-
protected handleBetweenContentValueNode(_node: NodeInfo, left: NodeInfo, _right: NodeInfo, route: NodeInfo[]): void;
|
|
3754
|
-
protected handleExitContentValueNode(_node: NodeInfo, route: NodeInfo[]): void | false;
|
|
3755
|
-
private updatePreTextState;
|
|
3756
|
-
protected handleEnterNodePreTextCheck(node: TextNode, route: NodeInfo[]): void;
|
|
3757
|
-
/**
|
|
3758
|
-
* Check if a text node has a link mark, and if so, return the href
|
|
3759
|
-
*
|
|
3760
|
-
* @param node the node to check for a link mark
|
|
3761
|
-
* @returns the href, or false if no link mark
|
|
3762
|
-
*/
|
|
3763
|
-
protected getLinkHref(node: TextNode): string | false;
|
|
3764
|
-
/**
|
|
3765
|
-
* Get the current indentation string
|
|
3766
|
-
* @returns
|
|
3767
|
-
*/
|
|
3768
|
-
protected getIndentationString(): string;
|
|
3769
|
-
protected writeBodyBit(node: TextNode, route: NodeInfo[]): void;
|
|
3770
|
-
protected writeText(node: TextNode): void;
|
|
3771
|
-
/**
|
|
3772
|
-
* Check if a node is a link node and if so and the node has only the link mark, and the link without the
|
|
3773
|
-
* protocol is the same as the text, return true. Otherwise return false.
|
|
3774
|
-
*
|
|
3775
|
-
* @param node
|
|
3776
|
-
* @returns true if a simple link, otherwise false
|
|
3777
|
-
*/
|
|
3778
|
-
protected isSimpleLink(node: TextNode): boolean;
|
|
3779
|
-
/**
|
|
3780
|
-
* Get the link text if the node is a link, otherwise return false
|
|
3781
|
-
*
|
|
3782
|
-
* @param node
|
|
3783
|
-
* @returns
|
|
3784
|
-
*/
|
|
3785
|
-
protected getLinkText(node: TextNode): string | false;
|
|
3786
|
-
/**
|
|
3787
|
-
* If the existing written text ends with a half-mark, and the new text starts with the same half-mark, insert a
|
|
3788
|
-
* breakscape ^ between them to break the sequence.
|
|
3789
|
-
*
|
|
3790
|
-
* Only applies to bitmark version > 2
|
|
3791
|
-
*
|
|
3792
|
-
* @param s
|
|
3793
|
-
*/
|
|
3794
|
-
protected getInterTextBreakscape(s: string): string;
|
|
3795
|
-
protected validateGenerateOptions(ast: TextNode[]): void;
|
|
3796
|
-
/**
|
|
3797
|
-
* Write the marks for the node.
|
|
3798
|
-
*
|
|
3799
|
-
* All marks need to be considered at once, because if there are multiple marks, they need to be written in
|
|
3800
|
-
* a combined manner.
|
|
3801
|
-
*
|
|
3802
|
-
* e.g. if there are bold and italic marks, they need to be written as
|
|
3803
|
-
*
|
|
3804
|
-
* ==the text==|bold|italic|
|
|
3805
|
-
* rather than
|
|
3806
|
-
* **__the text__**
|
|
3807
|
-
* or
|
|
3808
|
-
* **__the text**__
|
|
3809
|
-
*
|
|
3810
|
-
* @param node the text node
|
|
3811
|
-
* @param start true if starting (before) the text, false if ending (after) the text
|
|
3812
|
-
*/
|
|
3813
|
-
protected writeMarks(node: TextNode, stage: StageType): void | false;
|
|
3814
|
-
protected writeParagraph(node: TextNode, route: NodeInfo[]): void;
|
|
3815
|
-
protected writeHardBreak(_node: TextNode): void;
|
|
3816
|
-
protected writeHeading(node: HeadingTextNode): void;
|
|
3817
|
-
protected writeSection(node: SectionTextNode): void;
|
|
3818
|
-
protected writeBullet(node: TextNode, route: NodeInfo[]): void;
|
|
3819
|
-
protected writeImage(node: ImageTextNode | ImageInlineTextNode): void;
|
|
3820
|
-
protected writeCodeBlock(node: CodeBlockTextNode): void;
|
|
3821
|
-
protected writeLatex(node: LatexTextNode): void;
|
|
3822
|
-
protected writeMarkTextWrapper(s: string): void;
|
|
3823
|
-
protected writeInlineMark(mark: TextMark): void;
|
|
3824
|
-
/**
|
|
3825
|
-
* Resolve the marks of a text node into the marks that will actually be written.
|
|
3826
|
-
*
|
|
3827
|
-
* - Merges a legacy standalone 'duration' mark into its sibling 'timer' mark.
|
|
3828
|
-
* - Drops marks the current grammar cannot express (standalone 'duration', 'timer'
|
|
3829
|
-
* without a duration).
|
|
3830
|
-
* - Moves a 'textStyle'/'color' mark before a preceding bare 'highlight'/'userHighlight'
|
|
3831
|
-
* mark when its color is a valid highlight color; written in the original order the
|
|
3832
|
-
* output would re-parse as a highlight-with-color compound mark and change meaning.
|
|
3833
|
-
*/
|
|
3834
|
-
protected getWritableMarks(nodeMarks: TextMark[]): TextMark[];
|
|
3835
|
-
/**
|
|
3836
|
-
* True if the mark is written using its standard form (e.g. **bold**, !!highlight!!)
|
|
3837
|
-
* when it is the only mark. A highlight mark with a color attribute is excluded - it
|
|
3838
|
-
* can only be expressed using the inline chain form (==text==|highlight|color:x|).
|
|
3839
|
-
*/
|
|
3840
|
-
protected isStandardMark(mark: TextMark): boolean;
|
|
3841
|
-
/**
|
|
3842
|
-
* True if the mark is written using the inline chain form (==text==|mark|).
|
|
3843
|
-
*/
|
|
3844
|
-
protected isInlineMark(mark: TextMark): boolean;
|
|
3845
|
-
protected writeCommentMark(mark: CommentMark): void;
|
|
3846
|
-
protected writeLinkMark(mark: LinkMark): void;
|
|
3847
|
-
protected writeRefMark(mark: RefMark): void;
|
|
3848
|
-
protected writeXRefMark(mark: XRefMark): void;
|
|
3849
|
-
protected writeExtRefMark(mark: ExtRefMark): void;
|
|
3850
|
-
protected writeFootnoteMark(mark: FootnoteMark): void;
|
|
3851
|
-
protected writeFootnoteStarMark(mark: FootnoteMark): void;
|
|
3852
|
-
protected writeSymbolMark(mark: SymbolMark): void;
|
|
3853
|
-
protected writeInlineMarkStartEnd(): void;
|
|
3854
|
-
protected writePlainTextDivider(): void;
|
|
3855
|
-
protected writeString(s?: string): void;
|
|
3856
|
-
protected writeNL(): void;
|
|
3857
|
-
protected writeInlineDebug(key: string, state: {
|
|
3858
|
-
open?: boolean;
|
|
3859
|
-
close?: boolean;
|
|
3860
|
-
single?: boolean;
|
|
3861
|
-
}): void;
|
|
3862
|
-
protected getMediaAttrs(mediaType: string, attrs: MediaAttributes, options?: MediaAttributeOptions): string | undefined;
|
|
3863
|
-
protected breakscape(s: string, options: BreakscapeOptions$1): string;
|
|
3864
|
-
protected getBitType(route: NodeInfo[]): BitTypeType | undefined;
|
|
3865
|
-
/**
|
|
3866
|
-
* Writes a string value to the output.
|
|
3867
|
-
* @param value - The string value to be written.
|
|
3868
|
-
*/
|
|
3869
|
-
write(value: string): this;
|
|
3870
|
-
/**
|
|
3871
|
-
* Writes a new line to the output. The line is indented automatically. The line is ended with the endOfLineString.
|
|
3872
|
-
* @param value - The line to write. When omitted, only the endOfLineString is written.
|
|
3873
|
-
*/
|
|
3874
|
-
writeLine(value?: string): this;
|
|
3875
|
-
/**
|
|
3876
|
-
* Writes a collection of lines to the output. Each line is indented automatically and ended with the endOfLineString.
|
|
3877
|
-
* @param values - The lines to write.
|
|
3878
|
-
* @param delimiter - An optional delimiter to be written at the end of each line, except for the last one.
|
|
3879
|
-
*/
|
|
3880
|
-
writeLines(values: string[], delimiter?: string): this;
|
|
3881
|
-
/**
|
|
3882
|
-
* Writes a single whitespace character to the output.
|
|
3883
|
-
*/
|
|
3884
|
-
writeWhiteSpace(): this;
|
|
3885
|
-
}
|
|
3886
|
-
|
|
3887
3567
|
declare const ExampleType: {
|
|
3888
3568
|
readonly none: "none";
|
|
3889
3569
|
readonly string: "string";
|
|
@@ -4163,41 +3843,380 @@ interface ToStringOptions {
|
|
|
4163
3843
|
includeChains?: boolean;
|
|
4164
3844
|
includeConfigs?: boolean;
|
|
4165
3845
|
}
|
|
4166
|
-
declare class BitConfig {
|
|
4167
|
-
readonly since: string;
|
|
4168
|
-
readonly bitType: BitTypeType;
|
|
4169
|
-
readonly inheritedBitTypes: BitTypeType[];
|
|
4170
|
-
readonly inheritedBitTypesSet: Set<BitTypeType>;
|
|
4171
|
-
readonly textFormatDefault: TextFormatType;
|
|
4172
|
-
readonly tags: TagsConfig;
|
|
4173
|
-
readonly cardSet?: CardSetConfig;
|
|
4174
|
-
readonly quizBit?: boolean;
|
|
4175
|
-
readonly deprecated?: string;
|
|
4176
|
-
readonly bodyAllowed?: boolean;
|
|
4177
|
-
readonly bodyRequired?: boolean;
|
|
4178
|
-
readonly footerAllowed?: boolean;
|
|
4179
|
-
readonly footerRequired?: boolean;
|
|
4180
|
-
readonly resourceAttachmentAllowed?: boolean;
|
|
4181
|
-
readonly rootExampleType?: ExampleTypeType;
|
|
4182
|
-
readonly comboResourceConfigKey?: ConfigKeyType;
|
|
4183
|
-
constructor(config: {
|
|
4184
|
-
since: string;
|
|
4185
|
-
bitType: BitTypeType;
|
|
4186
|
-
inheritedBitTypes: BitTypeType[];
|
|
4187
|
-
textFormatDefault: TextFormatType;
|
|
4188
|
-
tags: TagsConfig;
|
|
4189
|
-
cardSet: CardSetConfig | undefined;
|
|
4190
|
-
quizBit: boolean | undefined;
|
|
4191
|
-
deprecated: string | undefined;
|
|
4192
|
-
bodyAllowed: boolean | undefined;
|
|
4193
|
-
bodyRequired: boolean | undefined;
|
|
4194
|
-
footerAllowed: boolean | undefined;
|
|
4195
|
-
footerRequired: boolean | undefined;
|
|
4196
|
-
resourceAttachmentAllowed: boolean | undefined;
|
|
4197
|
-
rootExampleType: ExampleTypeType | undefined;
|
|
4198
|
-
comboResourceConfigKey: ConfigKeyType | undefined;
|
|
4199
|
-
});
|
|
4200
|
-
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;
|
|
4201
4220
|
}
|
|
4202
4221
|
|
|
4203
4222
|
interface BitmarkTextParserOptions {
|
|
@@ -4400,6 +4419,8 @@ declare class Builder extends BaseBuilder {
|
|
|
4400
4419
|
slug?: string;
|
|
4401
4420
|
tag?: string | string[];
|
|
4402
4421
|
groupTag?: Partial<GroupTagJson> | Partial<GroupTagJson>[];
|
|
4422
|
+
accessibilityTag?: string | string[];
|
|
4423
|
+
accessibilityGroupTag?: Partial<GroupTagJson> | Partial<GroupTagJson>[];
|
|
4403
4424
|
reviewTag?: string | string[];
|
|
4404
4425
|
reviewerTag?: string | string[];
|
|
4405
4426
|
reductionTag?: string | string[];
|
|
@@ -4604,7 +4625,7 @@ declare class Builder extends BaseBuilder {
|
|
|
4604
4625
|
level?: number | string;
|
|
4605
4626
|
toc?: boolean;
|
|
4606
4627
|
progress?: boolean;
|
|
4607
|
-
isCollapsible?: boolean;
|
|
4628
|
+
isCollapsible?: boolean | null;
|
|
4608
4629
|
anchor?: string;
|
|
4609
4630
|
reference?: string;
|
|
4610
4631
|
referenceEnd?: string;
|
|
@@ -4667,6 +4688,19 @@ declare class Builder extends BaseBuilder {
|
|
|
4667
4688
|
* @returns
|
|
4668
4689
|
*/
|
|
4669
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;
|
|
4670
4704
|
/**
|
|
4671
4705
|
* Build groupTag[] node
|
|
4672
4706
|
*
|
|
@@ -5754,6 +5788,7 @@ declare class BitmarkGenerator extends AstWalkerGenerator<BitmarkAst, void> {
|
|
|
5754
5788
|
protected exit_bitsValue(_node: NodeInfo, _route: NodeInfo[]): void;
|
|
5755
5789
|
protected enter_internalComment(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
5756
5790
|
protected enter_groupTag(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
5791
|
+
protected enter_accessibilityGroupTag(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
5757
5792
|
protected leaf_labelTrue(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
5758
5793
|
protected leaf_labelFalse(_node: NodeInfo, _route: NodeInfo[]): boolean;
|
|
5759
5794
|
protected enter_imageSource(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
@@ -6188,6 +6223,21 @@ declare class JsonGenerator extends AstWalkerGenerator<BitmarkAst, void> {
|
|
|
6188
6223
|
protected enter_ratingLevelEnd(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6189
6224
|
protected enter_sourceBB(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6190
6225
|
protected enter_productId(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6226
|
+
/**
|
|
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).
|
|
6235
|
+
*
|
|
6236
|
+
* Defining these handlers suppresses the generic property handlers that
|
|
6237
|
+
* `generatePropertyHandlers()` would otherwise install for this tag.
|
|
6238
|
+
*/
|
|
6239
|
+
protected leaf_isCollapsible(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6240
|
+
protected enter_isCollapsible(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6191
6241
|
protected enter_markConfig(_node: NodeInfo, _route: NodeInfo[]): boolean;
|
|
6192
6242
|
protected enter_markConfigValue(node: NodeInfo, route: NodeInfo[]): boolean;
|
|
6193
6243
|
protected enter_item(node: NodeInfo, route: NodeInfo[]): boolean;
|