micromark / micromark-extension-gfm

micromark extension to support GFM (GitHub Flavored Markdown)
https://unifiedjs.com
MIT License
27 stars 2 forks source link

I believe that the construct name is missing in each package under GFM. #12

Closed shlroland closed 2 months ago

shlroland commented 2 months ago

Initial checklist

Affected packages and versions

2.0.0

Link to runnable example

No response

Steps to reproduce

source code

Expected behavior

When I want to turn off certain constructs in the parser of remark, such as strong, I can pass attention to disable.null. But when I want to turn off constructs in GFM, such as strikethrough, I have no way unless I stop using remark-gfm altogether and instead selectively incorporate the functions I need.

Actual behavior

Upon examining the code, I discovered that it is this particular line of code that activates the passed disable.null.

    if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {
            return nok(code)
 }

But in https://github.com/micromark/micromark-extension-gfm-strikethrough/blob/ffa5ca5d0014667ed6c90625037b942cd7761c3c/dev/lib/syntax.js#L38, there isn't a name attribute.

So, would it be more appropriate to include the name attribute?

Relevant https://github.com/zestedesavoir/zmarkdown/issues/416#issuecomment-982812961 https://github.com/remarkjs/remark-gfm/issues/34#issue-1096426681 https://github.com/micromark/micromark-extension-gfm/issues/6#issue-1114755539

Runtime

Node v16

Package manager

pnpm

OS

macOS

Build and bundle tools

Vite

wooorm commented 2 months ago

Hey!

It isn’t exactly an issue: name is optional; it isn’t here because these are extensions, so you should be able to turn them off by not adding them.

But I do welcome PRs, I think it’s nice/good to have: I think I have it on my todolist somewhere too

Closing as this has to be solved in each of the extensions that implement constructs, not in this collection package!

github-actions[bot] commented 2 months ago

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.

shlroland commented 2 months ago

Hey!

It isn’t exactly an issue: name is optional; it isn’t here because these are extensions, so you should be able to turn them off by not adding them.

But I do welcome PRs, I think it’s nice/good to have: I think I have it on my todolist somewhere too

Closing as this has to be solved in each of the extensions that implement constructs, not in this collection package!

Thank you for your response. This feature is quite important to me, and I will submit PRs.