Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GFM: my task lists not rendered #689

Closed
whisper-bye opened this issue Nov 21, 2015 · 5 comments
Closed

GFM: my task lists not rendered #689

whisper-bye opened this issue Nov 21, 2015 · 5 comments

Comments

@whisper-bye
Copy link

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;
    }
});
@Feder1co5oave
Copy link
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.

@jasondavis
Copy link

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

@whisper-bye
Copy link
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>';
  }
};

@vsudakov
Copy link

vsudakov commented Apr 7, 2016

+1 to add this feature by default

@joshbruce
Copy link
Member

#982

@markedjs markedjs locked as resolved and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants