yuin / goldmark

:trophy: A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured.
MIT License
3.68k stars 255 forks source link

The class property of task-list 's <ul> needed in goldmark #96

Closed AmazingRise closed 4 years ago

AmazingRise commented 4 years ago

Please answer the following before submitting your issue:

  1. What version of goldmark are you using? : v1.1.22
  2. What version of Go are you using? : go 1.13.6
  3. What operating system and processor architecture are you using? : linux/amd64
  4. What did you do? : Generate a task list from markdown:
    - [X] task1
    - [ ] task2 
  5. What did you expect to see? : I suggest to add a class property to ul, so it will be easy for developers to distinguish the task list and normal list, also be convenient to customize the style of task-list.
    <ul class="task-list">
    <li><label><input type="checkbox" checked="" disabled="" class="task-list-item"> task1</label></li>
    <li><label><input type="checkbox" disabled="" class="task-list-item"> task2</label></li>
    </ul>
  6. What did you see instead? : The generated HTML code is:
    <ul>
    <li><input checked="" disabled="" type="checkbox">task1</li>
    <li><input disabled="" type="checkbox">task2</li>
    </ul>
  7. Did you confirm your output is different from CommonMark online demo or other official renderer correspond with an extension?: It was the same from official render. Just a new feature request.
  8. (Feature request only): Why you can not implement it as an extension?: It is a feature request of one extension. This issue is an discussion for adding this feature to goldmark.
yuin commented 4 years ago

Official Github flavored markdown spec does not add such classes.

codelogic commented 3 years ago

I would like to make a few follow up points before this gets closed again:

  1. The spec is ambiguous around allowing checkboxes to be enabled or disabled by default.
  2. The spec does not have language that would prevent classes from being added.
  3. The Github implementation adds classes to lists of checkboxes (specifically it adds contains-task-list to the <ul> element and task-list-item to the li element.
  4. It is impossible to style the list items (to remove the bullet marker the way Github does) without some form of class selector.

Given that removing the list item marker and providing custom styling to checkboxes are both nearly impossible without adding class names, can we reconsider this?

Here is an example: https://gist.github.com/codelogic/6842851cbe05c88a5fffa7cc3bb0b30f