[GH-ISSUE #134] Is shared.js meant to be used externally? [Allow helper methods to be used by external rules] #1961

Closed
opened 2026-03-07 20:03:10 +03:00 by kerem · 5 comments
Owner

Originally created by @JoshuaKGoldberg on GitHub (Jul 15, 2018).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/134

I'm writing a custom rule, and it would be very useful to use methods such as forEachLine in it. Is this file part of the public API?

Originally created by @JoshuaKGoldberg on GitHub (Jul 15, 2018). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/134 I'm writing a custom rule, and it would be very useful to use methods such as `forEachLine` in it. Is this file part of the public API?
kerem 2026-03-07 20:03:10 +03:00
Author
Owner

@DavidAnson commented on GitHub (Jul 15, 2018):

No, this is not public (so not exported or documented). That was deliberate to keep the surface area down, but I will use this issue to track the suggestion to make it public.

<!-- gh-comment-id:405104158 --> @DavidAnson commented on GitHub (Jul 15, 2018): No, this is not public (so not exported or documented). That was deliberate to keep the surface area down, but I will use this issue to track the suggestion to make it public.
Author
Owner

@JoshuaKGoldberg commented on GitHub (Jul 15, 2018):

In that case, +1 to making it public! I would hate to have to re-implement many of those methods externally.

You could also go with a tsutils approach of separating them out... but I would personally prefer keeping them here for simplicity's sake.

<!-- gh-comment-id:405104237 --> @JoshuaKGoldberg commented on GitHub (Jul 15, 2018): In that case, +1 to making it public! I would hate to have to re-implement many of those methods externally. You could also go with a [tsutils](https://github.com/ajafff/tsutils/) approach of separating them out... but I would personally prefer keeping them here for simplicity's sake.
Author
Owner

@DavidAnson commented on GitHub (Jul 15, 2018):

Understood! (Offhand, I think the tsutils approach may be more stable from a versioning POV so that extensions aren’t tied to a specific version of the library.)

<!-- gh-comment-id:405104610 --> @DavidAnson commented on GitHub (Jul 15, 2018): Understood! (Offhand, I think the tsutils approach may be more stable from a versioning POV so that extensions aren’t tied to a specific version of the library.)
Author
Owner

@byzyk commented on GitHub (Oct 29, 2018):

+1

While working on the custom rule I've found some of the shared helpers' methods quite handy. I had to copy/paste them but I think they should be accessible for everyone

<!-- gh-comment-id:433865905 --> @byzyk commented on GitHub (Oct 29, 2018): +1 While working on the custom rule I've found some of the shared helpers' methods quite handy. I had to copy/paste them but I think they should be accessible for everyone
Author
Owner

@DavidAnson commented on GitHub (Apr 13, 2019):

shared.js is now available as markdownlint-rule-helpers:
https://www.npmjs.com/package/markdownlint-rule-helpers

<!-- gh-comment-id:482858155 --> @DavidAnson commented on GitHub (Apr 13, 2019): shared.js is now available as `markdownlint-rule-helpers`: https://www.npmjs.com/package/markdownlint-rule-helpers
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#1961
No description provided.