tjaartvdwalt/jekyll-org-mode-converter

no syntax highlighting + KaTeX messes up at times

ggegoge opened this issue · 3 comments

Hi,

first of all I'd like to thank you for this plug-in. Out of other options for using org with Jekyll this seems to be the best one. It works very well indeed! Nevertheless there are at least two issues I have discovered.

syntax highlighting in code blocks

It does't work. When doing something like

#+BEGIN_SRC python
  def f(x):
      if x == 1:
          print("one")
      else:
          print("definitely not one")
#+END_SRC

I get the code block in the rendered page but it lacks syntax highlighting. It is quite bad to be frank because it is much harder to read that way.

Katex

There are problems when using Katex (jekyll-katex) with your plugin. It works most of the time but for some reason $$2^\alpeh$$ gets rendered correctly whereas $$2^{\aleph_0}$$ does not -- in general exponents in curly brackets do not work.

yaml

it is not an issue but rather a question/enhancement proposition -- why keep the yaml headers eg

---
layout: post
title:  "org kyll"
date:   2021-02-17 20:40:00 +0100
---

instead of adapting the org style somehow? I mean something like

#+LAYOUT: post
#+TITLE:  "org kyll"
#+DATE:   2021-02-17 20:40:00 +0100

if I knew more ruby I'd try to implement something like that but I do not know a single thing about ruby unfortunately.

but this is not that important of course. The code listing issue is I think.

ok I kinda solved it myself and I feel quite dumb now.

So as I read at jekyll's page there has been a big change in the whole mechanism of syntax highlighting. I went to see org-ruby and I saw an issue there about exactly that. And someone actually fixed that with their PR. Unfortunately it wasn't pulled but I have fixed it manually in my gem files (and then I rebuilt it) and now it works the way it should. So that is nice.

About Katex I still don't know what is the issue. But most probably it is still org-ruby's problem so my issue may be misplaced. Please close it if you see fit.

Though the idea of using org style #+ tags for layout, title etc still seems pretty good to me!

ok. I figured everything out myself.

  1. about syntax highlighting -- as stated above by me
  2. about KaTeX -- as I have thought the problem is on org-ruby's side. In file [html_output_buffer.rb](https://github.com/bdewey/org-ruby/blob/e4a6e7d4b351261a70b315c8833ec6da6f42438d/lib/org-ruby/html_output_buffer.rb#L283) on line 283 there is this option of using sub/superscript in html. Then something like n^{2n}gets transformed into I thinkn2nand that causes the issue with LaTeX/KaTeX. This is an option to be specified but unfortunately even though I tried doing{use_sub_superscripts: false}` it didn't work but perhaps I don't really understand the mechanism of options in there. A temporary work-around is to comment out the fragment responsible for the conversion of sup/sub_scrits
  3. using org options instead of yaml: it seems like it is pretty not hard to do actually (perhaps I'll try if I learn some more ruby) since the parsed object org-ruby returns has a method in_buffer_settings which provides a hash with all those settings so it is potentially quite easy to replace yaml with that.

In conclusion, most of these issues is due to either long awaited not pulled PRs in org-ruby or due to some esoteric settings over there. About yaml settings it is as I have said: potentially an easy thing to do.

Hence I consider this issue to be actually resolved. Sorry for bothering you

Hi @ggegoge

To disable this sub/super script, have you tried adding #+OPTIONS: ^: nil to the headers?
I think this in_buffer_settings are to support this kind of org export settings and org-ruby supports some of them.