code syntax highlighting in svg image
Hi Everyone
I've been away from inkscape for a few years but I am looking forward to doing another project with it.
I am trying to create a little book/pamphlet that has coloured syntax highlighting of code.
It looks like there was a plug-in that would have been perfect, inksyntax, but it seems abandoned.
Here is the dead link:
The project seems to have been built on highlight and pygments.
The highlight command works great for me and now I have a svg of the code sample with syntax highlighting.
The problem is the svg utilizes an external css sheet and inkscape and scribus cannot handle it.
I am wondering if there is some tool to reintegrate the external css sheet back to inline or if if anyone has any suggestions on how I can accomplish my goal?
Thanks for reading-Patrick
On 12/08/2012 00:19, Patrick wrote:
I am trying to create a little book/pamphlet that has coloured syntax highlighting of code.
It looks like there was a plug-in that would have been perfect, inksyntax, but it seems abandoned.
Here is the dead link:
The project seems to have been built on highlight and pygments.
The highlight command works great for me and now I have a svg of the code sample with syntax highlighting.
The problem is the svg utilizes an external css sheet and inkscape and scribus cannot handle it.
I am wondering if there is some tool to reintegrate the external css sheet back to inline or if if anyone has any suggestions on how I can accomplish my goal?
Attaching the source tarballs of inksyntax v0.1 and v0.1.1 (archived locally, downloaded in late 2009) - maybe this helps (AFAICT basic features work ok [1] in current Inkscape - see attached sample SVG generated with Inkscape 0.48.3.1, InkSyntax 0.1.1, pygments 1.4, python 2.7.3).
~suv
[1] Unicode handling (?) possibly needs some rework (based on the attached sample) - but it could also be a local issue with the external python modules required by the extension on OS X (I didn't further investigate).
On Sat, 11 Aug 2012 18:19:28 -0400 Patrick <patrick@...2971...> wrote:
I am wondering if there is some tool to reintegrate the external css sheet back to inline or if if anyone has any suggestions on how I can accomplish my goal?
This nearly works:
Edit code with editor that has syntax highlighting /and/ html export. Vim is fine.
Use html2ps -U to convert to Postcript
Import to Inkscape (0.47 does it 1 page at a time)
Break down the multiple levels of grouping.
The only problem I can see is that the indentation is a bit wonky, with the first non-blank character of some indented lines being split from the remainder of the line. This comes when the end of one line is the same colour as the start of the next and the two bits are created as separate tspans in one text element. If couldn't tune it out in the many options to html2psrc I'd write something to hack the svg. Which is what the attached program snippet is doing anyway, hence using it as an example ;-)
Maybe Inkscape simply doesn't like my brace-indentation style.....
Mike
participants (3)
-
Mike Causer
-
Patrick
-
~suv