Files
fun-with-mkdocs/docs/configuration_example.md
TGITS af544068c1 feat(wip_for_article)
Finalisation of the site for the article
2024-02-17 13:14:56 +01:00

4.1 KiB

title, description, status
title description status
Page configuration and extensions example usage Some page configuration and extensions usage examples new

Goals of this page

This page aims to demonstrate some examples of a page configuration and examples usage of some extensions.

Emoji 😄

  • :grinning_face:
  • 🥶
  • 🤓
  • :rolling_on_the_floor_laughing:
  • 💔
  • 👽

Some of the codes from this Emoji Cheat Sheet works.

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

/**
 * Run with JBang : jbang frequencies-map-with-for.jsh (1)
 * <p>
 * or open in JShell : /open frequencies-map-with-for.jsh
 */
import java.util.HashMap;
import java.util.List;
import java.util.Map;

List<String> daysOfWeek = List.of("Friday", "Thursday", "Thursday", "Saturday", "Thursday", "Thursday", "Monday", "Saturday", "Friday", "Saturday");
Map<String, Integer> 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

Tables examples

Sortable table with no alignement specified for columns

AtomicNumber Symbol Name AtomicMass
1 H Hydrogen 1.0080
2 He Helium 4.00260
3 Li Lithium 7.0
4 Be Beryllium 9.012183

Sortable table with columns aligned to left

AtomicNumber Symbol Name AtomicMass
1 H Hydrogen 1.0080
2 He Helium 4.00260
3 Li Lithium 7.0
4 Be Beryllium 9.012183

Sortable table with columns centered

AtomicNumber Symbol Name AtomicMass
1 H Hydrogen 1.0080
2 He Helium 4.00260
3 Li Lithium 7.0
4 Be Beryllium 9.012183

Sortable table with columns aligned to right

AtomicNumber Symbol Name AtomicMass
1 H Hydrogen 1.0080
2 He Helium 4.00260
3 Li Lithium 7.0
4 Be Beryllium 9.012183

Diagrams with Mermaid examples

Hereafter an example with a class and a sequence diagram (inspired by the Visitor Pattern) but any diagram supported by mermaid is possible.

classDiagram
    class Visitor{
        +visit(ConcreteElementA element)
        +visit(ConcreteElementB element)
    }

    <<interface>> Visitor

    class ConcreteVisitorA {
        +visit(ConcreteElementA element)
        +visit(ConcreteElementB element)
    }

    Visitor <|.. ConcreteVisitorA

    class Element{
        +accept(Visitor visitor)
    }

    <<interface>> Element

    class ConcreteElementA{
        +accept(Visitor visitor)
    }

    class ConcreteElementB{
        +accept(Visitor visitor)
    }

    Element <.. ConcreteElementA
    Element <.. ConcreteElementB

sequenceDiagram
  client->>concreteElementA: accept(visitor)
  concreteElementA->>visitor: visit(concreteElementA)
  client->>concreteElementB: accept(visitor)
  concreteElementB->>visitor: visit(concreteElementA)