@@ -12,47 +12,47 @@ 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 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' ,
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
- } 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
+ }
56
56
57
57
const enum Priority {
58
58
/**
@@ -768,7 +768,7 @@ function parserFor(
768
768
// there can be a single output function for all links,
769
769
// even if there are several rules to parse them.
770
770
if ( parsed . type == null ) {
771
- parsed . type = ruleType as unknown as keyof typeof RuleType
771
+ parsed . type = ruleType as unknown as RuleType
772
772
}
773
773
774
774
result . push ( parsed )
@@ -1925,130 +1925,130 @@ export namespace MarkdownToJSX {
1925
1925
1926
1926
export interface BlockQuoteNode {
1927
1927
children : MarkdownToJSX . ParserResult [ ]
1928
- type : ( typeof RuleType ) [ ' blockQuote' ]
1928
+ type : RuleType . blockQuote
1929
1929
}
1930
1930
1931
1931
export interface BreakLineNode {
1932
- type : ( typeof RuleType ) [ ' breakLine' ]
1932
+ type : RuleType . breakLine
1933
1933
}
1934
1934
1935
1935
export interface BreakThematicNode {
1936
- type : ( typeof RuleType ) [ ' breakThematic' ]
1936
+ type : RuleType . breakThematic
1937
1937
}
1938
1938
1939
1939
export interface CodeBlockNode {
1940
- type : ( typeof RuleType ) [ ' codeBlock' ]
1940
+ type : RuleType . codeBlock
1941
1941
attrs ?: JSX . IntrinsicAttributes
1942
1942
lang ?: string
1943
1943
text : string
1944
1944
}
1945
1945
1946
1946
export interface CodeFencedNode {
1947
- type : ( typeof RuleType ) [ ' codeFenced' ]
1947
+ type : RuleType . codeFenced
1948
1948
}
1949
1949
1950
1950
export interface CodeInlineNode {
1951
- type : ( typeof RuleType ) [ ' codeInline' ]
1951
+ type : RuleType . codeInline
1952
1952
text : string
1953
1953
}
1954
1954
1955
1955
export interface FootnoteNode {
1956
- type : ( typeof RuleType ) [ ' footnote' ]
1956
+ type : RuleType . footnote
1957
1957
}
1958
1958
1959
1959
export interface FootnoteReferenceNode {
1960
- type : ( typeof RuleType ) [ ' footnoteReference' ]
1960
+ type : RuleType . footnoteReference
1961
1961
target : string
1962
1962
text : string
1963
1963
}
1964
1964
1965
1965
export interface GFMTaskNode {
1966
- type : ( typeof RuleType ) [ ' gfmTask' ]
1966
+ type : RuleType . gfmTask
1967
1967
completed : boolean
1968
1968
}
1969
1969
1970
1970
export interface HeadingNode {
1971
- type : ( typeof RuleType ) [ ' heading' ]
1971
+ type : RuleType . heading
1972
1972
children : MarkdownToJSX . ParserResult [ ]
1973
1973
id : string
1974
1974
level : 1 | 2 | 3 | 4 | 5 | 6
1975
1975
}
1976
1976
1977
1977
export interface HeadingSetextNode {
1978
- type : ( typeof RuleType ) [ ' headingSetext' ]
1978
+ type : RuleType . headingSetext
1979
1979
}
1980
1980
1981
1981
export interface HTMLCommentNode {
1982
- type : ( typeof RuleType ) [ ' htmlComment' ]
1982
+ type : RuleType . htmlComment
1983
1983
}
1984
1984
1985
1985
export interface ImageNode {
1986
- type : ( typeof RuleType ) [ ' image' ]
1986
+ type : RuleType . image
1987
1987
alt ?: string
1988
1988
target : string
1989
1989
title ?: string
1990
1990
}
1991
1991
1992
1992
export interface LinkNode {
1993
- type : ( typeof RuleType ) [ ' link' ]
1993
+ type : RuleType . link
1994
1994
children : MarkdownToJSX . ParserResult [ ]
1995
1995
target : string
1996
1996
title ?: string
1997
1997
}
1998
1998
1999
1999
export interface LinkAngleBraceNode {
2000
- type : ( typeof RuleType ) [ ' linkAngleBraceStyleDetector' ]
2000
+ type : RuleType . linkAngleBraceStyleDetector
2001
2001
}
2002
2002
2003
2003
export interface LinkBareURLNode {
2004
- type : ( typeof RuleType ) [ ' linkBareUrlDetector' ]
2004
+ type : RuleType . linkBareUrlDetector
2005
2005
}
2006
2006
2007
2007
export interface LinkMailtoNode {
2008
- type : ( typeof RuleType ) [ ' linkMailtoDetector' ]
2008
+ type : RuleType . linkMailtoDetector
2009
2009
}
2010
2010
2011
2011
export interface OrderedListNode {
2012
- type : ( typeof RuleType ) [ ' orderedList' ]
2012
+ type : RuleType . orderedList
2013
2013
items : MarkdownToJSX . ParserResult [ ] [ ]
2014
2014
ordered : true
2015
2015
start ?: number
2016
2016
}
2017
2017
2018
2018
export interface UnorderedListNode {
2019
- type : ( typeof RuleType ) [ ' unorderedList' ]
2019
+ type : RuleType . unorderedList
2020
2020
items : MarkdownToJSX . ParserResult [ ] [ ]
2021
2021
ordered : false
2022
2022
}
2023
2023
2024
2024
export interface NewlineNode {
2025
- type : ( typeof RuleType ) [ ' newlineCoalescer' ]
2025
+ type : RuleType . newlineCoalescer
2026
2026
}
2027
2027
2028
2028
export interface ParagraphNode {
2029
- type : ( typeof RuleType ) [ ' paragraph' ]
2029
+ type : RuleType . paragraph
2030
2030
children : MarkdownToJSX . ParserResult [ ]
2031
2031
}
2032
2032
2033
2033
export interface ReferenceNode {
2034
- type : ( typeof RuleType ) [ ' ref' ]
2034
+ type : RuleType . ref
2035
2035
}
2036
2036
2037
2037
export interface ReferenceImageNode {
2038
- type : ( typeof RuleType ) [ ' refImage' ]
2038
+ type : RuleType . refImage
2039
2039
alt ?: string
2040
2040
ref : string
2041
2041
}
2042
2042
2043
2043
export interface ReferenceLinkNode {
2044
- type : ( typeof RuleType ) [ ' refLink' ]
2044
+ type : RuleType . refLink
2045
2045
children : MarkdownToJSX . ParserResult [ ]
2046
2046
fallbackChildren : MarkdownToJSX . ParserResult [ ]
2047
2047
ref : string
2048
2048
}
2049
2049
2050
2050
export interface TableNode {
2051
- type : ( typeof RuleType ) [ ' table' ]
2051
+ type : RuleType . table
2052
2052
/**
2053
2053
* alignment for each table column
2054
2054
*/
@@ -2058,40 +2058,40 @@ export namespace MarkdownToJSX {
2058
2058
}
2059
2059
2060
2060
export interface TableSeparatorNode {
2061
- type : ( typeof RuleType ) [ ' tableSeparator' ]
2061
+ type : RuleType . tableSeparator
2062
2062
}
2063
2063
2064
2064
export interface TextNode {
2065
- type : ( typeof RuleType ) [ ' text' ]
2065
+ type : RuleType . text
2066
2066
text : string
2067
2067
}
2068
2068
2069
2069
export interface BoldTextNode {
2070
- type : ( typeof RuleType ) [ ' textBolded' ]
2070
+ type : RuleType . textBolded
2071
2071
children : MarkdownToJSX . ParserResult [ ]
2072
2072
}
2073
2073
2074
2074
export interface ItalicTextNode {
2075
- type : ( typeof RuleType ) [ ' textEmphasized' ]
2075
+ type : RuleType . textEmphasized
2076
2076
children : MarkdownToJSX . ParserResult [ ]
2077
2077
}
2078
2078
2079
2079
export interface EscapedTextNode {
2080
- type : ( typeof RuleType ) [ ' textEscaped' ]
2080
+ type : RuleType . textEscaped
2081
2081
}
2082
2082
2083
2083
export interface MarkedTextNode {
2084
- type : ( typeof RuleType ) [ ' textMarked' ]
2084
+ type : RuleType . textMarked
2085
2085
children : MarkdownToJSX . ParserResult [ ]
2086
2086
}
2087
2087
2088
2088
export interface StrikethroughTextNode {
2089
- type : ( typeof RuleType ) [ ' textStrikethroughed' ]
2089
+ type : RuleType . textStrikethroughed
2090
2090
children : MarkdownToJSX . ParserResult [ ]
2091
2091
}
2092
2092
2093
2093
export interface HTMLNode {
2094
- type : ( typeof RuleType ) [ ' htmlBlock' ]
2094
+ type : RuleType . htmlBlock
2095
2095
attrs : JSX . IntrinsicAttributes
2096
2096
children ?: ReturnType < MarkdownToJSX . NestedParser > | undefined
2097
2097
noInnerParse : Boolean
@@ -2100,7 +2100,7 @@ export namespace MarkdownToJSX {
2100
2100
}
2101
2101
2102
2102
export interface HTMLSelfClosingNode {
2103
- type : ( typeof RuleType ) [ ' htmlSelfClosing' ]
2103
+ type : RuleType . htmlSelfClosing
2104
2104
attrs : JSX . IntrinsicAttributes
2105
2105
tag : string
2106
2106
}
0 commit comments