From cb6742c15ef9edb9af670cc9f2bd5ff8f0d933ba Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Tue, 23 Jun 2020 17:51:48 +0200 Subject: [PATCH 1/5] feat(mkdocs): WIP extensions for markdown --- plugins/techdocs/mkdocs/container/Dockerfile | 4 +- .../container/techdocs-core/src/core.py | 64 ++++++++++++++++--- .../techdocs/mkdocs/mock-docs/docs/index.md | 3 + plugins/techdocs/mkdocs/mock-docs/mkdocs.yml | 3 +- 4 files changed, 62 insertions(+), 12 deletions(-) diff --git a/plugins/techdocs/mkdocs/container/Dockerfile b/plugins/techdocs/mkdocs/container/Dockerfile index 1ae66589b6..05c129033f 100644 --- a/plugins/techdocs/mkdocs/container/Dockerfile +++ b/plugins/techdocs/mkdocs/container/Dockerfile @@ -15,8 +15,8 @@ FROM python:3.7.7-alpine3.12 -RUN apk update && apk --no-cache add gcc musl-dev -RUN pip install mkdocs==1.1.2 mkdocs-material==5.3.2 +RUN apk update && apk --no-cache add gcc musl-dev graphviz +RUN pip install --upgrade pip && pip install mkdocs==1.1.2 mkdocs-material==5.3.2 pymdown-extensions==7.1 markdown_inline_graphviz_extension==1.1 plantuml-markdown==3.2.2 markdown-katex==202006.1021 ADD ./techdocs-core /techdocs-core RUN pip install --no-index /techdocs-core diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py b/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py index e42a60d28b..d9c33b2167 100644 --- a/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py +++ b/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py @@ -21,15 +21,63 @@ from mkdocs.contrib.search import SearchPlugin class TechDocsCore(BasePlugin): def on_config(self, config): - # Theme - config['theme'] = Theme(name="material") + # Theme + config['theme'] = Theme(name="material") - # Plugins - del config['plugins']['techdocs-core'] + # Plugins + del config['plugins']['techdocs-core'] - search_plugin = SearchPlugin() - search_plugin.load_config({}) - config['plugins']['search'] = search_plugin + search_plugin = SearchPlugin() + search_plugin.load_config({}) + config['plugins']['search'] = search_plugin - return config + # Markdown Extensions + print(config) + 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('markdown_inline_graphviz') + config['markdown_extensions'].append('plantuml_markdown') + config['markdown_extensions'].append('markdown_katex') + config['mdx_configs']['markdown_katex'] = { + 'no_inline_svg': True, + 'insert_fonts_css': True, + } + 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') + config['markdown_extensions'].append('pymdownx.emoji') + config['mdx_configs']['pymdownx.emoji'] = { + 'emoji_generator': '!!python/name:pymdownx.emoji.to_svg', + } + config['markdown_extensions'].append('pymdownx.inlinehilite') + config['markdown_extensions'].append('pymdownx.magiclink') + config['markdown_extensions'].append('pymdownx.mark') + config['markdown_extensions'].append('pymdownx.smartsymbols') + config['markdown_extensions'].append('pymdownx.superfences') + config['markdown_extensions'].append('pymdownx.tasklist') + config['mdx_configs']['pymdownx.tasklist'] = { + 'custom_checkbox': True, + } + config['markdown_extensions'].append('pymdownx.tilde') + print(config) + + return config diff --git a/plugins/techdocs/mkdocs/mock-docs/docs/index.md b/plugins/techdocs/mkdocs/mock-docs/docs/index.md index bc437e6180..72f7a776a8 100644 --- a/plugins/techdocs/mkdocs/mock-docs/docs/index.md +++ b/plugins/techdocs/mkdocs/mock-docs/docs/index.md @@ -1 +1,4 @@ ## hello mock docs + +!!! test +Testing somethin diff --git a/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml b/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml index b14d82c4de..2ecc719875 100644 --- a/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml +++ b/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml @@ -4,5 +4,4 @@ nav: - Home: index.md plugins: - - techdocs-core - + - techdocs-core \ No newline at end of file From eee3a5563309375c55edfae5b7b9cd4adc52a3f0 Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Wed, 24 Jun 2020 10:57:04 +0200 Subject: [PATCH 2/5] fix(mkdocs): update sample md file --- .../container/techdocs-core/src/core.py | 12 ++++---- .../techdocs/mkdocs/mock-docs/docs/index.md | 28 +++++++++++++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py b/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py index d9c33b2167..fddee3bfd1 100644 --- a/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py +++ b/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py @@ -32,7 +32,6 @@ class TechDocsCore(BasePlugin): config['plugins']['search'] = search_plugin # Markdown Extensions - print(config) config['markdown_extensions'].append('admonition') config['markdown_extensions'].append('abbr') config['markdown_extensions'].append('attr_list') @@ -51,11 +50,11 @@ class TechDocsCore(BasePlugin): config['markdown_extensions'].append('markdown.extensions.tables') config['markdown_extensions'].append('markdown_inline_graphviz') config['markdown_extensions'].append('plantuml_markdown') - config['markdown_extensions'].append('markdown_katex') - config['mdx_configs']['markdown_katex'] = { - 'no_inline_svg': True, - 'insert_fonts_css': True, - } + #config['markdown_extensions'].append('markdown_katex') + #config['mdx_configs']['markdown_katex'] = { + # 'no_inline_svg': True, + # 'insert_fonts_css': True, + #} config['markdown_extensions'].append('pymdownx.betterem') config['mdx_configs']['pymdownx.betterem'] = { 'smart_enable': 'all', @@ -77,7 +76,6 @@ class TechDocsCore(BasePlugin): 'custom_checkbox': True, } config['markdown_extensions'].append('pymdownx.tilde') - print(config) return config diff --git a/plugins/techdocs/mkdocs/mock-docs/docs/index.md b/plugins/techdocs/mkdocs/mock-docs/docs/index.md index 72f7a776a8..e8ba4e2d6d 100644 --- a/plugins/techdocs/mkdocs/mock-docs/docs/index.md +++ b/plugins/techdocs/mkdocs/mock-docs/docs/index.md @@ -2,3 +2,31 @@ !!! test Testing somethin + +Some text about MOCDOC + +\*[MOCDOC]: Mock Documentation + +This is a paragraph. +{: #test_id .test_class } + +Apple +: Pomaceous fruit of plants of the genus Malus in +the family Rosaceae. + +```javascript +import { test } from 'something'; + +const addThingToThing = (a, b) a + b; +``` + +- [abc](#abc) +- [xyz](#xyz) + +## abc + +This is a b c. + +## xyz + +This is x y z. From 106c4d6763029b38061aaaebe9408aa0bc0da4d8 Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Wed, 24 Jun 2020 10:58:24 +0200 Subject: [PATCH 3/5] Added blank line --- plugins/techdocs/mkdocs/mock-docs/mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml b/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml index 2ecc719875..0c7cf84955 100644 --- a/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml +++ b/plugins/techdocs/mkdocs/mock-docs/mkdocs.yml @@ -4,4 +4,4 @@ nav: - Home: index.md plugins: - - techdocs-core \ No newline at end of file + - techdocs-core From 3b936faf7e36a2688775eb5f3448f60d4d603b5d Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Wed, 24 Jun 2020 11:42:15 +0200 Subject: [PATCH 4/5] fix(mkdocs): remove some markdown plugins --- plugins/techdocs/mkdocs/container/Dockerfile | 4 ++-- .../techdocs/mkdocs/container/techdocs-core/src/core.py | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/plugins/techdocs/mkdocs/container/Dockerfile b/plugins/techdocs/mkdocs/container/Dockerfile index 05c129033f..9080277a30 100644 --- a/plugins/techdocs/mkdocs/container/Dockerfile +++ b/plugins/techdocs/mkdocs/container/Dockerfile @@ -15,8 +15,8 @@ FROM python:3.7.7-alpine3.12 -RUN apk update && apk --no-cache add gcc musl-dev graphviz -RUN pip install --upgrade pip && pip install mkdocs==1.1.2 mkdocs-material==5.3.2 pymdown-extensions==7.1 markdown_inline_graphviz_extension==1.1 plantuml-markdown==3.2.2 markdown-katex==202006.1021 +RUN apk update && apk --no-cache add gcc musl-dev graphviz git +RUN pip install --upgrade pip && pip install mkdocs==1.1.2 mkdocs-material==5.3.2 pymdown-extensions==7.1 ADD ./techdocs-core /techdocs-core RUN pip install --no-index /techdocs-core diff --git a/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py b/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py index fddee3bfd1..a9b5a91e07 100644 --- a/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py +++ b/plugins/techdocs/mkdocs/container/techdocs-core/src/core.py @@ -48,13 +48,6 @@ class TechDocsCore(BasePlugin): } config['markdown_extensions'].append('footnotes') config['markdown_extensions'].append('markdown.extensions.tables') - config['markdown_extensions'].append('markdown_inline_graphviz') - config['markdown_extensions'].append('plantuml_markdown') - #config['markdown_extensions'].append('markdown_katex') - #config['mdx_configs']['markdown_katex'] = { - # 'no_inline_svg': True, - # 'insert_fonts_css': True, - #} config['markdown_extensions'].append('pymdownx.betterem') config['mdx_configs']['pymdownx.betterem'] = { 'smart_enable': 'all', From f518a47bb27307dc679d7a9aa3b589eaf37cd400 Mon Sep 17 00:00:00 2001 From: Sebastian Qvarfordt Date: Wed, 24 Jun 2020 11:45:57 +0200 Subject: [PATCH 5/5] fix(mkdocs): removed unused packages from container --- plugins/techdocs/mkdocs/container/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/techdocs/mkdocs/container/Dockerfile b/plugins/techdocs/mkdocs/container/Dockerfile index 9080277a30..f96498df14 100644 --- a/plugins/techdocs/mkdocs/container/Dockerfile +++ b/plugins/techdocs/mkdocs/container/Dockerfile @@ -15,7 +15,7 @@ FROM python:3.7.7-alpine3.12 -RUN apk update && apk --no-cache add gcc musl-dev graphviz git +RUN apk update && apk --no-cache add gcc musl-dev RUN pip install --upgrade pip && pip install mkdocs==1.1.2 mkdocs-material==5.3.2 pymdown-extensions==7.1 ADD ./techdocs-core /techdocs-core