<!-- language-all: lang-bash -->

My two cents to just those two points you raised:

- users may mistakenly take in code comments as part of the provided solution

    The [syntax highlighting](https://meta.stackoverflow.com/questions/274371/what-is-syntax-highlighting-and-how-does-it-work) prevents that very well, for example:

        #!/bin/bash
        a=~/dir # fill variable a

    Unfortunately syntax highlighting doesn’t seem to work here on meta, but on main the comment would appear greyed out if the code block was preceded by `<!-- language: lang-bash -->`, see e.g. [this answer of mine](https://askubuntu.com/a/1033882/507051) with a real-life example of the following as well.

- its not easy to point to a specific code section without repeating it in the text

    You can use the usual formatting inside code blocks if you use the html markup, e.g.

        <pre><code>#!/bin/<i>bash</i> # italics
        a=<b>~/dir</b> # bold</code></pre>

    gives:

    <pre><code>#!/bin/<i>bash</i> # italics
    a=<b>~/dir</b> # bold</code></pre>

    - [AU Markdown help – Inline HTML](https://askubuntu.com/editing-help#html)
    - [What HTML tags are allowed on Stack Exchange sites?](https://meta.stackexchange.com/questions/1777/what-html-tags-are-allowed-on-stack-exchange-sites)