Skip to content

Commit

Permalink
Added console code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
MartenBE committed Mar 19, 2024
1 parent 39ae9b7 commit f05193a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
60 changes: 59 additions & 1 deletion docs/examples/h1.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,65 @@ public void test() {
}
```

Some text here.
This MkDocs theme uses [Pygments](https://pygments.org) to provide syntax highlighting. All available languages are defined [here](https://pygments.org/languages/), use the short name as the language identifier for the fenced code blocks in markdown. There is also support for highlighting [CLI output](https://pygments.org/docs/terminal-sessions/):

```console
user@localhost:~$ echo blabla
blabla
user@localhost:~$  for i in {0..5}; do echo "${i}"; done
0
1
2
3
4
5
user@localhost:~$ export dir="demo"
user@localhost:~$ mkdir "/tmp/${dir}"
user@localhost:~$ cd "/tmp/${dir}"
user@localhost:/tmp/demo$ echo "Hello world!" > test.txt
user@localhost:/tmp/demo$ ls -al
total 4
drwxr-xr-x. 2 user user 60 19 mrt 11:21 .
drwxrwxrwt. 32 root root 940 19 mrt 11:21 ..
-rw-r--r--. 1 user user 13 19 mrt 11:21 test.txt
user@localhost/tmp/demo$ cat test.txt
Hello world!
```

```ps1con
PS C:\Users\user> Write-Host blabla
blabla
PS C:\Users\user> 0..5 | ForEach-Object { Write-Output $_ }
0
1
2
3
4
5
PS C:\Users\user> $dir = "demo"
PS C:\Users\user> New-Item -ItemType Directory -Path "C:\temp\${dir}"
Directory: C:\temp\
UnixMode User Group LastWriteTime Size Name
-------- ---- ----- ------------- ---- ----
drwxr-xr-x user user 3/19/2024 11:26 40 demo
PS C:\Users\user> Set-Location "C:\temp\${dir}"
PS C:\temp\demo> Set-Content -Path "test.txt" -Value "Hello world!"
PS C:\temp\demo> Get-ChildItem
Directory: C:\temp\demo
UnixMode User Group LastWriteTime Size Name
-------- ---- ----- ------------- ---- ----
-rw-r--r-- user user 3/19/2024 11:26 13 test.txt
PS C:\temp\demo> Get-Content test.txt
Hello world!
```

You can even [link](./#__codelineno-0-5) to a specific line in a fenced code block.

## Inline source code

Expand Down
4 changes: 4 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
site_name: hogent-mkdocs
site_url: https://hogent.be
copyright: Copyright &copy; HOGENT (<a href="https://hogent.be">https://hogent.be</a>)
# If you want MkDocs to automatically generate a table of contents, then remove the complete `nav` section.
# See https://www.mkdocs.org/user-guide/writing-your-docs/#configure-pages-and-navigation for more information.
# Use `index.md` as the default file for the homepage. MkDocs will automatically pick this file up.
# See https://www.mkdocs.org/user-guide/writing-your-docs/#index-pages for more information.
nav:
- Home: ./index.md
- Basic examples: ./examples/h1.md
Expand Down

0 comments on commit f05193a

Please sign in to comment.