I am using MkDocs with the codehilite markdown extension
I would like to enable code snippet line numbers only for specific snippets.
If I set
markdown_extensions:
- codehilite:
linenums: true
in my mkdocs.yml, this will enable line numbers for all code snippets.
I see that it is possible to activate line numbers for specific snippets by using the shebang language specifier together with double indentation:
#!python
""" Bubble sort """
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
However, I prefer using backticks (```) for designating code.
Is there a way to enable line numbers for specific code listings when using backticks?