Skip to content
New issue

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

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

Already on GitHub? # to your account

Showdown generates incorrect markdown for tasklists #773

Closed
orangelabs-dev opened this issue Feb 28, 2020 · 0 comments
Closed

Showdown generates incorrect markdown for tasklists #773

orangelabs-dev opened this issue Feb 28, 2020 · 0 comments

Comments

@orangelabs-dev
Copy link

I'm using GFM and tasklists with Showdown and it creates incorrect markdown from html.

Showdown Setup

Version: 1.9.1

var converter = new showdown.Converter({
  tasklists: true
})
converter.setFlavor('github')

converter.makeHtml

const initialValue = `
- [x] This task is done
- [ ] This is still pending`

const htmlString = converter.makeHtml(initialValue)
console.log(htmlString)
Output
<ul>
<li class="task-list-item" style="list-style-type: none;"><input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;" checked> This task is done</li>
<li class="task-list-item" style="list-style-type: none;"><input type="checkbox" disabled style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;"> This is still pending</li>
</ul> 

converter.makeMarkdown

const markdown = converter.makeMarkdown(htmlString)
console.log(markdown)
Output
- <input type="checkbox" disabled="" style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;" checked="">

 This task is done
- <input type="checkbox" disabled="" style="margin: 0px 0.35em 0.25em -1.6em; vertical-align: middle;">

 This is still pending

<!-- -->

As you can see, converting back to markdown generates a mix of markdown and html.

Complete code at https://codesandbox.io/s/showdown-example-n3dyv.
Check the output in the Sandbox console

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant