Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add nushell support #331

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

Open
niklas-heer wants to merge 3 commits into maaslalani:main
base: main
Choose a base branch
Loading
from niklas-heer:feat/add-nushell-support

Conversation

Copy link

@niklas-heer niklas-heer commented Aug 27, 2025
edited
Loading

I love this tool! I added a small modification to support my favourite shell, nushell, a new kind of shell where everything is structured data.

After some polishing and adding tests, I thought it was time to contribute my changes back.

Thank you so much for creating this great tool, @maaslalani! 🙏
I hope my contribution is up to your standards. Please let me know if I should change anything.

Summary

slides with nushell

Code Structure

slides/
├── internal/
│ ├── code/
│ │ ├── languages.go # Enhanced with nushell support
│ │ ├── execute_test.go # Added nushell execution tests
│ └── syntax/ # New module for syntax highlighting
│ ├── nushell.go # Nushell highlighting logic
│ └── nushell_test.go # Comprehensive test suite
└── examples/
 └── code_blocks.md # Enhanced nushell examples

🎨 How Syntax Highlighting Works

The Problem

  • Chroma (used by Glamour) doesn't natively support nushell syntax highlighting
  • Code blocks with nu identifiers showed as plain text

The Solution

  1. Preprocessing: Before markdown is rendered, replace nu` with bash`
  2. Fallback: Bash syntax highlighting provides reasonable highlighting for most nushell syntax
  3. Future-Proof: System ready for native nushell support when available in Chroma

Code Flow

Markdown Input → Syntax Preprocessing → Glamour/Chroma → Highlighted Output
 ↓ ↓ ↓ ↓
```nu → ```bash → Chroma → Highlighted
echo "hi" echo "hi" Lexer Code Block
``` ``` 

Testing

  • Built and tested locally with make test
  • Verified compilation with make build
  • Test with actual nushell code blocks in markdown presentations
  • Added nushell syntax highlighting
make test
go test ./... -short
? 	github.com/maaslalani/slides	[no test files]
? 	github.com/maaslalani/slides/internal/cmd	[no test files]
? 	github.com/maaslalani/slides/internal/model	[no test files]
? 	github.com/maaslalani/slides/internal/server	[no test files]
ok 	github.com/maaslalani/slides/internal/code	0.752s
ok 	github.com/maaslalani/slides/internal/file	(cached)
ok 	github.com/maaslalani/slides/internal/meta	(cached)
ok 	github.com/maaslalani/slides/internal/navigation	(cached)
ok 	github.com/maaslalani/slides/internal/process	(cached)
ok 	github.com/maaslalani/slides/internal/syntax	0.552s
ok 	github.com/maaslalani/slides/styles	(cached)

🤖 Created with the help of Claude Sonnet 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /