Skip to content

Feat: syntax highlighting in markdown code blocks #195

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

Conversation

LoicRiegel
Copy link
Contributor

Feature: add syntax highlighting inside nushell codeblocks in markdown files

Issue #192

Adds syntax highlighting for nushell code blocks when editing markdown files inside VS code

The code is very inspired from this repo.

⚠️ The syntax highlighting still is not available when opening the Preview of the md files in VS code. VS code uses something else (highlight.js) so that will be done and somewhere else I guess.

How to test

  1. Clone the branch
  2. Start debugging (F5) in VS Code
  3. Open a md files, create a nushell code block and start typing nushell code

Result

2025-03-10_23h17_14

@fdncred
Copy link
Contributor

fdncred commented Mar 11, 2025

I don't understand. What's the point of this PR if it doesn't highlight the text in markdown?

@LoicRiegel
Copy link
Contributor Author

It does while editing markdown files (left part of the screenshot). Currently we don't have syntax highlighting injected here, only while editing .nu files.

What still does not work is the right of the screenshot, the preview mode.

@LoicRiegel
Copy link
Contributor Author

Yes, it will require some more work to have syntax highlighting in preview mode: see on discord.

I think this PR is independent and can be merged. Also I don't know if you saw it but I opened 2 more PRs in this repo :)

@fdncred fdncred merged commit 1261139 into nushell:main Mar 24, 2025
1 check passed
@fdncred
Copy link
Contributor

fdncred commented Mar 24, 2025

ok, let's give it a try. thanks!

@LoicRiegel
Copy link
Contributor Author

You're welcome, thx for merging that!

In the meantime, I started to work on a nushell's highlightjs plugin: it's far from ready yet, but you can have a look if you want: https://github.com/LoicRiegel/highlightjs-nushell

But yeah this PR was independent, and I think it's already nice to have the syntax highlighting while editing .nu files.

How does the release process work here? Is there some more testing involved before publishing? Also when do you decide to do a release? I see that the last version was published a long time ago: sept 2024, but maybe there hasn't been much changes since then

@fdncred
Copy link
Contributor

fdncred commented Mar 24, 2025

How does the release process work here?

it's a pain. i do the release. it's kind of documented, or it was somewhere in this repo.

Is there some more testing involved before publishing?

nope.

Also when do you decide to do a release?

whenever there's enough prs or the nushell language has changed enough

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 this pull request may close these issues.

2 participants