@@ -12,47 +12,49 @@ import * as React from 'react'
12
12
* Analogous to `node.type`. Please note that the values here may change at any time,
13
13
* so do not hard code against the value directly.
14
14
*/
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' ,
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' ,
27
27
/** only available if not `disableHTMLParsing` */
28
- htmlBlock = '11' ,
29
- htmlComment = '12' ,
28
+ htmlBlock : '11' ,
29
+ htmlComment : '12' ,
30
30
/** only available if not `disableHTMLParsing` */
31
- htmlSelfClosing = '13' ,
32
- image = '14' ,
33
- link = '15' ,
31
+ htmlSelfClosing : '13' ,
32
+ image : '14' ,
33
+ link : '15' ,
34
34
/** emits a `link` 'node', does not render directly */
35
- linkAngleBraceStyleDetector = '16' ,
35
+ linkAngleBraceStyleDetector : '16' ,
36
36
/** emits a `link` 'node', does not render directly */
37
- linkBareUrlDetector = '17' ,
37
+ linkBareUrlDetector : '17' ,
38
38
/** 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
- }
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
56
+
57
+ export type RuleType = ( typeof RuleType ) [ keyof typeof RuleType ]
56
58
57
59
const enum Priority {
58
60
/**
@@ -2001,130 +2003,130 @@ export namespace MarkdownToJSX {
2001
2003
2002
2004
export interface BlockQuoteNode {
2003
2005
children : MarkdownToJSX . ParserResult [ ]
2004
- type : RuleType . blockQuote
2006
+ type : typeof RuleType . blockQuote
2005
2007
}
2006
2008
2007
2009
export interface BreakLineNode {
2008
- type : RuleType . breakLine
2010
+ type : typeof RuleType . breakLine
2009
2011
}
2010
2012
2011
2013
export interface BreakThematicNode {
2012
- type : RuleType . breakThematic
2014
+ type : typeof RuleType . breakThematic
2013
2015
}
2014
2016
2015
2017
export interface CodeBlockNode {
2016
- type : RuleType . codeBlock
2018
+ type : typeof RuleType . codeBlock
2017
2019
attrs ?: JSX . IntrinsicAttributes
2018
2020
lang ?: string
2019
2021
text : string
2020
2022
}
2021
2023
2022
2024
export interface CodeFencedNode {
2023
- type : RuleType . codeFenced
2025
+ type : typeof RuleType . codeFenced
2024
2026
}
2025
2027
2026
2028
export interface CodeInlineNode {
2027
- type : RuleType . codeInline
2029
+ type : typeof RuleType . codeInline
2028
2030
text : string
2029
2031
}
2030
2032
2031
2033
export interface FootnoteNode {
2032
- type : RuleType . footnote
2034
+ type : typeof RuleType . footnote
2033
2035
}
2034
2036
2035
2037
export interface FootnoteReferenceNode {
2036
- type : RuleType . footnoteReference
2038
+ type : typeof RuleType . footnoteReference
2037
2039
target : string
2038
2040
text : string
2039
2041
}
2040
2042
2041
2043
export interface GFMTaskNode {
2042
- type : RuleType . gfmTask
2044
+ type : typeof RuleType . gfmTask
2043
2045
completed : boolean
2044
2046
}
2045
2047
2046
2048
export interface HeadingNode {
2047
- type : RuleType . heading
2049
+ type : typeof RuleType . heading
2048
2050
children : MarkdownToJSX . ParserResult [ ]
2049
2051
id : string
2050
2052
level : 1 | 2 | 3 | 4 | 5 | 6
2051
2053
}
2052
2054
2053
2055
export interface HeadingSetextNode {
2054
- type : RuleType . headingSetext
2056
+ type : typeof RuleType . headingSetext
2055
2057
}
2056
2058
2057
2059
export interface HTMLCommentNode {
2058
- type : RuleType . htmlComment
2060
+ type : typeof RuleType . htmlComment
2059
2061
}
2060
2062
2061
2063
export interface ImageNode {
2062
- type : RuleType . image
2064
+ type : typeof RuleType . image
2063
2065
alt ?: string
2064
2066
target : string
2065
2067
title ?: string
2066
2068
}
2067
2069
2068
2070
export interface LinkNode {
2069
- type : RuleType . link
2071
+ type : typeof RuleType . link
2070
2072
children : MarkdownToJSX . ParserResult [ ]
2071
2073
target : string
2072
2074
title ?: string
2073
2075
}
2074
2076
2075
2077
export interface LinkAngleBraceNode {
2076
- type : RuleType . linkAngleBraceStyleDetector
2078
+ type : typeof RuleType . linkAngleBraceStyleDetector
2077
2079
}
2078
2080
2079
2081
export interface LinkBareURLNode {
2080
- type : RuleType . linkBareUrlDetector
2082
+ type : typeof RuleType . linkBareUrlDetector
2081
2083
}
2082
2084
2083
2085
export interface LinkMailtoNode {
2084
- type : RuleType . linkMailtoDetector
2086
+ type : typeof RuleType . linkMailtoDetector
2085
2087
}
2086
2088
2087
2089
export interface OrderedListNode {
2088
- type : RuleType . orderedList
2090
+ type : typeof RuleType . orderedList
2089
2091
items : MarkdownToJSX . ParserResult [ ] [ ]
2090
2092
ordered : true
2091
2093
start ?: number
2092
2094
}
2093
2095
2094
2096
export interface UnorderedListNode {
2095
- type : RuleType . unorderedList
2097
+ type : typeof RuleType . unorderedList
2096
2098
items : MarkdownToJSX . ParserResult [ ] [ ]
2097
2099
ordered : false
2098
2100
}
2099
2101
2100
2102
export interface NewlineNode {
2101
- type : RuleType . newlineCoalescer
2103
+ type : typeof RuleType . newlineCoalescer
2102
2104
}
2103
2105
2104
2106
export interface ParagraphNode {
2105
- type : RuleType . paragraph
2107
+ type : typeof RuleType . paragraph
2106
2108
children : MarkdownToJSX . ParserResult [ ]
2107
2109
}
2108
2110
2109
2111
export interface ReferenceNode {
2110
- type : RuleType . ref
2112
+ type : typeof RuleType . ref
2111
2113
}
2112
2114
2113
2115
export interface ReferenceImageNode {
2114
- type : RuleType . refImage
2116
+ type : typeof RuleType . refImage
2115
2117
alt ?: string
2116
2118
ref : string
2117
2119
}
2118
2120
2119
2121
export interface ReferenceLinkNode {
2120
- type : RuleType . refLink
2122
+ type : typeof RuleType . refLink
2121
2123
children : MarkdownToJSX . ParserResult [ ]
2122
2124
fallbackChildren : MarkdownToJSX . ParserResult [ ]
2123
2125
ref : string
2124
2126
}
2125
2127
2126
2128
export interface TableNode {
2127
- type : RuleType . table
2129
+ type : typeof RuleType . table
2128
2130
/**
2129
2131
* alignment for each table column
2130
2132
*/
@@ -2134,40 +2136,40 @@ export namespace MarkdownToJSX {
2134
2136
}
2135
2137
2136
2138
export interface TableSeparatorNode {
2137
- type : RuleType . tableSeparator
2139
+ type : typeof RuleType . tableSeparator
2138
2140
}
2139
2141
2140
2142
export interface TextNode {
2141
- type : RuleType . text
2143
+ type : typeof RuleType . text
2142
2144
text : string
2143
2145
}
2144
2146
2145
2147
export interface BoldTextNode {
2146
- type : RuleType . textBolded
2148
+ type : typeof RuleType . textBolded
2147
2149
children : MarkdownToJSX . ParserResult [ ]
2148
2150
}
2149
2151
2150
2152
export interface ItalicTextNode {
2151
- type : RuleType . textEmphasized
2153
+ type : typeof RuleType . textEmphasized
2152
2154
children : MarkdownToJSX . ParserResult [ ]
2153
2155
}
2154
2156
2155
2157
export interface EscapedTextNode {
2156
- type : RuleType . textEscaped
2158
+ type : typeof RuleType . textEscaped
2157
2159
}
2158
2160
2159
2161
export interface MarkedTextNode {
2160
- type : RuleType . textMarked
2162
+ type : typeof RuleType . textMarked
2161
2163
children : MarkdownToJSX . ParserResult [ ]
2162
2164
}
2163
2165
2164
2166
export interface StrikethroughTextNode {
2165
- type : RuleType . textStrikethroughed
2167
+ type : typeof RuleType . textStrikethroughed
2166
2168
children : MarkdownToJSX . ParserResult [ ]
2167
2169
}
2168
2170
2169
2171
export interface HTMLNode {
2170
- type : RuleType . htmlBlock
2172
+ type : typeof RuleType . htmlBlock
2171
2173
attrs : JSX . IntrinsicAttributes
2172
2174
children ?: ReturnType < MarkdownToJSX . NestedParser > | undefined
2173
2175
noInnerParse : Boolean
@@ -2176,7 +2178,7 @@ export namespace MarkdownToJSX {
2176
2178
}
2177
2179
2178
2180
export interface HTMLSelfClosingNode {
2179
- type : RuleType . htmlSelfClosing
2181
+ type : typeof RuleType . htmlSelfClosing
2180
2182
attrs : JSX . IntrinsicAttributes
2181
2183
tag : string
2182
2184
}
@@ -2252,8 +2254,8 @@ export namespace MarkdownToJSX {
2252
2254
}
2253
2255
2254
2256
export type Rules = {
2255
- [ K in ParserResult [ 'type' ] ] : K extends RuleType . table
2256
- ? Rule < Extract < ParserResult , { type : K | RuleType . paragraph } > >
2257
+ [ K in ParserResult [ 'type' ] ] : K extends typeof RuleType . table
2258
+ ? Rule < Extract < ParserResult , { type : K | typeof RuleType . paragraph } > >
2257
2259
: Rule < Extract < ParserResult , { type : K } > >
2258
2260
}
2259
2261
0 commit comments