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

Add support for formatter options #8

Open
1 task
leafac opened this issue Mar 26, 2020 · 2 comments
Open
1 task

Add support for formatter options #8

leafac opened this issue Mar 26, 2020 · 2 comments

Comments

@leafac
Copy link
Member

leafac commented Mar 26, 2020

#6 (comment)

  • stripnl

See formatter options at https://pygments.org/docs/formatters/#LatexFormatter

@h-2
Copy link

h-2 commented Apr 29, 2020

I think texcomments is the only thing that I am still missing, everything else works perfectly for me now. I have tried playing around with the code a little, but not luck so far.

How would I detect if content is inside a comment or not?

@leafac
Copy link
Member Author

leafac commented May 5, 2020

How would I detect if content is inside a comment or not?

The result of the call to highlighter.codeToThemedTokens() includes not only the color with which to highlight a token, but also an explanation. This explanation tells you the kind of token, which in Visual Studio Code lingo is called a scope. You can inspect the scope to determine if a token is a comment.

To learn more about this, you can play around in Visual Studio Code: open a file, hit ⌘⇧P, activate the option Developer: Inspect Editor Tokens and Scopes, and move your cursor around:

Screen Shot 2020-05-05 at 11 17 45

That said, I must admit that when I implemented the support for mathescape I did none of this. I don’t check whether a token is a comment; I simply check if a token contains $, which is a hack that works most of the time.

We should probably fix this.

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