Skip to content

Code blocks Material

FormSyntaxUsage
Langagefence jsColoration syntaxique.
Titlefence py title="app.py"File name.
Numberslinenums="1"Numbertation.
Surlignagehl_lines="2 4-6"Highlighted lines.
Attributesfence { .yaml linenums="1" }Syntax Material.
Copieno-copyCopy button hidden.
Shellfence bash-rootRoot prompt.
Annotation# (1) then 1. ExplanationCode bubble.
~~~ py title="bubble_sort.py"
def bubble_sort(items):
    return items
~~~
bubble_sort.py
def bubble_sort(items):
    return items
~~~ py linenums="1" hl_lines="2 3"
def bubble_sort(items):
    for i in range(len(items)):
        print(i)
    return items
~~~
def bubble_sort(items):
    for i in range(len(items)):
        print(i)
    return items
~~~ { .yaml .copy title="config.yml" linenums="3" hl_lines="4" }
site_name: Demo
theme:
  name: material
~~~
config.yml
site_name: Demo
theme:
  name: material
~~~ { .bash .no-copy title="install.sh" }
npm install
npm run build
~~~
install.sh
npm install
npm run build
~~~bash-root
apt update
apt install nginx
systemctl restart nginx
~~~
Super utilisateur
apt update
apt install nginx
systemctl restart nginx
=== "app.py"

    ~~~ py title="app.py" linenums="1" hl_lines="4"
    from fastapi import FastAPI

    app = FastAPI()
    app.title = "Demo"
    ~~~

=== "config.yml"

    ~~~ yaml title="config.yml" linenums="1"
    site_name: Demo
    theme:
      name: material
    ~~~

=== "package.json"

    ~~~ json title="package.json" no-copy
    {
      "scripts": {
        "dev": "astro dev"
      }
    }
    ~~~
from fastapi import FastAPI

app = FastAPI()
app.title = "Demo"
site_name: Demo
theme:
  name: material
{
  "scripts": {
    "dev": "astro dev"
  }
}
~~~ yaml title="mkdocs.yml"
theme:
  name: material # (1)
  features:
    - content.code.copy # (2)
~~~
mkdocs.yml
theme:
  name: material # (1)
  features:
    - content.code.copy # (2)