Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodejsrepl lexer issue with escapeinside #2666

Open
isc-aray opened this issue Mar 19, 2024 · 2 comments
Open

Nodejsrepl lexer issue with escapeinside #2666

isc-aray opened this issue Mar 19, 2024 · 2 comments

Comments

@isc-aray
Copy link

isc-aray commented Mar 19, 2024

From gpoore/minted#388:

The nodejsrepl lexer tends to place escaped content too late in the output.

Command for all inputs is:

pygmentize -l 'nodejsrepl' -f latex -P escapeinside='@@'
InputOutput
> a
[ @\textit{1}@, 2 ]
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PY{g+gp}{\PYZgt{}}\PY{+w}{ }\PY{n+nx}{a}
\PY{p}{[}\PY{+w}{ }\PY{p}{,}\PY{+w}{ }\PY{l+m+mf}{2}\PY{+w}{ }\PY{esc}{\textit{1}}\PY{p}{]}
\end{Verbatim}
> ab
[ @\textit{1}@, 2 ]
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PY{g+gp}{\PYZgt{}}\PY{+w}{ }\PY{n+nx}{ab}
\PY{p}{[}\PY{+w}{ }\PY{p}{,}\PY{+w}{ }\PY{l+m+mf}{2}\PY{+w}{ }\PY{p}{]}\PY{esc}{\textit{1}}
\end{Verbatim}
> abc
[ @\textit{1}@, 2 ]
\begin{Verbatim}[commandchars=\\\{\},codes={\catcode`\$=3\catcode`\^=7\catcode`\_=8\relax}]
\PY{g+gp}{\PYZgt{}}\PY{+w}{ }\PY{n+nx}{abc}
\PY{p}{[}\PY{+w}{ }\PY{p}{,}\PY{+w}{ }\PY{l+m+mf}{2}\PY{+w}{ }\PY{p}{]}
\PY{esc}{\textit{1}}\end{Verbatim}

Notice that as the first line gets longer, the escaped content on the second line gets pushed further and further away from its intended position until eventually it is pushed onto the same line as \end{Verbatim}, at which point it doesn't render at all because of the way that environment works:

Output of the commands (brackets have been replaced by parentheses): #expected > a ( 1, 2 ) > a ( , 2 1 ) > ab ( , 2 ) 1 > abc ( , 2 )

@muzimuzhi
Copy link
Contributor

Image/screenshot broken.

@isc-aray
Copy link
Author

Image/screenshot broken.

That's very strange. I just copied it from gpoore/minted#388.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants