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@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
On 2 June 2013 23:50, Carsten Allefeld carsten.allefeld@googlemail.comwrote:
Hello,
Hi,
As you say in your original email, Scintilla is a separate project. We try not to have a modified Scintilla since that implies patching and testing every time there is an update. So you should submit the Scintilla patches to that project at www.scintilla.org. If you feel that the Markdown lexing is buggy, that is also where you should discuss it.
When the modified version of Scintilla is released we can apply the other patches, it would be best if you could make a pull request for them so they don't get forgotten.
I am not sure if the changes to the filetypes.markdown file affect only the math styles, if they don't you probably should discuss it first so we can see if other markdown users like or loath them.
Cheers Lex
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@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
Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Hello Lex,
As you say in your original email, Scintilla is a separate project. We try not to have a modified Scintilla since that implies patching and testing every time there is an update. So you should submit the Scintilla patches to that project at www.scintilla.org. If you feel that the Markdown lexing is buggy, that is also where you should discuss it.
thanks for your reply. I'll talk to the Scintilla folks then.
One other question: I assume you have good reasons for choosing Scintilla as the editor component, and generally it seems to be doing great. While looking into the syntax highlighting stuff though: I'm not convinced that Scintilla's approach of completely hard-coding the syntax hightlighting in C/++ is the way to go. I'm not an expert, but to me it seems that a syntax should be expressed in some specialized language (BNF? regexp? ...), which is either interpreted by the lexer engine or at least used as source to generate lexer code automatically. So, have you ever thought of replacing Scintilla's syntax highlighting code by your own? Before I came across Geany I used to use Kate, which uses such an approach. However, syntaxes for Kate are written in XML which imho isn't the right choice either...
I am not sure if the changes to the filetypes.markdown file affect only the math styles, if they don't you probably should discuss it first so we can see if other markdown users like or loath them.
I changed more than that, true, and I don't claim the colors I chose are necessarily the "best". However, in the original color scheme many aspects of Markdown syntax weren't distinguished at all – many things were just set to appear black on white like normal text. What's the use of syntax highlighting if it's invisible?
Cheers, Carsten