feat(parser): add icon support for code blocks#462
feat(parser): add icon support for code blocks#462mrnasil wants to merge 2 commits intonuxt-content:mainfrom
Conversation
Add support for icon syntax in code block meta:
- `[filename|icon]` - filename with icon on left
- `[filename|icon|right]` - filename with icon on right
- `[|icon|position]` - icon only without filename
Changes:
- Update parseThematicBlock to extract icon and iconPosition
- Pass icon props to ProsePre component
- Add basic icon/filename header rendering in ProsePre
- Add comprehensive tests for icon parsing
Syntax example:
```python [Script|logos:python|right]
print("test")
```
|
I've opened a PR in nuxt/ui that implements the UI side of this feature: nuxt/ui#5953. Also waiting for this to be merged to fully unlock the functionality. Thanks! |
|
@farnabaz When you get a chance, can you check this out? I need a structure like this for my documentation page. Creating a custom component didn’t seem worth it. Many docs also need icons for different languages or different types of explanations, I think. |
|
Thanks for the PR @mrnasil You can use code block meta to pass these information to your component and use it there. And in I'm closing this PR in favor of meta prop. |
Summary
[filename|icon|position]iconandiconPositionfrom code block syntaxProsePrecomponentSyntax
[filename|icon][filename|icon|right][|icon|position][filename]Test plan
Notes
For full icon rendering support with
@nuxt/ui, a separate PR to nuxt/ui is needed to handleiconPositioninCodeGroup.vue.