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
329 stars 74 forks source link

Expose valid regex slug property for slugify call. #123

Open bitsondatadev opened 10 months ago

bitsondatadev commented 10 months ago

Could you consider exposing a valid_slug_regex Mkdocs config, to address the issue brought up in #116. This way we default to the existing hardcoded value.

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

Originally posted by @bitsondatadev in https://github.com/backstage/mkdocs-monorepo-plugin/issues/116#issuecomment-1884370024