diff --git a/lexers/embedded/typescript.xml b/lexers/embedded/typescript.xml index d49241e6f..9828e92f5 100644 --- a/lexers/embedded/typescript.xml +++ b/lexers/embedded/typescript.xml @@ -51,10 +51,13 @@ + + + - + @@ -77,12 +80,25 @@ + + + + + + + + + + + + + @@ -200,7 +216,7 @@ - + diff --git a/lexers/testdata/tsx.actual b/lexers/testdata/tsx.actual index 2762b50da..78cce86e2 100644 --- a/lexers/testdata/tsx.actual +++ b/lexers/testdata/tsx.actual @@ -10,4 +10,19 @@ ReactDOM.render( , document.getElementById('root'), +) + +ReactDOM.render( +

+ data-test-id="outro" disabled> + Some text here. +

, + document.getElementById('root'), ) \ No newline at end of file diff --git a/lexers/testdata/tsx.expected b/lexers/testdata/tsx.expected index c7ddc3213..fa1088092 100644 --- a/lexers/testdata/tsx.expected +++ b/lexers/testdata/tsx.expected @@ -60,5 +60,46 @@ {"type":"LiteralStringSingle","value":"'root'"}, {"type":"Punctuation","value":"),"}, {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":")"}, + {"type":"Text","value":"\n\n"}, + {"type":"NameOther","value":"ReactDOM"}, + {"type":"Punctuation","value":"."}, + {"type":"NameOther","value":"render"}, + {"type":"Punctuation","value":"("}, + {"type":"Text","value":"\n "}, + {"type":"Punctuation","value":"\u003c"}, + {"type":"NameTag","value":"p"}, + {"type":"Text","value":"\n "}, + {"type":"CommentSingle","value":"// This is a inline comment.\n"}, + {"type":"Text","value":" "}, + {"type":"CommentMultiline","value":"/*\n This is a\n Multi line comment\n */"}, + {"type":"Text","value":"\n "}, + {"type":"Comment","value":"\u003c!-- Another multiline\n comment !--\u003e"}, + {"type":"Text","value":"\n "}, + {"type":"NameAttribute","value":"data-test-id"}, + {"type":"Operator","value":"="}, + {"type":"LiteralString","value":"\"outro\""}, + {"type":"Text","value":" "}, + {"type":"NameAttribute","value":"disabled"}, + {"type":"Punctuation","value":"\u003e"}, + {"type":"Text","value":"\n\t"}, + {"type":"NameOther","value":"Some"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"text"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"here"}, + {"type":"Punctuation","value":"."}, + {"type":"Text","value":"\n "}, + {"type":"Punctuation","value":"\u003c/"}, + {"type":"NameTag","value":"p"}, + {"type":"Punctuation","value":"\u003e,"}, + {"type":"Text","value":"\n "}, + {"type":"NameBuiltin","value":"document"}, + {"type":"Punctuation","value":"."}, + {"type":"NameOther","value":"getElementById"}, + {"type":"Punctuation","value":"("}, + {"type":"LiteralStringSingle","value":"'root'"}, + {"type":"Punctuation","value":"),"}, + {"type":"Text","value":"\n"}, {"type":"Punctuation","value":")"} ] diff --git a/lexers/testdata/typescript.actual b/lexers/testdata/typescript.actual new file mode 100644 index 000000000..5c76fcdc7 --- /dev/null +++ b/lexers/testdata/typescript.actual @@ -0,0 +1,5 @@ +const moduleName = modules.map(); + +declare module "fs" {} +declare module "@custom/plugin" {} +declare module "../../compiler/types" {} diff --git a/lexers/testdata/typescript.expected b/lexers/testdata/typescript.expected new file mode 100644 index 000000000..1fbff172f --- /dev/null +++ b/lexers/testdata/typescript.expected @@ -0,0 +1,37 @@ +[ + {"type":"KeywordReserved","value":"const"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"moduleName"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"="}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"modules"}, + {"type":"Punctuation","value":"."}, + {"type":"NameOther","value":"map"}, + {"type":"Punctuation","value":"();"}, + {"type":"Text","value":"\n\n"}, + {"type":"KeywordReserved","value":"declare"}, + {"type":"Text","value":" "}, + {"type":"KeywordReserved","value":"module"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"\"fs\""}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{}"}, + {"type":"Text","value":"\n"}, + {"type":"KeywordReserved","value":"declare"}, + {"type":"Text","value":" "}, + {"type":"KeywordReserved","value":"module"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"\"@custom/plugin\""}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{}"}, + {"type":"Text","value":"\n"}, + {"type":"KeywordReserved","value":"declare"}, + {"type":"Text","value":" "}, + {"type":"KeywordReserved","value":"module"}, + {"type":"Text","value":" "}, + {"type":"NameOther","value":"\"../../compiler/types\""}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{}"}, + {"type":"Text","value":"\n"} +]