Skip to content

Add strip-html-blank-lines Quarto filter for embedded HTML tables#287

Merged
cwickham merged 3 commits into
mainfrom
fix/quarto-hugo-blank-line-filter
May 29, 2026
Merged

Add strip-html-blank-lines Quarto filter for embedded HTML tables#287
cwickham merged 3 commits into
mainfrom
fix/quarto-hugo-blank-line-filter

Conversation

@cwickham
Copy link
Copy Markdown
Collaborator

@cwickham cwickham commented May 29, 2026

Summary

  • Hugo's Goldmark parser closes a CommonMark type 6 HTML block (one opened by <div>, <table>, etc.) at the first blank line. Pointblank validation reports and great-tables tables emit HTML with blank lines inside their wrapper <div>, which causes Goldmark to drop out of HTML mode mid-table and re-parse the rest as markdown — wrapping CSS in <p> tags and turning indented SVG payloads into <pre><code> blocks. The result is visibly broken table styling on rendered posts.
  • Adds a Quarto extension (content/_extensions/strip-html-blank-lines/) that collapses blank lines inside raw HTML blocks before they reach Hugo.
  • Opts the ported pointblank subdirectory in via a new content/blog/ported/pointblank/_metadata.yml, and re-renders the five posts in that subdirectory.
  • Fixes a pre-existing YAML strictness issue in lets-workshop-together/index.qmd (toc: notoc: false) that was blocking the re-render.
  • Documents the filter in content/blog/_authoring-guide.md so future authors hitting the same symptom know what to reach for.

This is the first of two PRs — once this lands, the polars libraries post (#286) can pick up the filter for the same fix.

Test plan

  • Netlify preview renders each pointblank post with intact table styling (no <p>-wrapped CSS, no <pre><code> SVG escapes):
    • /blog/2025-04-04_intro-pointblank/
    • /blog/2025-05-02_all-about-actions/
    • /blog/2025-05-20_overhauled-user-guide/
    • /blog/2025-06-03_lets-workshop-together/
    • /blog/2025-06-04_validation-libs-2025/
  • Authoring-guide section is clear about when to opt in

Pointblank and great-tables emit HTML output with blank lines inside
the wrapper <div>. Hugo's Goldmark closes a CommonMark type 6 HTML
block at the first blank line, which causes the rest of the table to
be parsed as markdown -- wrapping CSS in <p> tags and turning indented
SVG content into <pre><code> blocks. The result is a visibly broken
table on the rendered page.

This adds a Quarto extension that collapses blank lines inside raw
HTML blocks before Hugo sees them, wires it up across the ported
pointblank posts via _metadata.yml, and re-renders those posts. A
note in the authoring guide explains when to opt in.

Also fixes a pre-existing YAML strictness issue in lets-workshop-together
(toc: no -> toc: false) that was blocking re-render.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for posit-open-source canceled.

Name Link
🔨 Latest commit a3c2031
🔍 Latest deploy log https://app.netlify.com/projects/posit-open-source/deploys/6a19d82957946700086e8555

@github-actions
Copy link
Copy Markdown

Publishing checklist

  • Get a review — request at least one reviewer on this PR
  • Check your post — once the deploy preview is ready, a comment will appear with direct links to your post
  • Check the blog listing — confirm your post appears with the correct title, image, and description
  • Merge — once everything looks good and you have an approving review, merge to main

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 29, 2026

@cwickham cwickham marked this pull request as ready for review May 29, 2026 18:05
This post showcases pointblank validation tables (with the SVG-icon-in-cell
content that triggers the visible <pre><code>/escaped-HTML breakage), so it
needs the strip-html-blank-lines filter even though it lives under the
great-tables directory. Other great-tables posts only exhibit the subtle
CSS-paragraph variant of the bug, which doesn't visibly degrade table
rendering, so they don't need the filter.
@cwickham cwickham marked this pull request as draft May 29, 2026 18:10
The installed pointblank package has three docstrings that contain \d
without an r-prefix, so importing pointblank emits SyntaxWarning at
parse time. Those warnings were leaking into the rendered .md as
visible output above the validation table. Adding warning: false on
the first import chunk suppresses them.
@cwickham cwickham marked this pull request as ready for review May 29, 2026 18:17
@github-actions
Copy link
Copy Markdown

Blog YAML Checks

content/blog/ported/great-tables/pointblank-intro/index.md

  • ⚠️ image is required but missing.
  • ⚠️ image-alt is required but missing.

content/blog/ported/pointblank/all-about-actions/index.md

  • ⚠️ image is required but missing.
  • ⚠️ image-alt is required but missing.

content/blog/ported/pointblank/intro-pointblank/index.md

  • ⚠️ image is required but missing.
  • ⚠️ image-alt is required but missing.

content/blog/ported/pointblank/lets-workshop-together/index.md

  • ⚠️ image is required but missing.
  • ⚠️ image-alt is required but missing.

content/blog/ported/pointblank/overhauled-user-guide/index.md

  • ⚠️ image is required but missing.
  • ⚠️ image-alt is required but missing.

content/blog/ported/pointblank/validation-libs-2025/index.md

  • ⚠️ image is required but missing.
  • ⚠️ image-alt is required but missing.

Summary: 6 files checked, 12 warnings

@cwickham cwickham merged commit 15ad265 into main May 29, 2026
13 checks passed
cwickham added a commit that referenced this pull request May 29, 2026
The pointblank validation table in the post was rendering as broken HTML
in Hugo because the wrapper <div> contains blank lines that close
Goldmark's HTML block parsing mid-table. The strip-html-blank-lines
Quarto filter (added in #287) collapses those blank lines before Hugo
sees the output. Opt this post in via its frontmatter and re-render.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant