# [Geany-Devel] patches to extend Markdown syntax highlighting

Carsten Allefeld carsten.allefeld at xxxxx
Sun Jun 2 13:50:58 UTC 2013

Hello,

I recently cooked up a few minor patches to geany and sent them to
Nick, see email quoted below. He told me it would be best if I
subscribe to this list, so here I am.

About me: I am a physicist-turned-neuroscientist, and I write texts
including equations on a daily basis. Of course LaTeX is the
established tool for that, but though it is very powerful it is also
incredibly cumbersome to use. If you're writing just a short note the
preamble can be longer than the actual text, you have to type \ { }
and long environment and command names all the time, if you just make
a small mistake you get cryptic unhelpful error messages, etc. etc. I
guess that's why MS Word is so popular. ;-) However, writing formulas
in anything else than LaTeX is even more cumbersome. That is why I was
happy to find out that pandoc, a popular Markdown processor, supports
LaTeX output and just copies LaTeX equations from the Markdown source
into the LaTeX source. Great, the only thing missing is a versatile
editor / lightweight IDE, and this is where Geany comes in. I wrote a
few wrapper scripts in order to start Markdown+LaTeX processing from
Geany through pandoc & pdflatex and show the result in acroread. – As
I wrote below, I'm not a developer. I know some programming languages,
including C and a bit of C++, but the only one I use regularly is
Matlab.

An addition to the email below: I have found since that the syntax
highlighting especially of display equation blocks "$$-$$", but also
of embedded images "![]()" is very unstable. It is possible that this
is due to a bug introduced by me, but I don't see how since I
basically duplicated existing code. Do you have any other reports
about problems with the Markdown syntax highlighting code?

Cheers,
Carsten

On 26 May 2013 15:28, Carsten Allefeld <carsten.allefeld at googlemail.com> wrote:
> Hello,
>
> I hope this is the right way to contact you, if not please tell me
> how. I'm writing because I put together a few small patches to geany
> to extend the syntax highlighting. I did not subscribe to the
> developer mailing list because I am not a professional developer, just
> someone who can find his way around a source file, and I'm unlikely to
> contribute much more in the future.
>
> The background is the following: Markdown comes in many flavors, one
> of the most popular is the implementation in Pandoc
> <http://johnmacfarlane.net/pandoc/>. Pandoc supports several backends,
> besides html also docx and LaTeX. One of Pandoc's Markdown extensions
> is to allow LaTeX-style equations in the Markdown text, which are
> copied as-is if converting to LaTeX, but also if generating html,
> since there are high-quality math typesetting libraries for websites
> implemented in JavaScript (most notably MathJax
> <http://www.mathjax.org/>) that can render them. As a scientist I use
> this feature of Pandoc very extensively. When I recently discovered
> geany as a high-quality text editor supporting Markdown syntax
> highlighting, one of the few things I missed is highlighting of
> embedded equations.
>
> The attached patches, generated via diff -u versus geany-1.23.tar.gz,
> enable this. The changes basically duplicate the code for syntax
> highlighting of inline code (x) and code blocks (indented), and use
> them to enable highlighting of inline equations ($x$) and block
> equations ($$x$$). I included changes to filetypes.markdown, which
> defines styles for the new attributes mathi and mathd, but also
> revises the highlighting styles for other Markdown attributes.
>
> Three of the six patches actually apply to Scintilla, which I
> understand is a project whose code is included in geany, but developed
> independently. I considered contacting the Scintilla developers, but
> since the changes to Scintilla only make sense if combined with
> changes to geany, I thought it better to contact you.
>
> Best Regards,
> Carsten Allefeld
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patches.zip
Type: application/zip
Size: 2769 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20130602/8a3d4d69/attachment.zip>