I don’t think this is the intended use of shortcodes, Hugo is probably expecting to only find .html files in the shortcodes folder so this might be what’s causing the encoding/htmlEscaping problem, not sure though. Shortcodes work as pieces of code/template that you can call from your content files to help you process something. What you have in your “shortcode” now is clear content, there’s no processing, so you don’t need to store this in a shortcode and try solving this problem.
Instead you could:
store your markdown content in content/reusables/pieceofcontent.md with front matter telling Hugo not to publish/render it anywhere:
---
_build:
list: false
render: false
---
One line ...
```python
if x <= 100:
```
Another line ...
Create a shortcode shortcodes/reusable.html able to get you the content files from that directory:
That works, there’s no < in the output. But it seems unnecessarily complicated and also there aren’t any other symbols that are converted to their html value.
The doc you linked is not talking about storing markdown content in a shortcode file the way you do but about processing markdown content in the “.Inner” part of a shortcode call, see the example at the top of the page meaning:
{{% mdshortcode %}}Some markdown stuff to process by the mdshortcode in the *center*.{{% /mdshortcode %}}