mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 17:26:22 +03:00
[GH-ISSUE #929] Parsers are missing in the type definitions #558
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#558
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JPeer264 on GitHub (Aug 11, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/929
Parsers with following type have been introduced here:
Types for:
markdownit.Token: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/markdown-it/lib/token.d.ts#L8micromark.Token: https://github.com/DavidAnson/markdownlint/blob/main/helpers/micromark.cjs#L16I could add a PR. But I am afraid I need to install
@types/markdown-itinto the dependencies to make them available for the type declarations. Unless there is a better way of doing this.@DavidAnson commented on GitHub (Aug 11, 2023):
markdown-it tokens are already defined in the .d.ts file:
github.com/DavidAnson/markdownlint@d641caf90c/lib/markdownlint.d.ts (L139)micromark tokens and the micromark parser are not documented or referenced because they are not officially supported for use by plug-ins yet.
Is there something you think is missing?
@JPeer264 commented on GitHub (Aug 14, 2023):
Thanks for coming back that quickly. The main reason why I came up with this issue is that we're writing our own custom rules (and we're using typescript for it). Unfortunately, we took advantage of the undocumented, yet officially exported, helpers file.
Before we took the function
forEachInlineChild, which got removed with the latest version:github.com/DavidAnson/markdownlint@ef1bd286a9 (diff-77185aed1). In a matter of fact, it got replaced with the not exportedfilterByTypesfrommicromark.cjsas shown here.As these things are all undocumented, it would be an excellent opportunity for us to move away from these features and use the types we actually have.
Since
parsersare not officially supported, I guess these lines can be changed toparams.tokenssince these are the same types: https://github.com/DavidAnson/markdownlint/blob/main/doc/CustomRules.md#:~:text=params.parsers.markdownit.tokens