-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Syntax highlighting for C# #7847
Comments
We're using Can you try adding the folllowing to import { registerLanguage } from 'react-syntax-highlighter/prism-light';
import csharp from 'react-syntax-highlighter/languages/prism/csharp';
registerLanguage('C#', csharp); I don't have a good sense for the tradeoff of including this out of the box vs. making it a user configuration like the above. |
Thank you for the reply. I will try your suggestion. Sorry if this request was misguided, I assumed when I found a C# story for SyntaxHighlighter in the source this should just work. |
Hahaha, I just checked and the Right now we include |
@cgatian I added that story to showcase what happens if a language is given, but it's not installed. |
Is there a different approach for including csharp in SyntaxHighlighter these days? I'm having trouble getting something like this to work in the current version (6.2.9) of storybook. |
@epiknut We switched over to ESM in 6.2 which enables tree shaking, which removes hundreds of unused languages from the bundle & reduces its size/improves performance dramatically. i think to get custom highlighting back we'll probably need to switch to a different highlighting library |
@shilman I see. Good to know, thanks for the reply :) |
@epiknut @shilman this is how users can register extra languages: storybook/lib/components/src/syntaxhighlighter/syntaxhighlighter.tsx Lines 39 to 49 in 8b2517f
|
@ndelangen I can't make this work (in v7 alpha), did it break? |
Yeah i think this indeed breaks in 7.0. We'll have to come up with a better solution for this. |
Describe the bug
Code highlighting should work with C# in MDX stories
To Reproduce
SyntaxHighlighter
Expected behavior
Code highlighted
Screenshots
Code snippets
System:
Environment Info:
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Binaries:
Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
@storybook/addon-a11y: ^5.2.0-beta.38 => 5.2.0-beta.38
@storybook/addon-actions: ^5.2.0-beta.38 => 5.2.0-beta.38
@storybook/addon-docs: ^5.2.0-beta.38 => 5.2.0-beta.38
@storybook/addon-knobs: ^5.2.0-beta.38 => 5.2.0-beta.38
@storybook/addon-links: ^5.2.0-beta.38 => 5.2.0-beta.38
@storybook/addon-notes: ^5.2.0-beta.38 => 5.2.0-beta.38
@storybook/addon-viewport: ^5.2.0-beta.38 => 5.2.0-beta.38
@storybook/addons: ^5.2.0-beta.38 => 5.2.0-beta.38
@storybook/angular: ^5.2.0-beta.38 => 5.2.0-beta.38
The text was updated successfully, but these errors were encountered: