simov / markdown-viewer

Markdown Viewer / Browser Extension
MIT License
1.1k stars 136 forks source link

Support for Task lists #17

Closed s0h3ck closed 7 years ago

s0h3ck commented 7 years ago

Are there any plans to add support for task lists, like GitHub?

Example: https://github.com/blog/1825-task-lists-in-all-markdown-documents

simov commented 7 years ago

Thanks for the feedback @s0h3ck. I'm going to research about other markdown parsers and eventually let the user to choose one in the extension.

Currently I'm using the marked parser/compiler internally. There are other small inconsistencies between what you can see on GitHub and what the marked parser is capable of.

s0h3ck commented 7 years ago

Interesting :)

I think markdown-it might be more suitable for your needs, easier than showdownjs to implement plus has the emoji feature (it will solve the issue #13), but they do not support task lists. Maybe we can ask them to add the feature.

In addition, showndownjs might be an interesting choice. The link: https://github.com/showdownjs/showdown

As well, for the emoji issue, you could use showdown-emoji. Here is the link : https://www.npmjs.com/package/showdown-emoji

As for marked, I'm afraid task lists will not be a priority among their 331 issues :P

Happy coding :)

zhiqiexing commented 7 years ago

Hello, I hope this extension can support task list

simov commented 7 years ago

Thanks for the suggestions @s0h3ck it was very helpful!

I just published version 2.8 where you can choose between the marked and showdown compilers. All available compiler options can be found here, also if you hover over any of the options in the extension's popup, a tooltip will appear after a second or two.

Here is how it currently looks like: tasklists

In fact there is a PR in the Marked issue tracker that adds support for tasklist probably long before Showdown, but the Marked maintainers seems to be somewhat hesitant about adding more GFM features for some reason.

So I thought that it's better to have both parsers. The current implementation and UI allows me to add more parsers if there is a need to.

As usual let me know if you find any bugs or missing features. The only one I found so far missing in Showdown is this but there could be many.

s0h3ck commented 7 years ago

Nice work :)

I noticed a bug with nested element, but ShowdownJS Team is already aware of it here.

simov commented 7 years ago

Same issue here: https://github.com/showdownjs/showdown/issues/367#issuecomment-290514385

simov commented 7 years ago

Another quick release, I dropped Showdown in favor of Remark, you should receive the update automatically.

Remark covers all my syntax test cases, you have to add the raw.githubusercontent.com origin to enable the extension for that URL. Then you can compare it to how GitHub renders is.

Remark also have huge ecosystem of plugins so adding things like emoticons and other features won't be a problem.

jr-grenoble commented 5 years ago

Prelim: this markdown viewer is a great Chrome extension!

I bumped into this thread while trying to remove bullet marks from task lists (they are redundant) and enabling the corresponding input checkboxes. I don't think this is doable without a change to the Chrome extension, unless javascript scripts are processed by the viewer.

In @simov latest answer, the following links are dead: syntax test cases and rendering.

Another quick release, I dropped Showdown in favor of Remark, you should receive the update automatically.

Remark covers all my syntax test cases, you have to add the raw.githubusercontent.com origin to enable the extension for that URL. Then you can compare it to how GitHub renders is.

Remark also have huge ecosystem of plugins so adding things like emoticons and other features won't be a problem.

simov commented 5 years ago

The examples were extracted into separate repo: https://github.com/simov/markdown-syntax

I don't see a problem with the rendering of task lists.

jr-grenoble commented 5 years ago

Thanks for the quick response; indeed, bullet marks are no longer present in task lists.

However, checkboxes are "disabled" by default. Of course, this makes sense as there's no engine to process them. However, from a pure visual standpoint, the check marks can be useful: e.g. for someone using markdown to set up a checklist and then print the result after manually checking it (this is my actual use case).

Is there anyway to make them enabled ?

ps: I tried to inject CSS style in my md file (input:checked { background: red; color: white; }) but this is to no avail.