Skip to content

nacmartin/prismsvg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Prismjs tweaked to output svgs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published