James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.67k stars 530 forks source link

Add syntax highlighting support for mintinline #995

Closed gusbemacbe closed 5 years ago

gusbemacbe commented 5 years ago

Describe the bug I am using both mintinline and minted for code highlighting in XeLaTeX.

In this repository, it breaks the highlight when a dollar symbol is passed within the block

To Reproduce With dollar symbol: image

Expected behavior Without dollar symbol: image

Screenshots See above

Desktop (please complete the following information):

Additional context

James-Yu commented 5 years ago

Package highlight not supported officially. PR welcomed.

jlelong commented 5 years ago

It already work for the minted environment. I will add syntax highlighting support for \mintinline in the coming days.

gusbemacbe commented 5 years ago

@jlelong , you forgot of including the $ to regex.

For example, put \mintline{php}{<?php echo "Hello $name, how are you?" ?>}. As containing $, it still breaks the highlighting.

jlelong commented 5 years ago

The correct command is mintinline and not mintline. If you try with \mintinline{php}{<?php echo "Hello $name, how are you?" ?>}, you will see that it works.

gusbemacbe commented 5 years ago

Then, I misspelled, but with the correct command, it still breaks too. Here is the screenshot:

image

jlelong commented 5 years ago

I does work when the command is on its own line but there is still an issue when used in the middle of a paragraph. I will fix it.

Note that fixes are only pushed to the master branch and they appear in the next release. From your screenshot, I think you are testing with the latest stable release.

gusbemacbe commented 5 years ago

I am using 5.17.2, is it the latest?

jlelong commented 5 years ago

Yes. To be clear, if you do not compile the extension yourself from the master branch, you won't see any fix until a new version is released.

gusbemacbe commented 5 years ago

I downloaded the master file, copied to the extensions, I tested and it worked, but I can not build the LaTeX file.

jlelong commented 5 years ago

You need a node.js environment to properly run the extension from the master branch. Probably best to wait for a new release. I only modified LaTeX.plist, you may try to only copy this file.

gusbemacbe commented 5 years ago

It worked now. But will you add support for the package verbments? Check the screenshot in the which pyglist belongs to this package:

image

You can check the package verbments. You can find the list of codes in the small documentation. It is mostly used in the @gcedo's Thesis Polimi template.