diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index b88834e..bdfde2a 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,6 @@ references: - v+ + - master name-template: 'v$RESOLVED_VERSION 🌈' tag-template: 'v$RESOLVED_VERSION' categories: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5f0ddae --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM ruby:2.6 + +ENV LC_ALL C.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +WORKDIR /usr/src/app + +COPY Gemfile just-the-docs.gemspec ./ +RUN gem install bundler && bundle install + +EXPOSE 4000 + diff --git a/README.md b/README.md index 90dfb6f..4d1c1e8 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ Or install it yourself as: $ gem install just-the-docs +Alternatively, you can run it inside Docker while developing your site + + $ docker-compose up + ## Usage [View the documentation](https://pmarsceill.github.io/just-the-docs/) for usage information. diff --git a/_config.yml b/_config.yml index bcde0a2..9800b4f 100644 --- a/_config.yml +++ b/_config.yml @@ -99,6 +99,11 @@ ga_tracking_anonymize_ip: true # Use GDPR compliant Google Analytics settings (t plugins: - jekyll-seo-tag +kramdown: + syntax_highlighter_opts: + block: + line_numbers: false + compress_html: clippings: all comments: all @@ -106,3 +111,5 @@ compress_html: startings: [] blanklines: false profile: false + # ignore: + # envs: all diff --git a/_includes/fix_linenos.html b/_includes/fix_linenos.html new file mode 100644 index 0000000..6243fb0 --- /dev/null +++ b/_includes/fix_linenos.html @@ -0,0 +1,65 @@ +{%- comment -%} +This file can be used to fix the HTML produced by Jekyll for highlighted +code with line numbers. + +It works with `{% highlight some_language linenos %}...{% endhighlight %}` +and with the Kramdown option to add line numbers to fenced code. + +The implementation was derived from the workaround provided by +Dmitry Hrabrov (DeXP) at +https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-188144901 + +EXPLANATION + +The HTML produced by Rouge highlighting with lie numbers is of the form +`code table`. Jekyll (<= 4.1.1) always wraps the highlighted HTML +with `pre`. This wrapping is not only unnecessary, but also transforms +the conforming HTML produced by Rouge to non-conforming HTML, which +results in HTML validation error reports. + +The fix removes the outer `pre` tags whenever they contain the pattern +``. + +Apart from avoiding HTML validation errors, the fix allows the use of +the [Jekyll layout for compressing HTML](http://jch.penibelst.de), +which relies on `pre` tags not being nested, according to +https://github.com/penibelst/jekyll-compress-html/issues/71#issuecomment-172069842 + +USAGE + +(Any names can be used for `some_var` and `some_language`.) + +{% capture some_var %} +{% highlight some_language linenos %} +Some code +{% endhighlight %} +{% endcapture %} +{% include fix_linenos.html code=some_var %} + +For code fences: + +{% capture some_var %} +```some_language +Some code +``` +{% endcapture %} +{% assign some_var = some_var | markdownify %} +{% include fix_linenos.html code=some_var %} + +CAVEATS + +The above does not work when `Some code` happens to contain the matched string +`
`. + +The use of this file overwrites the variable `fix_linenos_code` with `nil`. + +{%- endcomment -%} + +{% assign fix_linenos_code = include.code %} +{% if fix_linenos_code contains '
' %} + {% assign fix_linenos_code = fix_linenos_code | replace: '
', '
' %}
+  {% assign fix_linenos_code = fix_linenos_code | replace: "
", "" %} +{% endif %} +{{ fix_linenos_code }} +{% assign fix_linenos_code = nil %} diff --git a/_includes/head.html b/_includes/head.html index 4f22497..c0f73d7 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -10,9 +10,9 @@ {% endif %} {% endunless %} - + - + {% if site.ga_tracking != nil %} @@ -27,9 +27,9 @@ {% endif %} {% if site.search_enabled != false %} - + {% endif %} - + diff --git a/_includes/nav.html b/_includes/nav.html index f2ec7e5..2eafe51 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -1,6 +1,6 @@