Closed RichardFevrier closed 4 years ago
That doesn’t work on GitHub, and this project is guarding you from it:
It is required to have some content in the paragraph: https://github.com/syntax-tree/mdast-util-gfm-task-list-item/blob/26584d70469a3528ead5510662830982e247bae2/to-markdown.js#L13
bullet
is not an mdast property btw.
I'm sorry but there is still a problem somewhere.
Because if you do it the other way :
From this markdown "* [ ] "
(the expected output before)
To a mdtree, using this (with the latest plugins):
var md2mdast = require('mdast-util-from-markdown');
var strikethroughSyntax = require('micromark-extension-gfm-strikethrough')
var strikethrough = require('mdast-util-gfm-strikethrough');
var tasklistitemSyntax = require('micromark-extension-gfm-task-list-item');
var tasklistitem = require('mdast-util-gfm-task-list-item');
const mdtree = md2mdast("* [ ] ", {
extensions: [strikethroughSyntax(), tasklistitemSyntax],
mdastExtensions: [strikethrough.fromMarkdown, tasklistitem.fromMarkdown]
});
You will retrive my tree at the beginning (minus the property 'bullet' like you pointed out and minus the 'Text' nested in the 'Paragraph').
A -> B C <- B
Any thoughts about that @wooorm ?
I have confirmed this is a bug in micromark-extension-gfm-task-list-item
, I’ll fix it there.
Fixed: https://github.com/micromark/micromark-extension-gfm-task-list-item/releases/tag/0.3.2. Thanks again @RichardFevrier!
Sorry @wooorm to continue this thread but I want to be sure the actual behavior is right.
If we take "- [ ] "
in Input, the last space is trimmed in the tree and if we convert it back to markdown we find this "- [ ]\n"
Is it the expected result?
(As always all modules are up to date)
Trimming initial and final spaces on lines is part of how markdown works, too.
Adding a final line ending is to ensure files are valid: it’s not really part of markdown but unix wants it that way
So yes, the input/output you show is expected. Does that answer your question, or is there something I missed?
That's perfectly clear! Thank you to take time to answer 🙏 Your lib is amazing by the way ❤️
Thank you!!
Consider the following tree:
And the following code/configuration:
Here is the result of markdown:
Problem: The result should be something like this:
"* [ ] "