Code Monkey home page Code Monkey logo

mkdocs-techdocs-core's Introduction

mkdocs-techdocs-core

This is the base Mkdocs plugin used when using Mkdocs with Spotify's TechDocs. It is written in Python and packages all of our Mkdocs defaults, such as theming, plugins, etc in a single plugin.

Package on PyPI

Usage

Requires Python version >= 3.8

$ pip install mkdocs-techdocs-core

Once you have installed the mkdocs-techdocs-core plugin, you'll need to add it to your mkdocs.yml.

site_name: Backstage Docs

nav:
  - Home: index.md
  - Developing a Plugin: developing-a-plugin.md

plugins:
  - techdocs-core

Development

Running Locally

You can install this package locally using pip and the --editable flag used for making developing Python packages.

pip install --editable .

You'll then have the techdocs-core package available to use in Mkdocs and pip will point the dependency to this folder.

Linting

We use black as our linter. Please run it against your code before submitting a pull request.

pip install black
black .

Note: This will write to all Python files in src/ with the formatted code. If you would like to only check to see if it passes, simply append the --check flag.

Testing Dependencies End-to-End

If you have made changes to the plugin itself, or updated a dependency it's strongly recommended to test the plugin.

To build a version of the spotify/techdocs docker image with your changes, run the below script in this repository:

./build-e2e-image.sh

The script is only tested on OSX

The script assumes that you have the image repository cloned in a sibling directory to this repository (or you can specify its location).

It will build an image called mkdocs:local-dev including the changes you have made locally. To test the image in backstage, edit the config (e.g. app-config.yaml) with the following:

techdocs:
  generator:
    runIn: "docker"
    dockerImage: "mkdocs:local-dev"
    pullImage: false

Release

  1. Update the Changelog.
  2. Bump up the version number in setup.py which triggers the release workflow on GitHub Actions to publish a new version in PyPI.

MkDocs plugins and extensions

The TechDocs Core MkDocs plugin comes with a set of extensions and plugins that mkdocs supports. Below you can find a list of all extensions and plugins that are included in the TechDocs Core plugin:

Plugins:

  • search: A search plugin is provided by default with MkDocs which uses lunr.js as a search engine.
  • mkdocs-monorepo-plugin: This plugin enables you to build multiple sets of documentation in a single MkDocs project. It is designed to address writing documentation in Spotify's largest and most business-critical codebases (typically monoliths or monorepos).

Extensions:

  • admonition: Admonitions, also known as call-outs, are an excellent choice for including side content without significantly interrupting the document flow. Material for MkDocs provides several different types of admonitions and allows for the inclusion and nesting of arbitrary content.

  • toc: The Table of Contents extension generates a Table of Contents from a Markdown document and adds it into the resulting HTML document. This extension is included in the standard Markdown library.

  • pymdown: PyMdown Extensions is a collection of extensions for Python Markdown. All extensions are found under the module namespace of pymdownx.

    • caret: Caret is an extension that is syntactically built around the ^ character. It adds support for inserting superscripts and adds an easy way to place text in an <ins> tag.
    • critic: Critic adds handling and support of Critic Markup.
    • details: Details creates collapsible elements with <details> and <summary> tags.
    • emoji: Emoji makes adding emoji via Markdown easy ๐Ÿ˜„.
    • superfences: SuperFences is like Python Markdown's fences, but better. Nest fences under lists, admonitions, and other syntaxes. You can even create special custom fences for content like UML.
    • inlinehilite: InlineHilite highlights inline code: from module import function as func.
    • magiclink: MagicLink linkafies URL and email links without having to wrap them in Markdown syntax. Also, shortens repository issue, pull request, and commit links automatically for popular code hosting providers. You can even use special shorthand syntax to link to issues, diffs, and even mention people
    • mark: Mark allows you to mark words easily.
    • smartsymbols: SmartSymbols inserts commonly used Unicode characters via simple ASCII representations: =/= โ†’ โ‰ .
    • highlight: Highlight allows you to configure the syntax highlighting of SuperFences and InlineHilite. Also passes standard Markdown indented code blocks through the syntax highlighter.
    • extra: Extra is just like Python Markdown's Extra package except it uses PyMdown Extensions to substitute similar extensions.
    • tabbed: Tabbed allows for tabbed Markdown content.
    • tasklist: Tasklist allows inserting lists with check boxes.
    • tilde: Tilde is syntactically built around the ~ character. It adds support for inserting subscripts and adds an easy way to place text in a <del> tag.
  • markdown_inline_graphviz: A Python Markdown extension replaces inline Graphviz definitions with inline SVGs or PNGs. Activate the inline_graphviz extension using the usage instructions.

  • plantuml_markdown: This plugin implements a block extension which can be used to specify a PlantUML diagram which will be converted into an image and inserted in the document.

    • Note that the format svg_object is not supported for rendering diagrams. Read more in the TechDocs troubleshooting section.
  • mdx_truly_sane_lists: An extension for Python-Markdown that makes lists truly sane. Features custom indents for nested lists and fix for messy linebreaks and paragraphs between lists.

Other plugins and extensions

Note that the above set of plugins and extensions represents an opinionated list providing a core set of functionality necessary for most technical documentation needs (hence: techdocs-core). PRs introducing new plugins or extensions are welcome, but they are not guaranteed to be accepted.

In order to solve your organization's specific needs, you're encouraged to install any necessary extensions/plugins in your own environment on top of techdocs-core (be it the TechDocs backend container, or a custom TechDocs build container).

Caveats

Theme

We only use material-mkdocs as base styles because Backstage also uses the Material UI on the client-side. We don't expect people to use themes other than Material UI to maintain consistency across all Backstage pages (in other words, documentation pages have the same look and feel as any other Backstage page) and so we use the BackstageTheme configured in Front-end application as the source of truth for all application design tokens like colors, typography and etc. So here you can see that some styles will always be overridden regardless of the mkdocs-material plugin theme settings and this can cause unexpected behavior for those who override the theme setting in a mkdocs.yaml file.

Changelog

Unreleased

1.3.5

  • Bumped mkdocs-material to 9.5.13 which adds support for card grids and grid layouts

1.3.3

  • Bumped mkdocs-material to 9.4.14 which add support for: Mermaid.js version 10.6.1, emoji extension and updated MkDocs to 1.5.3
  • Added tests for Python version 3.11

1.3.2

  • Bumped pymdown-extensions to 10.3.1 which add material.extensions support
  • Removed support for Python version 3.7

1.3.1

  • Bumped pygments to 2.17.2 which includes JSX support.

1.3

  • Bumped mkdocs-material (and its dependencies) from 9.1.3 to 9.2.7 causing a few changes:
    • MkDocs dependency is now 1.5
  • theme.palette is now hardcoded to {} instead of "" which caused some issues with some Material plugins

1.2.3

  • Bumped pygments to 2.16.1, which also fixes a vulnerability.
  • Update dependency plantuml-markdown to 3.9.2.

1.2.2

  • Added config override of pymdownx.snippets for security. restrict_base_path will always be true. If you currently use snippets with files outside of the directory, those files will no longer be included.

1.2.1

  • Use latest version of pymdown-extensions which contains security fixes.

1.2.0

  • Updated mkdocs-material (and its dependencies) from 8.1.11 to 9.1.3 causing a few changes:
    • Some mkdocs-material features were made opt-in v9. In order to preserve compatibility, they are now hardcoded as enabled by mkdocs-techdocs-core. The features are
      • navigation.footer
      • content.action.edit
    • theme.palette is now hardcoded to "" to preserve previous behavior. Without hardcoding the palette, it gets the value default, causing unwanted visual changes.
    • Some components e.g. admonitions have a slightly different look.
    • Minor color changes that can be avoided by also updating to the latest version of @backstage/plugin-techdocs which compensates these changes.

1.1.7

  • Updated mkdocs-monorepo-plugin to 1.0.4, which includes a compatibility fix for mkdocs versions 1.4.0 and newer.

1.1.6

  • Removed pins on the pyparsing and Jinja2 dependencies, which are no longer needed.
  • Pinned mkdocs-monorepo-plugin and markdown_inline_graphviz_extension to specific (latest) releases to improve stability. Going forward, these (along with all other feature-related deps) will be bumped regularly and any changes will be reflected in this changelog.

1.1.5

  • Added support for Python 3.10 #73
  • Resolved a run-time error introduced in 1.1.4 that prevented sites from being built under certain circumstances.

1.1.4

  • Support markdown version >3.2,<4
  • Use markdown_inline_graphviz_extension 1.1.1 which supports svg rendering for markdown >=3.3

1.1.3

  • Upgraded plantuml-markdown to 3.5.1, which removes uuid as a dependency.

1.1.2

  • Simplify theme code to update only the attribute necessary by backstage.

1.1.1

  • Fix run-time AttributeError: 'Theme' object has no attribute 'copy'

1.1.0

  • Add new capability to override mkdocs theme attributes

Note: Look the caveats section in readme about the Backstage theme consideration

1.0.2

  • Bumped pymdown-extensions to 9.3 and enabled pygments_lang_class to allow easier targeting of codeblocks by language in TechDocs Addons.

1.0.1

Jinja2 pinned to v3.0.3.

1.0.0

  • This package has been promoted to v1.0!

Note: Going forward, this package will follow semver conventions.

0.2.3

  • Upgrade mkdocs-material and its dependencies

0.2.2

  • Update plantuml-markdown version to 3.5.0 for image maps support

0.2.1

  • Fix run-time module 'pyparsing' has no attribute 'downcaseTokens' error as a result of shifting python dependencies.
  • Update to latest mkdocs-monorepo-plugin, which allows use of .yaml file extensions and non-slug-like site_names in monorepos.

0.2.0

0.1.2

  • Fix the dependency version of Markdown to ensure GraphViz SVG rendering works.

0.1.1

  • Ensure required mkdocs-monorepo-plugin is compatible with Mkdocs 1.2.x.

0.1.0

  • Improved dependency compatibility with other mkdocs plugins.
  • Upgraded mkdocs minimum to 1.2.2

0.0.16

  • Reused data from requirements.txt file in install_requires of setup.py. #24

0.0.15

  • Upgrade monorepo to track latest patch, includes various bug fixes. #22

0.0.14

  • Upgrade plantuml-markdown to 3.4.2 with support for external file sources. #18

0.0.13

  • Fixed issue where the whole temp directory could be included in the built site output. #7

0.0.12

0.0.11

  • Any MkDocs plugin configurations from mkdocs.yml will now work and override the default configuration. See backstage/backstage#3017

0.0.10

  • Pin Markdown version to fix issue with Graphviz

0.0.9

  • Change development status to 3 - Alpha

0.0.8

  • Superfences and Codehilite doesn't work very well together (squidfunk/mkdocs-material#1604) so therefore the codehilite extension is replaced by pymdownx.highlight
  • Uses pymdownx extensions v.7.1 instead of 8.0.0 to allow legacy_tab_classes config. This makes the techdocs core plugin compatible with the usage of tabs for grouping markdown with the following syntax:
    ```java tab="java 2"
        public void function() {
            ....
        }
    ```

as well as the new

    === "Java"

    ```java
    public void function() {
        ....
    }
    ```

The pymdownx extension will be bumped too 8.0.0 in the near future.

  • pymdownx.tabbed is added to support tabs to group markdown content, such as codeblocks.

  • "PyMdown Extensions includes three extensions that are meant to replace their counterpart in the default Python Markdown extensions." Therefore some extensions has been taken away in this version that comes by default from pymdownx.extra which is added now (https://facelessuser.github.io/pymdown-extensions/usage_notes/#incompatible-extensions)

0.0.7

  • Fix an issue with configuration of emoji support

0.0.6

  • Further adjustments to versions to find ones that are compatible

0.0.5

  • Downgrade some versions of markdown extensions to versions that are more stable

0.0.4

  • Added support for more mkdocs extensions
    • mkdocs-material
    • mkdocs-monorepo-plugin
    • plantuml-markdown
    • markdown_inline_graphviz_extension
    • pygments
    • pymdown-extensions

License

Copyright 2020-2023 ยฉ The Backstage Authors. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Usage page: https://www.linuxfoundation.org/trademark-usage

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

mkdocs-techdocs-core's People

Contributors

agentbellnorm avatar aladjadj avatar alexlorenzi avatar byan1197 avatar camilaibs avatar crevil avatar dependabot[bot] avatar emmaindal avatar hooloovooo avatar iamansoni avatar iameap avatar jairhenrique avatar jaroslawgajewski avatar johnphilip283 avatar jrusso1020 avatar kunickiaj avatar n2ygk avatar nickboldt avatar orkohunter avatar ottosichert avatar peawarrior avatar pjungermann avatar realandersn avatar renovate[bot] avatar ryanmrodriguez avatar satrox28 avatar soapraj avatar spier avatar squid-ney avatar stephane-mori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mkdocs-techdocs-core's Issues

Are all dependencies required if using Kroki?

We are using Kroki as part of our Backstage instance and have it deployed and available 'in cluster'.

Given that Kroki supports many diagram formats - I am wondering if PlantUML, Graphviz etc are required in the backstage container where mkdocs is running?

Currently they get installed by default when running:

pip3 install mkdocs-techdocs-core==1.2.1 mkdocs-kroki-plugin --no-cache-dir

But I am wondering if 'all' diagrams can be rendered by Kroki - can I remove these dependencies?

Mermaid Diagrams

Mermaid docs should be working with the Material for Mkdocs version that is in the techdocs container but they do not.

https://squidfunk.github.io/mkdocs-material/reference/diagrams/

I have added to my mkdocs.yml:

    - pymdownx.superfences:
        custom_fences:
          - name: mermaid
            class: mermaid
            format: !!python/name:pymdownx.superfences.fence_code_format

I have this in my doc:

  erDiagram
  entitlement {
   bigInt id
   timestamp iat
   varchar identifier
   jsonb result_set
}

I see this in Backstage:

image

Add a GH Action workflow to test this package against the latest mkdocs

What / Why

An incompatibility was introduced in mkdocs v1.4.0 that broke TechDocs that made use of the monorepo plugin. This was caught in an end-to-end test in the Backstage monorepo (backstage/backstage#13904). ...However it would be better to catch dependency incompatibility issues in this repo.

We should set up an action in this repository (ideally triggered anytime there is an mkdocs release, but if that's not possible, then perhaps just run daily) which attempts to build a fixture TechDocs site and runs some basic assertions on the output.

mkdocs and mkdocs-material updates

๐Ÿ‘‹ Hi, the project is currently configured with these versions

I understand the complexity of updating these core components and why they are pinned. HTML markup is not documented as public API, and this might break things (#66).
That being said, we are currently missing a lot of nice features and bugfixes.

What would be the best approach to update these dependencies?
Are there any automated regression tests, or specific issues to check.
Or does testing-dependencies-end-to-end is enough?

Bug: Issue with Liquid template in markdown caused by `markdown_inline_graphviz`

We are utilizing this plugin for our TechDocs generation for Backstage. We have a few markdown files with liquid templates nested in code blocks/fences, and they are being parsed as functions by what appears to be markdown_inline_graphviz per the below trace.

Example of a markdown block using this:

### Examples

```liquid
{% capture category %}{{ entity | property_value: 'Category' }}{% endcapture %}
{% if category == 'Pants' %}
  Resolution A
{% elsif category == 'Shoes' %}
  Resolution B
{% else %}
  Unknown
{% endif %}
```

Per the readme shouldn't this plugin be disabled unless I say to enable it?

[markdown_inline_graphviz](https://pypi.org/project/markdown-inline-graphviz/): A Python Markdown extension replaces inline Graphviz definitions with inline SVGs or PNGs. Activate the inline_graphviz extension using the [usage instructions](https://github.com/sprin/markdown-inline-graphviz#usage).

Our error:

verbose: [docker/mkdocs] ERROR    -  Error reading page 'public/guides/built-in-step-types.md': Command not supported: else
verbose: [docker/mkdocs] Traceback (most recent call last):
verbose: [docker/mkdocs]   File "/usr/local/bin/mkdocs", line 8, in <module>
verbose: [docker/mkdocs]     sys.exit(cli())
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
verbose: [docker/mkdocs]     return self.main(*args, **kwargs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1055, in main
verbose: [docker/mkdocs]     rv = self.invoke(ctx)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
verbose: [docker/mkdocs]     return _process_result(sub_ctx.command.invoke(sub_ctx))
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
verbose: [docker/mkdocs]     return ctx.invoke(self.callback, **ctx.params)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
verbose: [docker/mkdocs]     return __callback(*args, **kwargs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs/__main__.py", line 181, in serve_command
verbose: [docker/mkdocs]     serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 63, in serve
verbose: [docker/mkdocs]     config = builder()
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 58, in builder
verbose: [docker/mkdocs]     build(config, live_server=live_server, dirty=dirty)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/build.py", line 292, in build
verbose: [docker/mkdocs]     _populate_page(file.page, config, files, dirty)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs/commands/build.py", line 174, in _populate_page
verbose: [docker/mkdocs]     page.render(config, files)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs/structure/pages.py", line 175, in render
verbose: [docker/mkdocs]     self.content = md.convert(self.markdown)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/markdown/core.py", line 261, in convert
verbose: [docker/mkdocs]     self.lines = prep.run(self.lines)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/markdown_inline_graphviz.py", line 68, in run
verbose: [docker/mkdocs]     raise Exception('Command not supported: %s' % command)
verbose: [docker/mkdocs] Exception: Command not supported: else

Our mkdocs.yml:

...
plugins:
  - techdocs-core

I opened this issue but I don't think it is a specific mkdocs issue mkdocs/mkdocs#3067

Also of note, if I remove plugins from our config file and run npx @techdocs/cli serve -v the error goes away (although the resulting documentation is blank, which I imagine is due to removing all plugins.)

Dependency version bumps

When will there be dependency version bumps? Specifically:

mkdocs-material
pygments
pymdown-extensions

There is another issue open about material but it seemed like a more generic one was warranted. The material version bump was requested 10 months ago. Is this project dead?

techdocs-core breaks livereload

Hei,

I am not able to run mkdocs through techdocs-cli. It works if I directly run mkdocs serve --no-livereload or if I comment out the techdocs-core plugin. So I assume the plugin somehow breaks the livereload.

This is the error:

techdocs-cli serve --verbose --no-docker
info: Starting mkdocs server.
verbose: [mkdocs] INFO     -  Building documentation...
verbose: [mkdocs] INFO     -  Cleaning site directory
verbose: [mkdocs] INFO     -  Documentation built in 0.32 seconds
verbose: [mkdocs] Traceback (most recent call last):
verbose: [mkdocs]   File "/usr/bin/mkdocs", line 33, in <module>
verbose: [mkdocs]     sys.exit(load_entry_point('mkdocs==1.2.2', 'console_scripts', 'mkdocs')())
verbose: [mkdocs]   File "/usr/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
verbose: [mkdocs]     return self.main(*args, **kwargs)
verbose: [mkdocs]   File "/usr/lib/python3.9/site-packages/click/core.py", line 1062, in main
verbose: [mkdocs]     rv = self.invoke(ctx)
verbose: [mkdocs]   File "/usr/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
verbose: [mkdocs]     return _process_result(sub_ctx.command.invoke(sub_ctx))
verbose: [mkdocs]   File "/usr/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
verbose: [mkdocs]     return ctx.invoke(self.callback, **ctx.params)
verbose: [mkdocs]   File "/usr/lib/python3.9/site-packages/click/core.py", line 763, in invoke
verbose: [mkdocs]     return __callback(*args, **kwargs)
verbose: [mkdocs]   File "/usr/lib/python3.9/site-packages/mkdocs/__main__.py", line 173, in serve_command
verbose: [mkdocs]     serve.serve(dev_addr=dev_addr, livereload=livereload, **kwargs)
verbose: [mkdocs]   File "/usr/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 78, in serve
verbose: [mkdocs]     server = config['plugins'].run_event('serve', server, config=config, builder=builder)
verbose: [mkdocs]   File "/usr/lib/python3.9/site-packages/mkdocs/plugins.py", line 94, in run_event
verbose: [mkdocs]     result = method(item, **kwargs)
verbose: [mkdocs]   File "/home/roman/.local/lib/python3.9/site-packages/mkdocs_monorepo_plugin/plugin.py", line 80, in on_serve
verbose: [mkdocs]     server.watch(self.originalDocsDir)
verbose: [mkdocs]   File "/usr/lib/python3.9/site-packages/mkdocs/livereload/__init__.py", line 68, in watch
verbose: [mkdocs]     path = os.path.abspath(path)
verbose: [mkdocs]   File "/usr/lib/python3.9/posixpath.py", line 374, in abspath
verbose: [mkdocs]     path = os.fspath(path)
verbose: [mkdocs] TypeError: expected str, bytes or os.PathLike object, not NoneType

Versions:

  • techdocs-cli 0.7.0
  • mkdocs 1.2.2
  • mkdocs-techdocs-core 0.1.2

on Arch linux

Thanks

Incompatible with latest mkdocs-material

Because no versions of mkdocs-techdocs-core match >0.1.2,<0.2.0 and mkdocs-techdocs-core (0.1.2) depends on mkdocs-material (5.3.2), mkdocs-techdocs-core (>=0.1.2,<0.2.0) requires mkdocs-material (5.3.2).
So, because the-book depends on both mkdocs-material (^7.2.6) and mkdocs-techdocs-core (^0.1.2), version solving failed.

.md has not been committed yet.

When using this plugin, after I run mkdocs serve I see lots of items like this:

WARNING  -  [git-authors-plugin] /var/folders/tx/70b5q3m12jlgdh99r1_lrhk40000gq/T/docs_ukqcwa9j/dir/filename.md has not been committed yet.
            Lines are not counted

and then once the site is generated it shows this:

INFO     -  [17:46:39] Watching paths for changes: '/var/folders/tx/70b5q3m12jlgdh99r1_lrhk40000gq/T/docs_xwmc2ydi', 'mkdocs.yml', 'docs'

For some reason it's creating a whole new path for things when it should not. Without this plugin it normally shows:

INFO     -  [17:48:51] Watching paths for changes: 'docs', 'mkdocs.yml'

Please let me know if you need more information.

GraphViz Diagrams are not rendering correctly in version 0.1.1

It appears that GraphViz diagrams do not render correctly in the current version. They render correctly with older versions e.g. 0.0.16.

Steps to reproduce

Workaround

  • Diagrams render correctly using the older docker image techdocs-cli serve -i spotify/techdocs:v0.2.2 (which corresponds to v0.0.16)

Caveats
I'm assuming the issue is here an not to do with the graphviz binary( I haven't checked if the installed version is different).

Add clarify for base requirements for e.g. Python version

Was having some problems with this plugin. Took me a little digging, and then discovered this:

python_requires=">=3.7",

Turns out my Ubuntu image I was using was Python 3.6. The error message wasn't super clear:

$ pip3 install mkdocs-techdocs-core
Collecting mkdocs-techdocs-core
  Could not find a version that satisfies the requirement mkdocs-techdocs-core (from versions: )
No matching distribution found for mkdocs-techdocs-core

Until I ran verbose and noticed this,

$ pip3 --verbose install mkdocs-techdocs-core
... snip ...
    The package https://files.pythonhosted.org/packages/2b/30/511099594d5128c13f703daef2d4770517f7433f8cc7593b58932ed3c0f4/
mkdocs_techdocs_core-0.0.13-py3-none-any.whl#sha256=fcb512088d3b4768ea002ff903b433ff89b08a30cce0139693cf36cca23ed50a
(from https://pypi.org/simple/mkdocs-techdocs-core/) (requires-python:>=3.7)
is incompatible with the pythonversion in use. Acceptable python versions are:>=3.7
  Could not find a version that satisfies the requirement mkdocs-techdocs-core (from versions: )
Cleaning up...
No matching distribution found for mkdocs-techdocs-core
... snip ...

So just to help avoid any challenges, a little section identifying this might be super helpful on the README just to help eliminate some challenges/save some people time. I saw something similar on the techdocs core monorepo plugin.

Off to upgrade to Python 3.9 now... ๐Ÿ˜
Thanks!

Incompatibilities with pymdown-extensions 8.2

I would like to use some of the new visual components pymdown-extensions 8.2 is providing. I tried to update via:

pip3 install pymdown-extensions --upgrade

The output was:

...
Collecting pymdown-extensions
  Using cached pymdown_extensions-8.2-py3-none-any.whl (207 kB)
...
Installing collected packages: pymdown-extensions
  Attempting uninstall: pymdown-extensions
    Found existing installation: pymdown-extensions 7.1
    Uninstalling pymdown-extensions-7.1:
      Successfully uninstalled pymdown-extensions-7.1
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
mkdocs-techdocs-core 0.1.0 requires pymdown-extensions==7.1, but you have pymdown-extensions 8.2 which is incompatible.
Successfully installed pymdown-extensions-8.2

After running mkdocs serve with the techdocs-core plugin enabled, I received:

Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/__main__.py", line 173, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 54, in serve
    config = builder()
  File "/usr/local/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 49, in builder
    build(config, live_server=live_server, dirty=dirty)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 284, in build
    _populate_page(file.page, config, files, dirty)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 174, in _populate_page
    page.render(config, files)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/structure/pages.py", line 170, in render
    md = markdown.Markdown(
  File "/usr/local/lib/python3.9/site-packages/markdown/core.py", line 96, in __init__
    self.registerExtensions(extensions=kwargs.get('extensions', []),
  File "/usr/local/lib/python3.9/site-packages/markdown/core.py", line 123, in registerExtensions
    ext = self.build_extension(ext, configs.get(ext, {}))
  File "/usr/local/lib/python3.9/site-packages/markdown/core.py", line 177, in build_extension
    return module.makeExtension(**configs)
  File "/usr/local/lib/python3.9/site-packages/pymdownx/superfences.py", line 980, in makeExtension
    return SuperFencesCodeExtension(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/pymdownx/superfences.py", line 240, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/markdown/extensions/__init__.py", line 40, in __init__
    self.setConfigs(kwargs)
  File "/usr/local/lib/python3.9/site-packages/markdown/extensions/__init__.py", line 71, in setConfigs
    self.setConfig(key, value)
  File "/usr/local/lib/python3.9/site-packages/markdown/extensions/__init__.py", line 59, in setConfig
    if isinstance(self.config[key][0], bool):
KeyError: 'legacy_tab_classes'

Support PymDown Snippets

I'm not 100% if Snippets is supported or not. It's not in the list of Pymdown extensions in the Readme. I have tried it but it seems to fail on the url_download option. Can support be added? This is a supper useful extension.

   - pymdownx.snippets:
          check_paths: true
          url_download: true
          url_request_headers: [{ Authorization: "Bearer xxxxxxxxxxxxxxxx"}]
verbose: [docker/mkdocs] ERROR    -  Config value 'markdown_extensions': Failed to load extension 'pymdownx.snippets'.
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 896, in run_validation
verbose: [docker/mkdocs]     md.registerExtensions((ext,), self.configdata)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/markdown/core.py", line 123, in registerExtensions
verbose: [docker/mkdocs]     ext = self.build_extension(ext, configs.get(ext, {}))
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/markdown/core.py", line 177, in build_extension
verbose: [docker/mkdocs]     return module.makeExtension(**configs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/pymdownx/snippets.py", line 198, in makeExtension
verbose: [docker/mkdocs]     return SnippetExtension(*args, **kwargs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/pymdownx/snippets.py", line 183, in __init__
verbose: [docker/mkdocs]     super(SnippetExtension, self).__init__(*args, **kwargs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/markdown/extensions/__init__.py", line 40, in __init__
verbose: [docker/mkdocs]     self.setConfigs(kwargs)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/markdown/extensions/__init__.py", line 71, in setConfigs
verbose: [docker/mkdocs]     self.setConfig(key, value)
verbose: [docker/mkdocs]   File "/usr/local/lib/python3.8/site-packages/markdown/extensions/__init__.py", line 59, in setConfig
verbose: [docker/mkdocs]     if isinstance(self.config[key][0], bool):
verbose: [docker/mkdocs] KeyError: 'url_download'
verbose: [docker/mkdocs] Aborted with 1 Configuration Errors!

C4 ComponentQueue from PlantUML stdlib causing syntax error

I'm using v1.2.0 of mkdocs-techdocs-core to render a C4 UML diagram coded in PlantUML; everything is going great with Context and Container diagrams, but when I create Component diagrams, Backstage fails to render them if they contain a ComponentQueue macro. I'm currently using the JetBrains Rider IDE, and the UML renders okay with their plugin, same for www.planttext.com, so there's nothing obviously wrong with my syntax per se - just something specific to the ComponentQueue when rendered within Backstage.

My UML is as follows:

@startuml
'ref http://plantuml.com/stdlib
!include <C4/C4_Component>

title Component diagram for ReadyTech STP API

Boundary(stp, "STP") {

    Boundary(stpEtl, "STP ETL", ".NET Core") {
  
        Component(messages, "MessageHandler", ".NET Core", "Handles messages received from the queue")
        Component(lodgements, "PayrollEventSubmissions", ".NET Core", "Transforms submissions to ATO format")
        Component(queries, "PayrollEventQueries", ".NET Core", "Queries the status of lodged submissions")
        Component(sdk, "StpMessageService", ".NET Core", "Communicates with the ATO SDK")
    }

    ComponentDb(db, "stp-db01", "SQL Server", "Stores client and payroll event details.")
    Component(s3, "stp-data", "AWS S3", "Stores XML requests sent to and responses received from the ATO.")
    ComponentQueue(sqs, "submissions")
}
@enduml

and this is the output seen in Backstage:

image

As you can see, the macros for Component and ComponentDb are all successfully converted into the appropriate rectangle and database objects, but it fails on the ComponentQueue

module 'pyparsing' has no attribute 'downcaseTokens'

As of few days ago, my unchanged dockerfile for backstage started failing on all TechDoc page rendering. I have the mkdocs-techdocs-core 0.2.0 as part of my core backstage deployment.
It throws:

ERROR    -  Error reading page 'index.md': module 'pyparsing' has no attribute 'downcaseTokens'
Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 10, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/mkdocs/__main__.py", line 187, in build_command
    build.build(config.load_config(**kwargs), dirty=not clean)
  File "/usr/local/lib/python3.7/dist-packages/mkdocs/commands/build.py", line 292, in build
    _populate_page(file.page, config, files, dirty)
  File "/usr/local/lib/python3.7/dist-packages/mkdocs/commands/build.py", line 174, in _populate_page
    page.render(config, files)
  File "/usr/local/lib/python3.7/dist-packages/mkdocs/structure/pages.py", line 172, in render
    extension_configs=config['mdx_configs'] or {}
  File "/usr/local/lib/python3.7/dist-packages/markdown/core.py", line 96, in __init__
    configs=kwargs.get('extension_configs', {}))
  File "/usr/local/lib/python3.7/dist-packages/markdown/core.py", line 122, in registerExtensions
    ext = self.build_extension(ext, configs.get(ext, {}))
  File "/usr/local/lib/python3.7/dist-packages/markdown/core.py", line 161, in build_extension
    module = importlib.import_module(ext_name)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load

My dockerfile:

FROM node:14-buster-slim
WORKDIR /app

RUN apt update && apt install -y python3 python3-pip
RUN pip3 install mkdocs-techdocs-core==0.2.0

COPY yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
RUN tar xzf skeleton.tar.gz && rm skeleton.tar.gz
RUN yarn install --frozen-lockfile --production --network-timeout 300000 && rm -rf "$(yarn cache dir)"
COPY packages/backend/dist/bundle.tar.gz app-config.yaml ./
RUN tar xzf bundle.tar.gz && rm bundle.tar.gz

RUN rm -rf /var/cache/apt/archives
CMD ["node", "packages/backend", "--config", "app-config.yaml"]

Exact same issue as in: #httplib2/httplib2/issues/207

If I pin down pyparsing like:

RUN pip3 install mkdocs-techdocs-core==0.2.0
RUN pip3 install pyparsing==2.4.7

Then it works again - but not for UML plugin, which starts to fail as below:

ERROR    -  Error reading page 'extensions.md': Failed to run plantuml: [Errno 2] No such file or directory: 'plantuml': 'plantuml'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/plantuml_markdown.py", line 268, in _render_local_uml_image
    p = Popen(cmdline, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=(os.name == 'nt'))
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'plantuml': 'plantuml'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 10, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1053, in main

It seems pyparsing has had this change: httplib2/httplib2#207 (comment) which causes, or contributes to this!

pinned versions in requirements.txt are too constraining

The pinned versions in requirements.txt are too constraining when pulled into setup.py. Specifically, Markdown==3.2.2 is out of date and causes a conflict if one tries to use mkdocs-techdocs-core in conjunction with mkdocstrings:

The conflict is caused by:
    The user requested Markdown==3.2.2
    mkdocs-techdocs-core 0.0.16 depends on Markdown==3.2.2
    mkdocstrings 0.15.2 depends on Markdown<4.0 and >=3.3

It does not appear that this pinned version is necessary.

Non Breaking Space (NBSP) in SVG breaks image rendering

I regularly create SVGs using diagrams.net, which often includes non breaking space characters (shown by IDEs as NBSP). When these characters occur somewhere in the SVG, the entire image is not rendered.

MkDocs does not have this issue, when running mkdocs serve locally, the image is rendered properly.

Describe the different extensions and plugins included in TechDocs Core

We currently have a list of supported extension and plugins you get by default by using the TechDocs Core plugin.

This list could include a short description of the extension and how you can use it to give the users a clear understanding of the different extensions and plugins the techdocs core plugin supports, without having to go and read the official documentation for it.

Version 1.1.0 breaks with my docs

Hello,

my pipeline stopped working as soon as started using 1.1.0.

This is the traceback
Traceback (most recent call last):
  File "xxx/venv/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "xxx//venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "xxx/venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "xxx//venv/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "xxx/venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "xxx/venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "xxx/venv/lib/python3.10/site-packages/mkdocs/__main__.py", line 192, in build_command
    build.build(config.load_config(**kwargs), dirty=not clean)
  File "xxx/venv/lib/python3.10/site-packages/mkdocs/commands/build.py", line 257, in build
    config = config['plugins'].run_event('config', config)
  File "xxx//venv/lib/python3.10/site-packages/mkdocs/plugins.py", line 102, in run_event
    result = method(item, **kwargs)
  File "/Users/gabriele/jimdo/aws-msk-engineering/venv/lib/python3.10/site-packages/src/core.py", line 49, in on_config
    theme_override = config["theme"].copy()
AttributeError: 'Theme' object has no attribute 'copy'

my mkdocs.yml looks like this

site_name: My docs
site_description: Documentation for my project
plugins:
  - techdocs-core

markdown_extensions:
  - toc:
      permalink: "#"

nav:
 - Overview: overview.md
 - User Guide: user_guide.md

Reverting to 1.0.2 solved the problem

Support Mermaid diagrams at build-time

Mermaid is a diagramming and visualization library similar to graphviz. It has an MkDocs plugin.

Some companies who are adopting TechDocs will already have large numbers of Mermaid diagrams in existing MkDocs documents, and would like them to work in TechDocs, without forking the mkdocs-techdocs-core and maintaining new TechDocs containers which use the modified core.

Would it be agreeable to add this plugin to TechDocs? We would, of course, do the work to implement this.

techdocs plugin is conflicting with mkdocstrings

Hi,

I'm trying to use techdocs-core plugin with mkdocstrings, but they're conflicting. I can't use them together.

verbose: handler = self._handlers.get_handler(handler_name, handler_config)
  File "/opt/github-actions/.local/lib/python3.10/site-packages/mkdocstrings/handlers/base.py", line 458, in get_handler
    module = importlib.import_module(f"mkdocstrings_handlers.{name}")
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
verbose: File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
verbose: File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'mkdocstrings_handlers'

But when I build the doc with using pure mkdocs build it is rendered properly and builder properly. It's looks like some internal conflict in techdocs-core plugin, because this cmd is failing:

techdocs-cli generate --no-docker --verbose  

Search bar does not render on 1.2.0 (requires revert to 1.1.7)

I noticed for docs built using mkdocs the search bar does not appear and these errors appear in the console

reportUnhandledError.ts:21 Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute')
    at index.ts:100:26
    at map.ts:58:33
    at c._next (OperatorSubscriber.ts:70:13)
    at t.next (Subscriber.ts:75:12)
    at mergeInternals.ts:85:24
    at c._next (OperatorSubscriber.ts:70:13)
    at t.next (Subscriber.ts:75:12)
    at e._subscribe (innerFrom.ts:78:18)
    at e._trySubscribe (Observable.ts:244:19)
    at Observable.ts:234:18
main.js:106 Uncaught ReferenceError: base_url is not defined
    at main.js:106:41

To workaround this and be able to use search again, I simply downgraded to the previous version

pip3 install mkdocs-techdocs-core==1.1.7

I suspect the issue is mkdocs-material-9.1.3. When reverting the techdocs-core plugin it causes it to uses mkdocs-material-8.1.11 and that works fine.

Enable extension to include other files

Sometimes it's useful to manage larger source code examples in separate files. For this, the snippet extension exists. TechDocs Core could include this extension by default.

Example

--8<-- "test.ts"

Workaround

You can already load the extension by adding the following snippet to your mkdocs.yml:

โ€ฆ

markdown_extensions:
  - pymdownx.snippets

`src` should not be a published package name

Installing mkdocs-techdocs-core puts the src packaged in the .venv.

image

src is just a generic name that should be used by any published package. It can cause random errors by conflicting with other packages available in the PYTHONPATH. I suggest you change the name to something meaningful to this project.

Example: our own source code is placed under src. By running mkdocs serve with the techdocs plugin installed we get the following error:

Traceback (most recent call last):
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/mkdocs/__main__.py", line 234, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 78, in serve
    config = get_config()
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/mkdocs/config/base.py", line 363, in load_config
    errors, warnings = cfg.validate()
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/mkdocs/config/base.py", line 228, in validate
    run_failed, run_warnings = self._validate()
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/mkdocs/config/base.py", line 186, in _validate
    self[key] = config_option.validate(value)
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 147, in validate
    return self.run_validation(value)
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 939, in run_validation
    self.load_plugin_with_namespace(name, cfg)
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 975, in load_plugin_with_namespace
    return (name, self.load_plugin(name, config))
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/mkdocs/config/config_options.py", line 993, in load_plugin
    plugin_cls = self.installed_plugins[name].load()
  File "/Users/roelschr/Workspace/feature-store/feature_repo/.venv/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 209, in load
    module = import_module(match.group('module'))
  File "/Users/roelschr/.pyenv/versions/3.8.12/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'src.core'

This makes it impossible for us to use other plugins like mkdocstrings and mkdocs-click.

Support browse versions of component

It would be great to have a plugin/extension that would allow browsing between different versions of the same component. For example, through a dropdown that allows you to select the desired branch/tag of the source repo.

Something similar to this.

bug: not working with markdown_extensions : md_in_html

Bug: Should remove trailing whitespace in HTML tags.

site_name: test

nav:
  - 'index.md'

plugins:
  - techdocs-core
markdown_extensions:
  - md_in_html

I have markdown content inside HTML tag.
For example, the following:

<div markdown="1">

This is a *Markdown* Paragraph.

</div>

...is rendered as:

<div>
<p>This is a <em>Markdown</em> Paragraph.</p>
</div>

However, it breaks when there's trailing whitespace

For example, the following:

<div markdown = "1">

This is a *Markdown* Paragraph.

</div>

...is rendered as:

<div>
<p>= "1"&gt;</p>
<p>This is a <em>Markdown</em> Paragraph.</p>
</div>

Expected behavior:

Should be rendered as:

<div>
<p>This is a <em>Markdown</em> Paragraph.</p>
</div>

Context:

techdocs-cli --version 0.7.0

Note

This seems not to be a bug of mkdocs. If I run mkdocs:serve (version 1.2.2), I get the expected behaviour.
Only happens if I run techdocs-cli serve:mkdocs

Support to include multiple repos for mkdocs-monorepo-plugin

Currently we use this container for our backstage instance.
One of the drawback we have is that there is support for only two plugins search and mono repo.
With mono repo plugin, it currently doesn't allow us to refer to the mkdocs.yaml from different repos.

Do you have plans to support either
1>plugins such as mkdocs-multirepo-plugin
2>different repo's under mkdocs-monorepo-plugin

pymdown-extensions vunerability

GitHub dependabot is detecting a critical vulnerability in the version of pymdown-extensions that is currently bundled with mkdocs-techdocs-core.

See GHSA-jh85-wwv9-24hv for details

Please update to the latest 10.x version which resolves the vulnerability.

Left navigation gets stepped on with mkdocs-material blog feature, for full blog posts, at wide resolution

I'm using the new 1.3 version of this plugin, which enables the mkdocs-material blog plugin.

My mkdocs.yaml file looks like this:

site_name: 'Internal Blog for Bob Cotton'

theme:
  name: material
  features:
    - navigation.sections
nav:
  - Home: 'index.md'
  - Blog:
     - 'blog/index.md'

plugins:
  - techdocs-core
  - blog:
      post_url_format: "{date}/{slug}"

When the site get rendered, both under our backstage instance, and using techdocs-cli everything looks great, The nav on the left is correct. All the blog features are working.

Except when you drill down into a full blog post ("continue reading" or click on a post header) and you have your screen resolution fairly wide (anything wider than when the hamburger gets rendered on the right side)

When looking at the list of posts, the left nav is great:

CleanShot 2023-12-06 at 09 05 35@2x

However, when you select, or link directly to a post, the left-hand navigation get smashed into the content. e.g.

CleanShot 2023-12-06 at 09 22 09@2x

When run under the techdocs-core container, without the backstage wrapper, it looks like this:

CleanShot 2023-12-06 at 11 17 37@2x

I've created a repo with content and instructions to reproduce the issue
https://github.com/bcotton/techdocs-blog-testing

Not a front-end dev, so poking in the dark here, however, Looking at chrome dev-tools, if I disable

.md-sidebar {
  position: fixed;
}

Then it's lays out correctly

CleanShot 2023-12-06 at 11 20 21@2x

Code annotations fail to render with `techdocs-core` plugin enabled

Something techdocs-core is doing (maybe setting theme.palette to ''?) prevents code annotations from rendering.

Reproduction:

python3.11 -m venv .venv
source .venv/bin/activate
pip install mkdocs-techdocs-core
mkdir docs

mkdocs.yml:

site_name: Backstage Docs
theme:
  name: material
  features:
    - content.code.annotate
nav:
  - Home: index.md
markdown_extensions:
  - pymdownx.superfences

docs/index.md:

```yaml
# (1)
```

1. An annotation
mkdocs build
open site/index.html # You should see a clickable annotation
yq -i '.plugins[0] = "techdocs-core"' mkdocs.yml
mkdocs build
open site/index.html # You should not see an annotation

Without techdocs:
Screenshot 2023-06-08 at 3 54 20 PM

With it:
Screenshot 2023-06-08 at 3 54 24 PM

I noticed that if I have no plugins set, and set theme.palette to "", then annotations also fail to render. So I think this might be causing it, but don't see an easy fix.

Strict Requirement pinnings

Great work on this project!

I am wondering if the requirement pins in your dependency chain are all hard requirements? We are trying to use mkdocstrings in conjunction with this package for a Python 3.9 application and are getting a conflict on Markdown stemming from here: https://github.com/backstage/mkdocs-techdocs-core/blob/main/requirements.txt#L12. Is it true that you are not currently supporting latter versions of the Markdown package? Or was this possibly an overly conservative pinning?

Allow Disabling Monorepo plugin

Hi all,

Would you be happy with a pull request which added an option to disable inclusion of the monorepo plugin? It is known to cause complications when it comes to several other plugins - such as git-revision-date-localized - and to my understand is often not required.

Extensions not being applied

Im trying to add progress bar to my mkdocs (following this documentation https://facelessuser.github.io/pymdown-extensions/extensions/progressbar/)

Added attr_list, md_in_html and. pymdownx.progressbar extensions in the src/core.py

config["markdown_extensions"].append("pymdownx.progressbar")
config["markdown_extensions"].append("attr_list")
config["markdown_extensions"].append("md_in_html")

I also installed it using

pip install --editable .

and I used techdoc-cli to generate --no-docker but I dont see progress bar

Extra Characters added with mkdocs-autolinks-plugin

We have a use for using mkdocs-autolinks-plugin as it makes it easier to create inter site links without having to build ../../.. paths or typing out full URL paths.

When deploying our mkdocs site to Backstage, for some reason, the generated URL for some reasons comes with some extra items in the path that is not existent.

For example:

![Image](siteicon.png)

gets generated as this locally:

![Image](../images/siteicon.png)

but gets generated as in Backstage:

![Image](../../../../../tmp/docs_veebg344/images/siteicon.png)

Not sure if this is an issue with this plugin or with mkdocs-autolinks-plugin so I also have an issue filed there just in case.

Running a build with this plugin includes a pile of files from /System/Volumes/Data/private

I'm running macOS Big Sur.

my mkdocs.yml looks like this:

site_name: Garden Docs

nav:
  - Garden: garden/README.md
  - Garden Guide:
      - Setup: garden/00-setup.md
      - Remote Deployment: garden/01-remote-deployment.md
      - Remote Debugging: garden/02-remote-debugging.md
      - Adding A Module: garden/03-adding-a-module.md
      - Working With Garden: garden/04-working-with-garden.md
      - Known Issues: garden/05-known-issues.md
      - Cheatsheet: garden/06-cheatsheet.md
      - Compose To Garden Translation: garden/07-compose-to-garden-translation.md
      - Configuring Cluster: garden/08-configuring-cluster.md
      - Garden Ms Scaffold Explained: garden/09-garden-ms-scaffold-explained.md
      - Hot Reload: garden/10-hot-reload.md
  - Config: config.md
  - Docker Compose: docker-compose.md
  - Local Dev: local-dev.md
  - Packages: packages.md
  - Service Checklist: service-checklist.md

plugins:
  - techdocs-core

my filesystem tree looks like this:

.
โ”œโ”€โ”€ docs
โ”‚ย ย  โ”œโ”€โ”€ config.md
โ”‚ย ย  โ”œโ”€โ”€ docker-compose.md
โ”‚ย ย  โ”œโ”€โ”€ garden
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 00-setup.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 01-remote-deployment.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 02-remote-debugging.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 03-adding-a-module.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 04-working-with-garden.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 05-known-issues.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 06-cheatsheet.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 07-compose-to-garden-translation.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 08-configuring-cluster.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 09-garden-ms-scaffold-explained.md
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ 10-hot-reload.md
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ README.md
โ”‚ย ย  โ”œโ”€โ”€ local-dev.md
โ”‚ย ย  โ”œโ”€โ”€ packages.md
โ”‚ย ย  โ””โ”€โ”€ service-checklist.md
โ””โ”€โ”€ mkdocs.yml

upon building the docs with mkdocs build I get a lot of extraneous files

ls site
1E14906B-48F0-438B-B9F7-08FACA104585-lockscreen.png UpdateRingSettings.json                             local-dev
3CC215AE-598C-438D-B546-9BC231A6E374                assets                                              mat-debug-6273.log
3EA6F623-B3B8-4102-9EE3-CAB246C6AA2C                com.apple.Music                                     mat-debug-7205.log
404.html                                            com.apple.Safari                                    model.lock
5e84410f27304d289f168a76d51b240a.db                 com.apple.stocks.widget                             packages
5e84410f27304d289f168a76d51b240a.db-shm             com.microsoft.Outlook                               search
5e84410f27304d289f168a76d51b240a.db-wal             com.microsoft.teams Crashes                         service-checklist
5e84410f27304d289f168a76d51b240a.db.ses             config                                              sitemap.xml
ElixirSublime.log                                   docker-compose                                      sitemap.xml.gz
GitGutter.501                                       garden                                              techdocs_metadata.json
OneDriveVersion.xml                                 lghub Crashes                                       v8-compile-cache-501
TelemetryUploadFilecom.microsoft.autoupdate.fba.txt lghub_agent_instance_lock                           xcrun_db

I have isolated it to this plugin. Running the above docs with just the monorepo plugin or no plugins at all yields the expected filesystem structure

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.