prismsvg

1.0.5 • Public • Published

prismsvg

Prismjs tweaked to output SVGs.

This is a somewhat dirty adaptation of Prism.js to be able to output SVGs. So you have some code, this produces a syntax highlighted SVG as a result.

    <svg height="3em" width="400" >
        <text y="20" class="language-jsx"
          Your source code here
        >
        </text>
    </svg>

And this will output a bunch of tspan nodes with the right classes for syntax highlighting.

This package includes also a css file with the light solarized theme adapted to work with SVGs.

I have copy&pasted the languages that I needed from Prism.js. It should be easy to use your own languages as long as you keep calling prismsvg.js and prism-cr.js.

I don't know if this is useful for somebody else, so I have just done what I needed. If you want to use this and your use case is not supported, feel free to open an issue. Thanks.

Readme

Keywords

none

Package Sidebar

Install

npm i prismsvg

Weekly Downloads

0

Version

1.0.5

License

MIT

Last publish

Collaborators

  • nacmartin