backstage / mkdocs-monorepo-plugin

✚ Build multiple documentation folders in a single Mkdocs. Designed for large codebases.
https://backstage.github.io/mkdocs-monorepo-plugin/
Apache License 2.0
319 stars 74 forks source link

Avoid replacing dots for underscores in the documentation url. #116

Closed bitsondatadev closed 9 months ago

bitsondatadev commented 10 months ago

Many older documentation frameworks don't slugify the . character in the url. For us to migrate and use this tool, we had to skip this instance to avoid from breaking the versioned urls.

e.g. https://iceberg.apache.org/docs/1.2.0/

This new way will require folks to update their folder names to the url name if they are already using 1_2_0 but it will enable both options with this PR. I'm open to hearing a backwards compatible approach that needs to be switched on as well.

bih commented 9 months ago

Thanks for the PR! As you rightly mentioned, this is something that would break existing integrations. As I've not seen enough people raise this issue it feels unnecessary to introduce a breaking change. I will close this as won't fix for now for this reason, but would encourage you to create a fork to address your particular needs regarding the period .

bitsondatadev commented 8 months ago

@bih thanks for the response. I have done this for now, but I'd rather not have to maintain this if I don't have to. However, I understand if what I'm about to suggest is also not an option.

I am curious if you might consider me exposing a valid_slug_regex Mkdocs config.

Something like:

mkdocs.yml

plugins:
  - monorepo
     valid_slug_regex: '^[a-zA-Z0-9_\.\-/]+$'

plugin.py

class MonorepoPluginConfig(mkdocs.config.base.Config):
    valid_slug_regex = mkdocs.config.config_options.Type(str, default='^[a-zA-Z0-9_\-/]+$') # noqa: W605

class MonorepoPlugin(MonorepoPlugin[MonorepoPluginConfig]):

parser.py

    def getAlias(self):
        alias = self.navYaml["site_name"]
        regex = self.valid_slug_regex