TechDocs: adjust mkdocs extensions (#2516)
* fix(techdocs-core): adjust mkdocs extensions * fix(techdocs-core): formatting * fix(techdocs-core): bump version) * move highlight configs to extension * delete extension from mkdocs yaml * formatting * fix(docs): add links to plugins and extensions in docs * prettier * fix(techdocs-core): use pymdownx extensions v.7.1 to allow legacy_tab_classes config * fix(techdocs-core): delete unused import * update changelog * added superfences to list of extensions * prettier
This commit is contained in:
@@ -3,10 +3,9 @@
|
||||
!!! test
|
||||
Testing somethin
|
||||
|
||||
Abbreviations:
|
||||
Some text about MOCDOC
|
||||
|
||||
\*[MOCDOC]: Mock Documentation
|
||||
|
||||
This is a paragraph.
|
||||
{: #test_id .test_class }
|
||||
|
||||
@@ -61,3 +60,40 @@ digraph G {
|
||||
```
|
||||
|
||||
:bulb:
|
||||
|
||||
=== "JavaScript"
|
||||
|
||||
```javascript
|
||||
import { test } from 'something';
|
||||
|
||||
const addThingToThing = (a, b) a + b;
|
||||
```
|
||||
|
||||
=== "Java"
|
||||
|
||||
```java
|
||||
public void function() {
|
||||
test();
|
||||
}
|
||||
```
|
||||
|
||||
```java tab="java"
|
||||
public void function() {
|
||||
test();
|
||||
}
|
||||
```
|
||||
|
||||
```java tab="java 2"
|
||||
public void function() {
|
||||
test();
|
||||
}
|
||||
```
|
||||
|
||||
```javascript
|
||||
import { test } from 'something';
|
||||
|
||||
const addThingToThing = (a, b) a + b;
|
||||
```
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
*[MOCDOC]: Mock Documentation
|
||||
|
||||
@@ -48,8 +48,72 @@ python -m black src/
|
||||
|
||||
**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.
|
||||
|
||||
## 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](https://www.mkdocs.org/user-guide/configuration/#search)
|
||||
- [mkdocs-monorepo-plugin](https://github.com/spotify/mkdocs-monorepo-plugin)
|
||||
|
||||
Extensions:
|
||||
|
||||
- [admonition](https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonitions)
|
||||
- [toc](https://python-markdown.github.io/extensions/toc/)
|
||||
- [pymdown](https://facelessuser.github.io/pymdown-extensions/)
|
||||
- caret
|
||||
- critic
|
||||
- details
|
||||
- emoji
|
||||
- superfences
|
||||
- inlinehilite
|
||||
- magiclink
|
||||
- mark
|
||||
- smartsymobls
|
||||
- highlight
|
||||
- extra
|
||||
- tabbed
|
||||
- tasklist
|
||||
- tilde
|
||||
- [markdown_inline_graphviz](https://pypi.org/project/markdown-inline-graphviz/)
|
||||
- [plantuml_markdown](https://pypi.org/project/plantuml-markdown/)
|
||||
|
||||
## Changelog
|
||||
|
||||
### 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
|
||||
|
||||
@@ -7,7 +7,7 @@ mkdocs-monorepo-plugin==0.4.5
|
||||
plantuml-markdown==3.1.2
|
||||
markdown_inline_graphviz_extension==1.1
|
||||
pygments==2.6.1
|
||||
pymdown-extensions==8.0.0
|
||||
pymdown-extensions==7.1
|
||||
|
||||
# The linter using for Python
|
||||
# Note: This requires Python 3.6+ to run, but can format Python 2 code too.
|
||||
|
||||
@@ -17,38 +17,34 @@ from setuptools import setup, find_packages
|
||||
|
||||
|
||||
setup(
|
||||
name='mkdocs-techdocs-core',
|
||||
version='0.0.7',
|
||||
description='A Mkdocs package that contains TechDocs defaults',
|
||||
long_description='',
|
||||
keywords='mkdocs',
|
||||
url='https://github.com/spotify/backstage',
|
||||
author='TechDocs Core',
|
||||
author_email='pulp-fiction@spotify.com',
|
||||
license='Apache-2.0',
|
||||
python_requires='>=3.7',
|
||||
name="mkdocs-techdocs-core",
|
||||
version="0.0.8",
|
||||
description="A Mkdocs package that contains TechDocs defaults",
|
||||
long_description="",
|
||||
keywords="mkdocs",
|
||||
url="https://github.com/spotify/backstage",
|
||||
author="TechDocs Core",
|
||||
author_email="pulp-fiction@spotify.com",
|
||||
license="Apache-2.0",
|
||||
python_requires=">=3.7",
|
||||
install_requires=[
|
||||
'mkdocs>=1.1.2',
|
||||
'mkdocs-material==5.3.2',
|
||||
'mkdocs-monorepo-plugin==0.4.5',
|
||||
'plantuml-markdown==3.1.2',
|
||||
'markdown_inline_graphviz_extension==1.1',
|
||||
'pygments==2.6.1',
|
||||
'pymdown-extensions==8.0.0'
|
||||
"mkdocs>=1.1.2",
|
||||
"mkdocs-material==5.3.2",
|
||||
"mkdocs-monorepo-plugin==0.4.5",
|
||||
"plantuml-markdown==3.1.2",
|
||||
"markdown_inline_graphviz_extension==1.1",
|
||||
"pygments==2.6.1",
|
||||
"pymdown-extensions==7.1",
|
||||
],
|
||||
classifiers=[
|
||||
'Development Status :: 1 - Planning',
|
||||
'Intended Audience :: Developers',
|
||||
'Intended Audience :: Information Technology',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3 :: Only',
|
||||
'Programming Language :: Python :: 3.7'
|
||||
"Development Status :: 1 - Planning",
|
||||
"Intended Audience :: Developers",
|
||||
"Intended Audience :: Information Technology",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
],
|
||||
packages=find_packages(),
|
||||
entry_points={
|
||||
'mkdocs.plugins': [
|
||||
'techdocs-core = src.core:TechDocsCore'
|
||||
]
|
||||
}
|
||||
entry_points={"mkdocs.plugins": ["techdocs-core = src.core:TechDocsCore"]},
|
||||
)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
"""
|
||||
|
||||
from mkdocs.plugins import BasePlugin, PluginCollection
|
||||
from mkdocs.plugins import BasePlugin
|
||||
from mkdocs.theme import Theme
|
||||
from mkdocs.contrib.search import SearchPlugin
|
||||
from mkdocs_monorepo_plugin.plugin import MonorepoPlugin
|
||||
@@ -54,25 +54,11 @@ class TechDocsCore(BasePlugin):
|
||||
|
||||
# Markdown Extensions
|
||||
config["markdown_extensions"].append("admonition")
|
||||
config["markdown_extensions"].append("abbr")
|
||||
config["markdown_extensions"].append("attr_list")
|
||||
config["markdown_extensions"].append("def_list")
|
||||
config["markdown_extensions"].append("codehilite")
|
||||
config["mdx_configs"]["codehilite"] = {
|
||||
"linenums": True,
|
||||
"guess_lang": False,
|
||||
"pygments_style": "friendly",
|
||||
}
|
||||
config["markdown_extensions"].append("toc")
|
||||
config["mdx_configs"]["toc"] = {
|
||||
"permalink": True,
|
||||
}
|
||||
config["markdown_extensions"].append("footnotes")
|
||||
config["markdown_extensions"].append("markdown.extensions.tables")
|
||||
config["markdown_extensions"].append("pymdownx.betterem")
|
||||
config["mdx_configs"]["pymdownx.betterem"] = {
|
||||
"smart_enable": "all",
|
||||
}
|
||||
|
||||
config["markdown_extensions"].append("pymdownx.caret")
|
||||
config["markdown_extensions"].append("pymdownx.critic")
|
||||
config["markdown_extensions"].append("pymdownx.details")
|
||||
@@ -83,6 +69,18 @@ class TechDocsCore(BasePlugin):
|
||||
config["markdown_extensions"].append("pymdownx.mark")
|
||||
config["markdown_extensions"].append("pymdownx.smartsymbols")
|
||||
config["markdown_extensions"].append("pymdownx.superfences")
|
||||
config["mdx_configs"]["pymdownx.superfences"] = {
|
||||
"legacy_tab_classes": True,
|
||||
}
|
||||
config["markdown_extensions"].append("pymdownx.highlight")
|
||||
config["mdx_configs"]["pymdownx.highlight"] = {
|
||||
"linenums": True,
|
||||
}
|
||||
config["markdown_extensions"].append("pymdownx.extra")
|
||||
config["mdx_configs"]["pymdownx.betterem"] = {
|
||||
"smart_enable": "all",
|
||||
}
|
||||
config["markdown_extensions"].append("pymdownx.tabbed")
|
||||
config["markdown_extensions"].append("pymdownx.tasklist")
|
||||
config["mdx_configs"]["pymdownx.tasklist"] = {
|
||||
"custom_checkbox": True,
|
||||
|
||||
Reference in New Issue
Block a user