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 real Nushell syntax highlighting support #1078

Merged
merged 9 commits into from
Oct 2, 2023

Conversation

hustcer
Copy link
Collaborator

@hustcer hustcer commented Sep 28, 2023

Try to Add real Nushell syntax highlighting support to Nushell official site:

It may take a bit longer though let's just get started, the detailed plan:

  • Add Nushell syntax highlighting support to Shiki;
  • Use Shiki as Vuepress's syntax highlighter;
  • Create a patch if PR feat: Add nushell grammar shikijs/shiki#522 haven't get merged;
  • Update all Nu code blocks, wrap them with ```nushell ``` or ```nu ```;

@fdncred
Copy link
Collaborator

fdncred commented Sep 28, 2023

Nice work @hustcer. I'll be excited to see this (if 522 ever lands). I appreciate all your attention to our docs. Thank you so much!

@hustcer hustcer force-pushed the feature/syntax-highlighting branch from 8acab10 to 15d6c04 Compare October 2, 2023 09:59
@fdncred
Copy link
Collaborator

fdncred commented Oct 2, 2023

What's the deal with shiki? Do they not accept PRs very often?

@hustcer
Copy link
Collaborator Author

hustcer commented Oct 2, 2023

What's the deal with shiki? Do they not accept PRs very often?

They may accept it after a while, no one is taking care of the PRs now. And we can't wait for them for the uncertainty, we can add a patch as a workaround now and remove the patch if the PR got merged later.

@hustcer hustcer marked this pull request as ready for review October 2, 2023 12:20
@hustcer hustcer merged commit 63ee848 into nushell:main Oct 2, 2023
2 checks passed
@hustcer hustcer deleted the feature/syntax-highlighting branch October 2, 2023 12:22
@sholderbach
Copy link
Member

Thanks for pushing this forward @hustcer

Are there special rules in the grammar for how a table or prompt should look like?

Looking at a random assortment of prompts sometimes it highlights the code after a > and sometimes it doesn't.

@hustcer
Copy link
Collaborator Author

hustcer commented Oct 2, 2023

@sholderbach I'm simply using The Same Nu Grammar as the VS Code Plugin Here, maybe @fdncred knows?

@fdncred
Copy link
Collaborator

fdncred commented Oct 2, 2023

It's a regex fest for the grammar. It should behave identically, as far as syntax checking, as the extension. So, you could test by putting a > pipe | line in vscode and it should work the same. I'm not sure what that would do? You won't get sqigglys because that comes from nushell integration with the extension.

@sholderbach
Copy link
Member

The page looks generally fine even when prefixed with the > . I think the weird ones I observed were pages that did not yet have the new annotations.

@fdncred
Copy link
Collaborator

fdncred commented Oct 2, 2023

Also, the tables look a bit weird because the column names seem green-ish. Wondering if they should be in their own code fence?

@hustcer
Copy link
Collaborator Author

hustcer commented Oct 2, 2023

Also, the tables look a bit weird because the column names seem green-ish. Wondering if they should be in their own code fence?

It's better to update the grammar file to make those strings with # | in it is not taken as a comment.

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.

None yet

3 participants