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

embedded languages in codeblocks #2

Closed
clason opened this issue Mar 26, 2022 · 5 comments · Fixed by #65
Closed

embedded languages in codeblocks #2

clason opened this issue Mar 26, 2022 · 5 comments · Fixed by #65

Comments

@clason
Copy link
Member

clason commented Mar 26, 2022

This is a moonshot, but would it be possible (at least in principle) to detect the language of a code_block? In contrast to Markdown, Vimdoc doesn't use language markers, so it's nigh impossible to set up proper injections for them. At least being able to distinguish Lua/Vimscript/Other (the last highlighted as plain string) would be great.

@clason
Copy link
Member Author

clason commented Sep 20, 2022

Proposal from #16:

Support lua> and vim> as injected code-block markers and add these to https://github.com/neovim/neovim/blob/cfdc93e8ac3e6c1577f1582c4b9546c118aa7987/runtime/syntax/help.vim#L18

Then we can use these markers in our help files and users on legacy syntax won't see a difference while tree-sitter can highlight them accordingly.

@clason
Copy link
Member Author

clason commented Sep 20, 2022

(or >lua, to have some parallel with Markdown syntax?)

@justinmk
Copy link
Member

I lean towards keep the > as the last thing on the line, to avoid forking vimdoc syntax where possible (gracefully degrades).

@clason
Copy link
Member Author

clason commented Sep 20, 2022

I think we want to add this to the syntax file anyway, to conceal the language annotation? (But I prefer lua> as well.)

@justinmk justinmk changed the title Automatic language detection for codeblocks embedded languages in codeblocks Oct 9, 2022
@clason
Copy link
Member Author

clason commented Oct 24, 2022

Related (since I just noticed this in the README): line-modeline could inject the viml language.

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

Successfully merging a pull request may close this issue.

2 participants