XQuery Syntax Highlighting, can't find stylesheets


can someone help me with formatting XQuery code with Markdown/Kramdown on Github pages?

The syntax highlighting looks super crappy on https://sirix.io :frowning:

Kind regards


  1. You need to define the language with your codeblock, this will help with styling… e.g.
    your code
  2. You’ll need CSS to support different colors and such. Looks like the theme you’re using is purposely plain in terms of syntax highlighted code blocks.

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:


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


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:


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 :frowning: I’ve written the Support Team and in their Forum, we’ll see if they update the dependency :slight_smile:

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 :wink:

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 :slight_smile:

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:


Now I’ll change my DNS records, such that https://sirix.io points to netlify :slight_smile:

1 Like