It appears that syntax highlighting works differently for code fences and highlight shortcode, if they are a part of list items. See the following example:
1. Step 1 description
2. Step 2 description
``` bash
$ vi echo.py
```
{{< highlight python >}}
from echo import echo
class echoTest():
...
{{< /highlight >}}
The first code block (bash shell inside code fences) is displayed as expected, with no indentation in the output.
$ vi echo.py
However, for the second code block (python code inside highlight shortcode), indentation is included in the resulting code block, which is not the behavior that I want.
from echo import echo
class echoTest():
...
So, to make it work, I have to put them differently, as in the following.
1. Step 1 description
2. Step 2 description
``` bash
$ vi echo.py
```
{{< highlight python >}}
from echo import echo
class echoTest():
...
{{< /highlight >}}
Is there a better way to get around this issue? Or is there any other option to make highlight shortcode “indentation-aware”?
@kaushalmodi,
Many thanks for pointing me to the issue. I hope your investigation gets the due acceptance.
I’m migrating our project site to Hugo, and this kind of issue will definitely become a blocker for persuading my team members (who’s still reluctant to switching from CMS) to move over to Hugo, because the project documentation contains a lot of procedural instructions with code examples.