Hey,
can someone help me with formatting XQuery code with Markdown/Kramdown on Github pages?
The syntax highlighting looks super crappy on https://sirix.io
Kind regards
Johannes
Hey,
can someone help me with formatting XQuery code with Markdown/Kramdown on Github pages?
The syntax highlighting looks super crappy on https://sirix.io
Kind regards
Johannes
```xquery
your code
If you hit Rougeâs (Jekyllâs syntax highlighter) homepage you can drop in some code and change the languages to get a feel for how itâll look highlighted.
I think the problem might be that Github pages uses Kramdown with highlighter Rouge and Rouge doesnât seem to support XQuery. The landing page is simply HTML, but I checked here:
https://sirix.io/xquery-api.html
I simply put in the code snipped so you can search for it. In the Github preview it works, but not on the Jekyll generated site.
Source is here: https://github.com/sirixdb/sirixdb.github.io/blob/master/xquery-api.md
Oh sorry, you mentioned Rouge, hmmm
Okay, itâs not generating the HTML code as for the Java highlighting somehow:
<pre><code class="xquery-highlighter">XQUERY</code></pre>
Do you have the stylesheet for the styles? this is often overlooked, it is not included anywhere by default.
info here: https://jekyllrb.com/docs/liquid/tags/#stylesheets-for-syntax-highlighting
Yes:
At the very bottom and Java highlighting is working. However, the div and span HTML elements are not generated.
I think my posting title is not accurate⌠the HTML is not even generated.
guess I am not clear on what the issue is, this page looks good to me:
https://sirix.io/xquery-api.html
which particular part of it is not correct? the code blocks look good - I see some single line things that are not highlighted, is that your issue?
I do see some blocks that donât have much styling, but it looks like they were set to XML and there doesnât look to be any XML syntax to highlight.
I think your problem is that XQuery is not supported by the version of Rouge in Jekyll? not positive but I think that might be the issue.
Here is a list of languages that are supported, not sure how current it is:
Might not be perfect but you might just try telling it is some other language - like java or js and see what it does. Clearly it doesnât like xquery.
Looks like Rouge supports it. But like you said Jekyll might not be using the latest Rouge.
@johannes.lichtenberg are you using Jekyll v4? It bumped Rouge to 3.0 which likely has the new lexers to do xquery syntax highlighting. Might be worth upgrading to see if thatâs your issue.
From the Link you provided⌠Github Pages does seem to use a very old Rouge version Iâve written the Support Team and in their Forum, weâll see if they update the dependency
It will likely get updated when they update to Jekyll 4. In my experience that can take some time as they need to review all of the gems for security implications.
There are several pull requests in the que already for updating other dependencies GitHub Pages uses, https://github.com/github/pages-gem/pulls
Along with this issue for updating to 4.0
And this PR to update Rouge has been sitting since April of 2018
Hm, are there other sites where I can host my website for free as Iâm already paying for the domain and other stuff and itâs all Open Source, meaning I make no money, just spending a lot of my spare time around the project
And Iâd really need this Syntax Highlighting, as Iâm providing more or less JSONiq support. So the query language is basically XQuery. Plus I want to release 1.0.0 very soon
Yes there are several. Iâd suggest Netlify.
Seems to be the same issue!?
For instance on this page: https://sirixdb.netlify.com/xquery-api.html
If you search for the following snippet it isnât formatted either (just made a quick test as of now):
let $statuses := jn:open('mycol.jn','mydoc.jn', xs:dateTime('2019-04-13T16:24:27Z'))=>statuses
let $foundStatus := for $status in bit:array-values($statuses)
let $dateTimeCreated := xs:dateTime($status=>created_at)
where $dateTimeCreated > xs:dateTime("2018-02-01T00:00:00") and not(exists(jn:previous($status)))
order by $dateTimeCreated
return $status
return {"revision": sdb:revision($foundStatus), $foundStatus{text}}
@mmistakes, do you know which Rouge version they are using?
Netlfiy uses whatever version you want, itâs not like GitHub Pages where they use an older set of white-listed gems (e.g. Jekyll 3 and friends).
Whatever gems (or Jekyll plugins) you have in your Gemfile
Netlify will use and build your site. Just update to Jekyll 4 there and make sure everything works locally. Then configure with Netlify and itâll build your site everytime you commit to GitHub⌠same as GH Pages does.
Ah yeah, just tried to update to Jekyll 4:
3:40:36 PM: Bundler could not find compatible versions for gem âjekyllâ:
3:40:36 PM: In Gemfile:
3:40:36 PM: jekyll (~> 4.0)
3:40:36 PM: jekyll-theme-midnight was resolved to 0.0.4, which depends on
3:40:36 PM: jekyll (~> 3.3)
Ha, it worked. Thanks a lot:
http://sirixdb.netlify.com/xquery-api.html
Now Iâll change my DNS records, such that https://sirix.io points to netlify