Skip to content

[Bug]: Jekyll should not parse Liquid syntax inside code blocks (fenced with triple backticks). #9961

Description

@georgalis

Operating System

default github-pages

Ruby Version

unknown

Jekyll Version

Pull down action image 'ghcr.io/actions/jekyll-build-pages:v1.0.13'

GitHub Pages Version

Latest

Expected Behavior

I've not configured anything except enabling github pages on my repo. My github markdown contains bash code blocks (fenced with triple backticks), which includes here documents demonstrating synthesis of Latex. I was expecting markdown rendered into github ages. '{%' is legitimate latex code, open brace followed by a comment symbol and a new line where there is no whitespace after the open brace; or bash '{%s}' for a printf arg within brace.

Current Behavior

I got a Liquid syntax error relating to missing tag terminator, Tag '{%' was not properly terminated, however that was not a Liquid tag, it was legitimate Latex code, within a Bash here-document, within a markdown code block fenced with backticks. LLM says "Jekyll should not parse Liquid syntax inside code blocks" which sounds reasonable.

Relevant log output

To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
  Liquid Exception: Liquid syntax error (line 171): Tag '{%' was not properly terminated with regexp: /\%\}/ in know/texmf/texlive-font-discovery.md
/usr/local/bundle/gems/liquid-4.0.4/lib/liquid/block_body.rb:132:in `raise_missing_tag_terminator': Liquid syntax error (line 171): Tag '{%' was not properly terminated with regexp: /\%\}/ (Liquid::SyntaxError)

the first and last line of this highlight show examples of the problem (disregard the line numbers don't match above error line numbers)

https://github.com/georgalis/pub/commit/f34e949b58f31e3c2a107bc65b00ae0b9253f0db#diff-8bfb7f032f2183e81a71300306d45b49d1e5ed48518fb07b88ed25d5aa2d1e91R149-R164

Code Sample

Script

#!/usr/bin/env bash
# discover installed texlive font packages (.sty) and family definitions (.fd)

cat > "$sample_file" <<'TEXDOC'
\documentclass[10pt]{article}
\usepackage[T1]{fontenc}
\usepackage[margin=0.75in]{geometry}
\newcommand{\showfont}[2]{%
  \par\noindent\texttt{#1 / #2}\par
  {\fontfamily{#2}\selectfont
    The quick brown fox jumps over the lazy dog. 0123456789\par
    \textbf{Bold:} The quick brown fox jumps over the lazy dog.\par
    \textit{Italic:} The quick brown fox jumps over the lazy dog.\par
  }\medskip\hrule\medskip
}
\begin{document}
\section*{Installed Font Samples}
Generated by \texttt{texlive-font-discovery.sh}.\medskip\hrule\medskip
TEXDOC

printf '%s\n' "${fam_pairs[@]}" | sort -u \
  | while IFS=: read -r enc fam ; do
      printf '\\showfont{%s}{%s}\n' "$enc" "$fam"
    done >> "$sample_file"

echo '\end{document}' >> "$sample_file"
echo "# sample tex written: $sample_file" >&2
echo "# compile: pdflatex $sample_file" >&2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions