Package: tier-mkdocs-techdocs-core
tier-mkdocs-techdocs-coreThis is the baseMkdocsplugin used at TIER Mobility with Spotify'sTechDocs. It is forked from theBackstage core plugin.UsageRequires Python version >= 3.7$pipinstalltier-mkdocs-techdocs-coreOnce you have installed thetier-mkdocs-techdocs-coreplugin, you'll need to add it to yourmkdocs.yml.site_name:Backstage Docsnav:-Home:index.md-Developing a Plugin:developing-a-plugin.mdplugins:-tier-techdocs-coreDevelopmentRunning LocallyYou can install this package locally usingpipand the--editableflag used for making developing Python packages.pipinstall--editable.You'll then have thetier-techdocs-corepackage available to use in Mkdocs andpipwill point the dependency to this folder.LintingWe useblackas our linter. Please run it against your code before submitting a pull request.pipinstallblack
black.Note:This will write to all Python files insrc/with the formatted code. If you would like to only check to see if it passes, simply append the--checkflag.Testing Depedencies End-to-EndMuch of the value of this plugin lies in its dependencies, on which there are
implicit dependencies upstream in the Backstage TechDocs frontend plugin. Each
time you update a pinned dependency, it's important to test that generated
documentation can be loaded and parsed as expected in the Backstage frontend.
The recommended way to do so is the following:Make the expected dependency change locally inrequirements.txt.Clone thetechdocs-containerimage and, within the cloned directory, copy the entire contents of your
local version oftier-mkdocs-techdocs-core, e.g. namedlocal-mkdocs-techdocs-core.Just before theRUN pip installcommand intechdocs-container's
Dockerfile, add aCOPYcommand that copies the contents of your modifiedtier-mkdocs-techdocs-coredirectory into the container's file system. Something
like:COPY ./local-mkdocs-techdocs-core/ /local-mkdocs-techdocs-core/Modify theRUN pip install... command to install an editable version of
the copied local plugin, rather than the specific version. Something like...RUN pip install --upgrade pip && pip install -e /local-mkdocs-techdocs-coreBuild the modified image:docker build -t mkdocs:local-dev .Modify your local Backstage instance to use your locally builttechdocs-containerinstead of using the published image by setting the
following configuration:techdocs:generator:runIn:"docker"dockerImage:"mkdocs:local-dev"MkDocs plugins and extensionsThe 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 useslunr.jsas 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).kroki: This plugin enables you to embed Kroki-Diagrams into your documentation.ServerURLparameter can be set fromKROKI_SERVER_URLenvironmental variableDownloadImagesparameter can be set fromKROKI_DOWNLOAD_IMAGESenvironmental variableExtensions: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 peoplemark: 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 theusage instructions.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.CaveatsThemeWe only usematerial-mkdocsas base styles because Backstage also uses theMaterial UIon the client-side. We don't expect people to use themes other thanMaterial UIto 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 theBackstageThemeconfigured in Front-end application as the source of truth for all application design tokens like colors, typography and etc. So here you canseethat some styles will always be overridden regardless of themkdocs-materialplugin theme settings and this can cause unexpected behavior for those who override the theme setting in amkdocs.yamlfile.Changelog0.0.10Catch up on upgrade ofmkdocs-monorepo-pluginto v1.0.1, missed in the previous release0.0.9Merged upstreamv1.1.2.0.0.8Included kroki pluginAllow setting kroki server URL via environmental variableKROKI_SERVER_URLAllow setting kroki download image policy via environmental variableKROKI_DOWNLOAD_IMAGESCustomizesearchplugin configuration to have a pre-build index by defaultLicenseCopyright 2020-2021 © 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-usageLicensed under the Apache License, Version 2.0:http://www.apache.org/licenses/LICENSE-2.0