mirror of
https://github.com/alecthomas/chroma.git
synced 2025-03-17 20:58:08 +02:00
parent
34d9c7143b
commit
4f3623dce6
@ -2,11 +2,12 @@ package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/h"
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Markdown lexer.
|
||||
var Markdown = internal.Register(MustNewLexer(
|
||||
var Markdown = internal.Register(DelegatingLexer(h.HTML, MustNewLexer(
|
||||
&Config{
|
||||
Name: "markdown",
|
||||
Aliases: []string{"md", "mkd"},
|
||||
@ -40,8 +41,8 @@ var Markdown = internal.Register(MustNewLexer(
|
||||
{"`[^`]+`", LiteralStringBacktick, nil},
|
||||
{`[@#][\w/:]+`, NameEntity, nil},
|
||||
{`(!?\[)([^]]+)(\])(\()([^)]+)(\))`, ByGroups(Text, NameTag, Text, Text, NameAttribute, Text), nil},
|
||||
{`[^\\\s]+`, Text, nil},
|
||||
{`.|\n`, Text, nil},
|
||||
{`[^\\\s]+`, Other, nil},
|
||||
{`.|\n`, Other, nil},
|
||||
},
|
||||
},
|
||||
))
|
||||
)))
|
||||
|
2
lexers/testdata/markdown.actual
vendored
2
lexers/testdata/markdown.actual
vendored
@ -1,5 +1,7 @@
|
||||
# about
|
||||
|
||||
<div class="html">HTML</div>
|
||||
|
||||
Multiple **bold** on the **same line**.
|
||||
|
||||
## user defined function in cql
|
||||
|
14
lexers/testdata/markdown.expected
vendored
14
lexers/testdata/markdown.expected
vendored
@ -1,6 +1,18 @@
|
||||
[
|
||||
{"type":"GenericHeading","value":"# about\n"},
|
||||
{"type":"Text","value":"\nMultiple "},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Punctuation","value":"\u003c"},
|
||||
{"type":"NameTag","value":"div"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"NameAttribute","value":"class"},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"LiteralString","value":"\"html\""},
|
||||
{"type":"Punctuation","value":"\u003e"},
|
||||
{"type":"Text","value":"HTML"},
|
||||
{"type":"Punctuation","value":"\u003c/"},
|
||||
{"type":"NameTag","value":"div"},
|
||||
{"type":"Punctuation","value":"\u003e"},
|
||||
{"type":"Text","value":"\n\nMultiple "},
|
||||
{"type":"GenericStrong","value":"**bold**"},
|
||||
{"type":"Text","value":" on the "},
|
||||
{"type":"GenericStrong","value":"**same line**"},
|
||||
|
Loading…
x
Reference in New Issue
Block a user