镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

GFM: my task lists not rendered #689

Closed

Description

@whisper-bye

my test code:

### Solar System Exploration, 1950s – 1960s

- [ ] Mercury
- [x] Venus
- [x] Earth (Orbit/Moon)
- [x] Mars
- [ ] Jupiter
- [ ] Saturn
- [ ] Uranus
- [ ] Neptune
- [ ] Comet Haley

results:

Solar System Exploration, 1950s – 1960s

- [ ] Mercury
- [x] Venus
- [x] Earth (Orbit/Moon)
- [x] Mars
- [ ] Jupiter
- [ ] Saturn
- [ ] Uranus
- [ ] Neptune
- [ ] Comet Haley

my config:

marked.setOptions({
    gfm: true,
    tables: true,
    highlight: function (code, lang) {
        return hljs.highlightAuto(code, [lang]).value;
    }
});

Activity

  1. Feder1co5oave commented on Nov 23, 2015

    @Feder1co5oave
    Contributor

    I think task lists are not considered part of GFM, but as an additional feature of GitHub, just like auto-linking of commits/users/issues references.

  2. jasondavis commented on Nov 27, 2015

    @jasondavis

    I was looking for this today as well. Would love to see it added here!

  3. whisper-bye commented on Nov 28, 2015

    @whisper-bye
    Author

    I found this #107 , It works

    var renderer = new marked.Renderer();
    renderer.listitem = function(text) {
    if (/^\s*\[[x ]\]\s*/.test(text)) {
    text = text
      .replace(/^\s*\[ \]\s*/, '<i class="empty checkbox icon"></i> ')
      .replace(/^\s*\[x\]\s*/, '<i class="checked checkbox icon"></i> ');
        return '<li style="list-style: none">' + text + '</li>';
      } else {
        return '<li>' + text + '</li>';
      }
    };
  4. vsudakov commented on Apr 7, 2016

    @vsudakov

    +1 to add this feature by default

  5. joshbruce commented on Dec 25, 2017

    @joshbruce
    Member
  6. locked as resolved and limited conversation to collaborators on May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions