@@ -12,47 +12,47 @@ import * as React from 'react'
1212 * Analogous to `node.type`. Please note that the values here may change at any time,
1313 * so do not hard code against the value directly.
1414 */
15- export const RuleType = {
16- blockQuote : '0' ,
17- breakLine : '1' ,
18- breakThematic : '2' ,
19- codeBlock : '3' ,
20- codeFenced : '4' ,
21- codeInline : '5' ,
22- footnote : '6' ,
23- footnoteReference : '7' ,
24- gfmTask : '8' ,
25- heading : '9' ,
26- headingSetext : '10' ,
15+ export const enum RuleType {
16+ blockQuote = '0' ,
17+ breakLine = '1' ,
18+ breakThematic = '2' ,
19+ codeBlock = '3' ,
20+ codeFenced = '4' ,
21+ codeInline = '5' ,
22+ footnote = '6' ,
23+ footnoteReference = '7' ,
24+ gfmTask = '8' ,
25+ heading = '9' ,
26+ headingSetext = '10' ,
2727 /** only available if not `disableHTMLParsing` */
28- htmlBlock : '11' ,
29- htmlComment : '12' ,
28+ htmlBlock = '11' ,
29+ htmlComment = '12' ,
3030 /** only available if not `disableHTMLParsing` */
31- htmlSelfClosing : '13' ,
32- image : '14' ,
33- link : '15' ,
31+ htmlSelfClosing = '13' ,
32+ image = '14' ,
33+ link = '15' ,
3434 /** emits a `link` 'node', does not render directly */
35- linkAngleBraceStyleDetector : '16' ,
35+ linkAngleBraceStyleDetector = '16' ,
3636 /** emits a `link` 'node', does not render directly */
37- linkBareUrlDetector : '17' ,
37+ linkBareUrlDetector = '17' ,
3838 /** emits a `link` 'node', does not render directly */
39- linkMailtoDetector : '18' ,
40- newlineCoalescer : '19' ,
41- orderedList : '20' ,
42- paragraph : '21' ,
43- ref : '22' ,
44- refImage : '23' ,
45- refLink : '24' ,
46- table : '25' ,
47- tableSeparator : '26' ,
48- text : '27' ,
49- textBolded : '28' ,
50- textEmphasized : '29' ,
51- textEscaped : '30' ,
52- textMarked : '31' ,
53- textStrikethroughed : '32' ,
54- unorderedList : '33' ,
55- } as const
39+ linkMailtoDetector = '18' ,
40+ newlineCoalescer = '19' ,
41+ orderedList = '20' ,
42+ paragraph = '21' ,
43+ ref = '22' ,
44+ refImage = '23' ,
45+ refLink = '24' ,
46+ table = '25' ,
47+ tableSeparator = '26' ,
48+ text = '27' ,
49+ textBolded = '28' ,
50+ textEmphasized = '29' ,
51+ textEscaped = '30' ,
52+ textMarked = '31' ,
53+ textStrikethroughed = '32' ,
54+ unorderedList = '33' ,
55+ }
5656
5757const enum Priority {
5858 /**
@@ -768,7 +768,7 @@ function parserFor(
768768 // there can be a single output function for all links,
769769 // even if there are several rules to parse them.
770770 if ( parsed . type == null ) {
771- parsed . type = ruleType as unknown as keyof typeof RuleType
771+ parsed . type = ruleType as unknown as RuleType
772772 }
773773
774774 result . push ( parsed )
@@ -1925,130 +1925,130 @@ export namespace MarkdownToJSX {
19251925
19261926 export interface BlockQuoteNode {
19271927 children : MarkdownToJSX . ParserResult [ ]
1928- type : ( typeof RuleType ) [ ' blockQuote' ]
1928+ type : RuleType . blockQuote
19291929 }
19301930
19311931 export interface BreakLineNode {
1932- type : ( typeof RuleType ) [ ' breakLine' ]
1932+ type : RuleType . breakLine
19331933 }
19341934
19351935 export interface BreakThematicNode {
1936- type : ( typeof RuleType ) [ ' breakThematic' ]
1936+ type : RuleType . breakThematic
19371937 }
19381938
19391939 export interface CodeBlockNode {
1940- type : ( typeof RuleType ) [ ' codeBlock' ]
1940+ type : RuleType . codeBlock
19411941 attrs ?: JSX . IntrinsicAttributes
19421942 lang ?: string
19431943 text : string
19441944 }
19451945
19461946 export interface CodeFencedNode {
1947- type : ( typeof RuleType ) [ ' codeFenced' ]
1947+ type : RuleType . codeFenced
19481948 }
19491949
19501950 export interface CodeInlineNode {
1951- type : ( typeof RuleType ) [ ' codeInline' ]
1951+ type : RuleType . codeInline
19521952 text : string
19531953 }
19541954
19551955 export interface FootnoteNode {
1956- type : ( typeof RuleType ) [ ' footnote' ]
1956+ type : RuleType . footnote
19571957 }
19581958
19591959 export interface FootnoteReferenceNode {
1960- type : ( typeof RuleType ) [ ' footnoteReference' ]
1960+ type : RuleType . footnoteReference
19611961 target : string
19621962 text : string
19631963 }
19641964
19651965 export interface GFMTaskNode {
1966- type : ( typeof RuleType ) [ ' gfmTask' ]
1966+ type : RuleType . gfmTask
19671967 completed : boolean
19681968 }
19691969
19701970 export interface HeadingNode {
1971- type : ( typeof RuleType ) [ ' heading' ]
1971+ type : RuleType . heading
19721972 children : MarkdownToJSX . ParserResult [ ]
19731973 id : string
19741974 level : 1 | 2 | 3 | 4 | 5 | 6
19751975 }
19761976
19771977 export interface HeadingSetextNode {
1978- type : ( typeof RuleType ) [ ' headingSetext' ]
1978+ type : RuleType . headingSetext
19791979 }
19801980
19811981 export interface HTMLCommentNode {
1982- type : ( typeof RuleType ) [ ' htmlComment' ]
1982+ type : RuleType . htmlComment
19831983 }
19841984
19851985 export interface ImageNode {
1986- type : ( typeof RuleType ) [ ' image' ]
1986+ type : RuleType . image
19871987 alt ?: string
19881988 target : string
19891989 title ?: string
19901990 }
19911991
19921992 export interface LinkNode {
1993- type : ( typeof RuleType ) [ ' link' ]
1993+ type : RuleType . link
19941994 children : MarkdownToJSX . ParserResult [ ]
19951995 target : string
19961996 title ?: string
19971997 }
19981998
19991999 export interface LinkAngleBraceNode {
2000- type : ( typeof RuleType ) [ ' linkAngleBraceStyleDetector' ]
2000+ type : RuleType . linkAngleBraceStyleDetector
20012001 }
20022002
20032003 export interface LinkBareURLNode {
2004- type : ( typeof RuleType ) [ ' linkBareUrlDetector' ]
2004+ type : RuleType . linkBareUrlDetector
20052005 }
20062006
20072007 export interface LinkMailtoNode {
2008- type : ( typeof RuleType ) [ ' linkMailtoDetector' ]
2008+ type : RuleType . linkMailtoDetector
20092009 }
20102010
20112011 export interface OrderedListNode {
2012- type : ( typeof RuleType ) [ ' orderedList' ]
2012+ type : RuleType . orderedList
20132013 items : MarkdownToJSX . ParserResult [ ] [ ]
20142014 ordered : true
20152015 start ?: number
20162016 }
20172017
20182018 export interface UnorderedListNode {
2019- type : ( typeof RuleType ) [ ' unorderedList' ]
2019+ type : RuleType . unorderedList
20202020 items : MarkdownToJSX . ParserResult [ ] [ ]
20212021 ordered : false
20222022 }
20232023
20242024 export interface NewlineNode {
2025- type : ( typeof RuleType ) [ ' newlineCoalescer' ]
2025+ type : RuleType . newlineCoalescer
20262026 }
20272027
20282028 export interface ParagraphNode {
2029- type : ( typeof RuleType ) [ ' paragraph' ]
2029+ type : RuleType . paragraph
20302030 children : MarkdownToJSX . ParserResult [ ]
20312031 }
20322032
20332033 export interface ReferenceNode {
2034- type : ( typeof RuleType ) [ ' ref' ]
2034+ type : RuleType . ref
20352035 }
20362036
20372037 export interface ReferenceImageNode {
2038- type : ( typeof RuleType ) [ ' refImage' ]
2038+ type : RuleType . refImage
20392039 alt ?: string
20402040 ref : string
20412041 }
20422042
20432043 export interface ReferenceLinkNode {
2044- type : ( typeof RuleType ) [ ' refLink' ]
2044+ type : RuleType . refLink
20452045 children : MarkdownToJSX . ParserResult [ ]
20462046 fallbackChildren : MarkdownToJSX . ParserResult [ ]
20472047 ref : string
20482048 }
20492049
20502050 export interface TableNode {
2051- type : ( typeof RuleType ) [ ' table' ]
2051+ type : RuleType . table
20522052 /**
20532053 * alignment for each table column
20542054 */
@@ -2058,40 +2058,40 @@ export namespace MarkdownToJSX {
20582058 }
20592059
20602060 export interface TableSeparatorNode {
2061- type : ( typeof RuleType ) [ ' tableSeparator' ]
2061+ type : RuleType . tableSeparator
20622062 }
20632063
20642064 export interface TextNode {
2065- type : ( typeof RuleType ) [ ' text' ]
2065+ type : RuleType . text
20662066 text : string
20672067 }
20682068
20692069 export interface BoldTextNode {
2070- type : ( typeof RuleType ) [ ' textBolded' ]
2070+ type : RuleType . textBolded
20712071 children : MarkdownToJSX . ParserResult [ ]
20722072 }
20732073
20742074 export interface ItalicTextNode {
2075- type : ( typeof RuleType ) [ ' textEmphasized' ]
2075+ type : RuleType . textEmphasized
20762076 children : MarkdownToJSX . ParserResult [ ]
20772077 }
20782078
20792079 export interface EscapedTextNode {
2080- type : ( typeof RuleType ) [ ' textEscaped' ]
2080+ type : RuleType . textEscaped
20812081 }
20822082
20832083 export interface MarkedTextNode {
2084- type : ( typeof RuleType ) [ ' textMarked' ]
2084+ type : RuleType . textMarked
20852085 children : MarkdownToJSX . ParserResult [ ]
20862086 }
20872087
20882088 export interface StrikethroughTextNode {
2089- type : ( typeof RuleType ) [ ' textStrikethroughed' ]
2089+ type : RuleType . textStrikethroughed
20902090 children : MarkdownToJSX . ParserResult [ ]
20912091 }
20922092
20932093 export interface HTMLNode {
2094- type : ( typeof RuleType ) [ ' htmlBlock' ]
2094+ type : RuleType . htmlBlock
20952095 attrs : JSX . IntrinsicAttributes
20962096 children ?: ReturnType < MarkdownToJSX . NestedParser > | undefined
20972097 noInnerParse : Boolean
@@ -2100,7 +2100,7 @@ export namespace MarkdownToJSX {
21002100 }
21012101
21022102 export interface HTMLSelfClosingNode {
2103- type : ( typeof RuleType ) [ ' htmlSelfClosing' ]
2103+ type : RuleType . htmlSelfClosing
21042104 attrs : JSX . IntrinsicAttributes
21052105 tag : string
21062106 }
0 commit comments