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

Markdown citation syntax not highlighted correctly #1038

Closed
daijiang opened this issue Nov 9, 2021 · 6 comments
Closed

Markdown citation syntax not highlighted correctly #1038

daijiang opened this issue Nov 9, 2021 · 6 comments
Labels
Area: Editor theming Decorations and highlighting in editor.

Comments

@daijiang
Copy link

daijiang commented Nov 9, 2021

Hi,
I am writing a paper with markdown using VSCode. But the citations were not highlighted correctly.

image

Any idea how to fix this?
Thanks!

@Lemmingh Lemmingh added the Area: Editor theming Decorations and highlighting in editor. label Nov 10, 2021
@Lemmingh
Copy link
Collaborator

Do you mean shortcut reference link?

Such things require semantic information, which cannot be achieved with TextMate grammar.

I think Semantic Highlighting is the way out. But as discussed somewhere before, we need to get a Markdown processor that provides very precise source mapping.


In case you're interested in VS Code's architecture of syntax highlighting:

@daijiang
Copy link
Author

It is not shortcut reference link since [@citationKey] it is regular text.
I think it just requires to update the match pattern to highlight. For example, in the attached screenshot, line 2 works (highlighted) but line 3 was not highlighted (because of a space after ;).
Thanks!

@yzhang-gh
Copy link
Owner

Those [@text] in line 1 and line 2 happen to get highlighted because VS Code thinks they are reference links.
There is no concept of citations in Markdown. So the result is as expected.

@daijiang
Copy link
Author

So basically there is no way to get all citations correctly highlighted in VS Code?

@yzhang-gh
Copy link
Owner

yzhang-gh commented Nov 10, 2021

You can use Highlight extension.
Of course a little knowledge about regular expressions is required. Probably you can try \[@[^\]]*\].

@daijiang
Copy link
Author

Thanks! I'll check that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Editor theming Decorations and highlighting in editor.
Projects
None yet
Development

No branches or pull requests

3 participants