SageMath installations ship with a latex package sagetex which defines a few commands (\sage, \sageplot...) and environments (sagesilent, sageblock) in which users embed Sage code (similar to Python).
Since there is precedence in this project to treat certain environments minted, listing, pycode specially to enable language injection in nvim-treesitter, I took the opportunity to do the same for sagesilent and sageblock especially as I believe they can be treated exactly like pycode.
I personally have interest in enabling Python highlighting in these environments, and this also has enough general interest for it to be raised as an issue, and completed for the vimtex plugin: https://github.com/lervag/vimtex/issues/2027 .
Review brief
For review purposes, the following are separated into different commits:
The changes I made manually
The changes caused by npm run generate and cargo build
The test additions
Note for corresponding changes to nvim-treesitter:
Python highlighting for these extra environments seems to work fine with the following change to queries/latex/injections.scm (alongside the changes in this pull request):
Why
SageMath installations ship with a latex package sagetex which defines a few commands (
\sage
,\sageplot
...) and environments (sagesilent
,sageblock
) in which users embed Sage code (similar to Python).Since there is precedence in this project to treat certain environments
minted
,listing
,pycode
specially to enable language injection in nvim-treesitter, I took the opportunity to do the same forsagesilent
andsageblock
especially as I believe they can be treated exactly likepycode
.I personally have interest in enabling Python highlighting in these environments, and this also has enough general interest for it to be raised as an issue, and completed for the vimtex plugin: https://github.com/lervag/vimtex/issues/2027 .
Review brief
For review purposes, the following are separated into different commits:
npm run generate
andcargo build
Note for corresponding changes to
nvim-treesitter
:Python highlighting for these extra environments seems to work fine with the following change to
queries/latex/injections.scm
(alongside the changes in this pull request):