From a2df76edcc79b7d595cbcee2529cdd251dd5f328 Mon Sep 17 00:00:00 2001 From: TGITS Date: Mon, 12 Feb 2024 19:24:41 +0100 Subject: [PATCH] feat(wip_for_article) Working on plugins and extensions example --- docs/configuration_example.md | 56 +++++++++++++++++++++++++++++++++++ mkdocs.yml | 27 +++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 docs/configuration_example.md diff --git a/docs/configuration_example.md b/docs/configuration_example.md new file mode 100644 index 0000000..bd45d26 --- /dev/null +++ b/docs/configuration_example.md @@ -0,0 +1,56 @@ +--- +title: Configuration example +description: Some page configuration and extensions usage examples +status: new +--- + +## Goals of this page + +This page aims to demonstrate some examples of a page configuration and examples usage of some extensions. + +## Admonition examples + +!!! note + + note admonition example - not collapsible + +??? info + + info admonition example - collapsible, not expanded by default + +???+ tip + + tip admonition example - collapsible, expanded by default + +!!! warning + + warning admonition example - not collapsible + +???+ example + + example admonition example - collapsible, expanded by default + +## Code blocks examples + +```java title="frequencies-map-with-for.jsh" +/** + * Run with JBang : jbang frequencies-map-with-for.jsh (1) + *

+ * or open in JShell : /open frequencies-map-with-for.jsh + */ +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +List daysOfWeek = List.of("Friday", "Thursday", "Thursday", "Saturday", "Thursday", "Thursday", "Monday", "Saturday", "Friday", "Saturday"); +Map frequencies = new HashMap<>(); +int previousCount; +for (String day : daysOfWeek) { + previousCount = frequencies.getOrDefault(day, 0); + frequencies.put(day, previousCount + 1); +} + +frequencies.entrySet().iterator().forEachRemaining(System.out::println); +``` + +1. :man_raising_hand: Code annotation example diff --git a/mkdocs.yml b/mkdocs.yml index d9012e0..5bf0979 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -9,12 +9,39 @@ theme: - navigation.tracking # the url evolves with the scrolling - toc.integrate # to have a toc on the left - navigation.top # to have a shorcut to go back on top of the page when we scroll down + - content.code.copy # to have copy button with code blocks + - content.code.annotate # to be able to annotate in code blocks nav: - 'Home': 'index.md' - 'Introduction': 'mkdocs-briefly.md' - 'Installation': 'installing-and-running-mkdocs.md' + - 'Configuration example': 'configuration_example.md' + plugins: - search - offline + +markdown_extensions: + # Required for multiple other extensions + - attr_list # required for annotations, icons and emoji + - md_in_html # required for icons and emoji + - pymdownx.superfences # required for admonitions and code blocks + # For admonitions + - admonition + - pymdownx.details + - pymdownx.superfences + # For using a large database of icons and emojis + - pymdownx.emoji: + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg + # For code blocks + - pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true + - pymdownx.inlinehilite + - pymdownx.snippets + +