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

How to set spread option on each node? #77

Open
bendtherules opened this issue Dec 26, 2019 · 2 comments · May be fixed by #88
Open

How to set spread option on each node? #77

bendtherules opened this issue Dec 26, 2019 · 2 comments · May be fixed by #88

Comments

@bendtherules
Copy link

bendtherules commented Dec 26, 2019

remark-stringify supports a property spread on each node - which it uses to decide the tightness of the output.

it is needed to output something like -

- a0
  - a1

from nested lists (ast) created using this library.

Can we add support for this property in all builder functions? This is just a passthrough property which gets added to the output object.
Maybe a general mechanism for this instead? Ex. extra object as input whose all properties gets added to output.

Considering they are part of the same ecosystem, it makes sense to play nice.

@mike-north
Copy link
Owner

Is spread part of the public API for remark-stringify? I can't find it in the types.

In either case, I'd be open to improving alignment with the ecosystem. I'd just want to ensure that any changes in this library align with the public/private nature of spread in other packages.

@n0x3u5
Copy link

n0x3u5 commented Sep 21, 2020

Hi!

spread does seem to be a part of the of List and ListItem nodes in the mdast specification itself. Having support for this would be very nice.

remark-stringify also supports the spread option in lists and list items. I've tested that on my own and (as far as I can tell) support for spread probably landed in remark in this PR.

As for my use case, I'm processing a bunch of markdown files to generate a sort of "Table of Contents" in Markdown format and feeding that into a documentation generator (DocsifyJS) which expects "tight" lists and list items for proper styling in its generated HTML.

I have created a PR at #88 which does add support for spread to mdast-builder. But, I think the API probably needs review from @mike-north first.

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

Successfully merging a pull request may close this issue.

3 participants