Is it possible to identify code block in minted?
See original GitHub issueI am using command like \newminted{java}{linenos,frame=lines ... }
, and surround my code by \begin{javacode}
.
But the code in this enviroment can’t be recognized as code. It will still be influenced by LaTeX grammar check and the formatter.
I tried code injection, but IDE keeps warning and error for lack of code context and the code will still be formatted.
Is it possible to identify code block and disable grammar check for them?
Issue Analytics
- State:
- Created 9 months ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Is it possible to identify code block in minted? - PullAnswer
I tried code injection, but IDE keeps warning and error for lack of code context and the code will still be formatted. Is...
Read more >Is it possible to find methods in source code using \inputminted?
Show activity on this post. Yes, this is nice :). If there were something like this in minted ...
Read more >Code Highlighting with minted - Overleaf, Online LaTeX Editor
This article shows how to use the minted package to format and highlight programming language source code within a LaTeX document, starting with...
Read more >The minted package: Highlighted source code in LaTeX - CTAN
minted provides the listing environment to wrap around a source code block. listing (env.) This puts the code into a floating box, with...
Read more >Support minted in addition to listings for code block in latex?
Since the listings package support just a few languages, tt would be nice if the latex writer can output code blocks with the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
compile with
xelatex -shell-escape test.tex
and python packagePygments
installed.An introduction for this package can be found here
Language injection itself should be easy to do generically, @jojo2357 if you want to help: all
LatexLanguageInjector
has to do is search for\newminted
commands, take the argument and assume it’s the language to be injected.However, treating the code as verbatim and not LaTeX depending on whether it is defined with
\newminted
or not is not possible with the lexer we have, so all we can do is as you suggest if the environment name containscode
assume it is code. I’m afraid this will lead to very inconvenient false positives though as there are likely environments with “code” in the name which just contain LaTeX. We can check the default TeX Live ones I could find, otherwise maybe we should stick to a few known languages.