Closed cipherboy closed 4 years ago
pandoc renders an unordered task list with
<ul class="task-list">
. GitHub uses the class contains-task-list.
Official specification is here and as you can see task lists do not have any classes. It means pandoc and Github implementation do not stick with official spec. So this should be an extension and not be included in the main repository.
I would recommend you to implement an ASTTransformer
.
ast.Walk
ast.TaskCheckBox
node,
ast.List
node by n.Parent().Parent()
listNode.SetAttributeString("class", "task-list")
Thanks @yuin I thought this might be your suggested solution. I've implemented something similar in our transformer. I guess that this issue could now be closed.
Ref: go-gitea/gitea#10798
@zeripath That's good to know, thanks!
I'd like to consider adding classes to containers of extensions. Consider a task list:
This'll get rendered into the following HTML (for instance -- I didn't execute goldmark here):
There's no way to differentiate (in CSS) between a
<ul>
with a task list underneath and a regular bulleted list.pandoc
solves this problem by adding aclass="task-list"
to the<ul>
. GitHub adds the classcontains-task-list
.I think we could solve this in three ways:
<ul>
rendering classes to detect if it contains a task-list. Solve it for this one case.<p>
to<div>
, adding arbitrary number of classes on arbitrary parent elements, ... -- gives control of modifying the AST to extensions rather than external callers.Thoughts? I'm happy to implement whatever you decide, I'd just like to leave the design decision to you as it is your project.
Boilerplate below:
<
>
, Table, etc) are not part of CommonMark spec. You should confirm your output is different from other official renderers correspond with an extension.pandoc
renders an unordered task list with<ul class="task-list">
. GitHub uses the classcontains-task-list
.Please answer the following before submitting your issue:
ul
/ol
element, to different it from a regular bulleted/numbered list.ul
/ol
.pandoc
give theul
a class, to help with styling.