Storybook-readme: Change the highlight library?

Created on 21 Mar 2019  路  6Comments  路  Source: tuchk4/storybook-readme

I know you are highlighting the code block with highlight.js. But this library was not support well with JSX syntax. So I think if we can change the highlight library would be better(Prismjs support JSX well). Of course, highlight.js support more themes, but I think support JSX is more important.

Most helpful comment

If it will not be so hard to replace highlightjs with prism I do it in 5.0.2

All 6 comments

If it will not be so hard to replace highlightjs with prism I do it in 5.0.2

I think an easy mean time solution would be a flag to disable the theme all together and let us theme it with prism...

readme: {
    /**
     * Highlightjs code theme
     * Import theme at _.storybook/config.js_.
     * Full list of theme https://highlightjs.org/static/demo/.
     */
    codeTheme: null, <<< SOMTHING LIKE THIS to disable theming
  },

I opened PR with 100% working code switched to Prism.
There is one problem -- themes.

Here is the official github colors theme taken from here https://github.com/PrismJS/prism-themes
It does not look beautiful :(

image

Tomorrow will check it again, update docs and going to release new version with all features/bugs listed at #153 153

Update CSS for prism github color theme.
Now looks awesome

image

published 5.0.2

NOTE about theme changes (old themes are not compatible with Prism thats why maybe some breaking changes if custom configured). I have added custom console.warn if using unexisting theme with helpful message.

Prism code theme

Full list of theme https://github.com/PrismJS/prism-themes
To be used with storybook-readme, naming of the code theme should be used in one of these styles. https://github.com/tuchk4/storybook-readme/tree/master/packages/storybook-readme/src/styles/prismCodeThemes

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robcaldecottvelo picture robcaldecottvelo  路  5Comments

PaulieScanlon picture PaulieScanlon  路  5Comments

chemoish picture chemoish  路  5Comments

deehuey picture deehuey  路  3Comments

janusch picture janusch  路  4Comments