backstage / mkdocs-techdocs-core

The core MkDocs plugin used by Backstage's TechDocs as a wrapper around multiple MkDocs plugins and Python Markdown extensions
Apache License 2.0
85 stars 61 forks source link

Enable extension to include other files #20

Closed Fox32 closed 10 months ago

Fox32 commented 3 years ago

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
dimapasko commented 1 year ago

mkdocs-techdocs-core already supports a lot of the pymdown features:

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.

It would be also great to support pymdown snippets

johanhammar commented 1 year ago

Snippets is supported but you have to enable it in your mkdocs configuration

ie.

markdown_extensions:
  - pymdownx.snippets
github-actions[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.