Closed andy-maier closed 2 years ago
👋 Hey mate, sorry for the slow response.
This is actually the fault of Atom's shell-script grammar: specifically, the rules responsible for matching here-docs. A workaround hack is to use ..
as a here-doc delimiter instead of EOT
:
.. code-block:: sh
$ cat >py.sh <<..
#!/bin/bash
py=$(which python)
$py "$@"
..
..
`Link <link.html>`_
This works because ..
introduces a comment in reStructuredText, while the embedded shell-script continues behaving as if it were written like this:
#!/bin/sh
set -e
# Note the strange indentation below: this is what Atom's
# shell grammar sees when it highlights the "indented"
# code-sample in reStructuredText:
cat >py.sh <<END
#!/bin/bash
py=$(which python)
$py "$@"
END
This could've been fixed on Atom's end, had I responded before they announced the editor's retirement by end-of-year.
Consider the following example .rst file:
Atom when using this package highlights this incorrectly. Anything after the
<<
gets highlighted in green (same as text in double backquotes). Usage of double backquotes after that does not reset this highlighting.Screen shot how the above file is highlighted:
When I remove one of the two
<
characters, the highlighting is correct again, so this is clearly triggered by the presence of two<<
: