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 reference syntax highlighting grammar #2

Open
chrisjsewell opened this issue Feb 22, 2020 · 5 comments
Open

Add reference syntax highlighting grammar #2

chrisjsewell opened this issue Feb 22, 2020 · 5 comments
Assignees

Comments

@chrisjsewell
Copy link
Member

Myst is designed to be CommonMark compliant, therefore standard Markdown syntax highlighters will work with Myst and handle the common syntaxes. However, it would be desired to have an 'extended' syntax highlighter, to cover the additional syntax introduced by Myst.

The de facto standard for syntax grammar is the TextMate grammar file, with support in Eclipse, Atom, VSCode, Sublime, etc (jupyterlab/jupyterlab#5504 also discusses their potential incorporation). Therefore, it would be good to have a reference implementation (tested somehow?) in this package.

Here are some helpful links:

@chrisjsewell
Copy link
Member Author

chrisjsewell commented Feb 22, 2020

It should also be considered whether the specific syntaxes discussed in executablebooks/MyST-NB#12 would be incorporated here. For example with:

```{execute} python
print('hi')
```

It would be desired that the block content was syntax highlighted as python code.

Perhaps there could be a script that auto-generated grammar files with additional highlighting rules for specific directives.

@choldgraf
Copy link
Member

I think it sounds useful - how is this different from the LSP stuff?

Is the idea that the textmate grammar file would be the "official" reference implementation, then?

@chrisjsewell
Copy link
Member Author

chrisjsewell commented Feb 22, 2020

how is this different from the LSP stuff?

This is essentially a pre-cursor to a full LSP. LSP uses TextMate bundles for static syntax highlighting (there's actually no way yet to do it dynamically microsoft/language-server-protocol#18). The LSP then builds on this to add dynamic stuff like document outlines, auto-completion, linting, etc.

Is the idea that the textmate grammar file would be the "official" reference implementation, then?

Yep, then it could be used by editor specific extension packages, like for VS Code or Jupyter Lab (hopefully).

@chrisjsewell chrisjsewell self-assigned this Feb 24, 2020
@chrisjsewell chrisjsewell transferred this issue from executablebooks/MyST-Parser Mar 18, 2020
@chrisjsewell
Copy link
Member Author

chrisjsewell commented Mar 18, 2020

FYI @jstac @mmcky (see the readme for use)

@jstac
Copy link
Member

jstac commented Mar 18, 2020

Beautiful! @mtiley, @najuzilu, if you're using VS Code for the transfer project, this will significantly increase your QOL.

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

3 participants