Skip to content

Making getSlug available from outside of the packages #7961

Closed

Description

@JPeer264

Have you read the Contributing Guidelines on issues?

Motivation

We are trying to generate slugs / paths inside a remark plugin and wanted to rely on the way how docusaurus are doing these. We came across this function: https://github.com/facebook/docusaurus/blob/bf1513a3e357025ab1cf4cdb4c09f21316b31cfd/packages/docusaurus-plugin-content-docs/src/slug.ts#L24-L31

Which seems to generate the correct slugs and paths based on the input. The thing is that this function is not exported in the package.json: https://github.com/facebook/docusaurus/blob/bf1513a3e357025ab1cf4cdb4c09f21316b31cfd/packages/docusaurus-plugin-content-docs/package.json#L7-L12

Would it be alright to also add the entire lib in the package.json to get access to internal (e.g. adding "./lib/*": "./lib/*", to the package.json? Or move getSlug to @docusaurus/utils?

Self-service

  • I'd be willing to do some initial work on this proposal myself.

Activity

  1. added
    proposal
    status: needs triage
    on Aug 17, 2022
  2. Josh-Cena commented on Aug 17, 2022

    @Josh-Cena
    Collaborator

    Seems reasonable to make the entire library's files available via wildcards. Do you want to send a PR adding a "./lib/*": "./lib/*"?

    Important: This does not endorse these as public APIs. You are responsible for migrating any breakages between versions. You should probably not publish this as a package.

  3. removed
    status: needs triage
    on Aug 17, 2022
  4. JPeer264 commented on Aug 17, 2022

    @JPeer264
    ContributorAuthor

    Sure I will create a PR. We are aware that this is still a internal function without any guarantee - but thanks for double checking :)

  5. added a commit that references this issue on Aug 17, 2022
    2468136
  6. added a commit that references this issue on Aug 18, 2022
    c29218e
  7. added a commit that references this issue on Oct 28, 2022
    1163514
  8. added a commit that references this issue on Jun 25, 2026
    73b5b8b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions