DocsForge supports rich code blocks with syntax highlighting, titles, line numbers, and more.
Use triple backticks with a language identifier:
``` python
def hello(name):
print(f"Hello, {name}!")
```def hello(name):
print(f"Hello, {name}!")DocsForge supports 300+ languages via Pygments, including:
python,pyjavascript,jstypescript,tsbash,sh,shellyaml,ymljsonhtmlcssmarkdown,mddockerfilesqlrustgojavac,cppcsharp,csruby,rbphpluarjuliakotlinswiftdart
``` python title="hello.py"
def hello(name):
print(f"Hello, {name}!")
```def hello(name):
print(f"Hello, {name}!")``` python linenums="1"
def hello(name):
print(f"Hello, {name}!")
return True
```def hello(name):
print(f"Hello, {name}!")
return True``` python hl_lines="2 3"
def hello(name):
message = f"Hello, {name}!"
print(message)
return message
```def hello(name):
message = f"Hello, {name}!"
print(message)
return messageShow additions and deletions:
``` diff
def hello(name):
- print("Hello!")
+ print(f"Hello, {name}!")
return True
``` def hello(name):
- print("Hello!")
+ print(f"Hello, {name}!")
return TrueShow command output:
``` console
$ docsforge build
INFO - Cleaning site directory
INFO - Building documentation to directory: site
INFO - Documentation built in 2.34 seconds
```$ docsforge build
INFO - Cleaning site directory
INFO - Building documentation to directory: site
INFO - Documentation built in 2.34 secondsDisable the copy button for a specific block:
``` python
--8<-- "hello.py"
```Or globally disable in config:
theme:
features:
# Don't include - content.code.copy