markup: Handle attribute lists in code fences

Fixes #8278
This commit is contained in:
Bjørn Erik Pedersen
2021-02-23 18:04:05 +01:00
parent cd0c5d7ef3
commit aed7df62a8
3 changed files with 78 additions and 6 deletions

View File

@@ -226,6 +226,25 @@ func TestConvertAttributes(t *testing.T) {
"> foo\n> bar\n{#id .className attrName=attrValue class=\"class1 class2\"}\n",
"<blockquote id=\"id\" class=\"className class1 class2\"><p>foo\nbar</p>\n</blockquote>\n",
},
/*{
// TODO(bep) this needs an upstream fix, see https://github.com/yuin/goldmark/issues/195
"Code block, CodeFences=false",
func(conf *markup_config.Config) {
withBlockAttributes(conf)
conf.Highlight.CodeFences = false
},
"```bash\necho 'foo';\n```\n{.myclass}",
"TODO",
},*/
{
"Code block, CodeFences=true",
func(conf *markup_config.Config) {
withBlockAttributes(conf)
conf.Highlight.CodeFences = true
},
"```bash\necho 'foo';\n````\n{.myclass id=\"myid\"}",
"<div class=\"highlight myclass\" id=\"myid\"><pre style",
},
{
"Paragraph",
withBlockAttributes,