Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix blog code block extraction newlines#2884

Open
ZaynJarvis wants to merge 2 commits into
blogfrom
fix/blog-codeblock-newlines
Open

Fix blog code block extraction newlines#2884
ZaynJarvis wants to merge 2 commits into
blogfrom
fix/blog-codeblock-newlines

Conversation

@ZaynJarvis

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve real newline text nodes between rendered code lines in blog <pre><code> blocks.
  • Add standard language-* classes on generated <code> tags.
  • Move visible line numbers to CSS counters so extractor-visible code text contains only source code.

Why

The deployed agent-runtime article rendered code blocks as line spans without newline text nodes. Many HTML extractors, including OpenViking's HTML-to-Markdown path, saw a single flattened line instead of a multi-line code block.

Validation

  • npm run build
  • Verified generated blog/dist/post/agent-runtime/index.html has real newlines in the 0_run_claude.js <code> block.
  • Verified OpenViking HTMLParser._html_to_markdown(...) converts the target snippet into a fenced multi-line block.
  • Captured local headless Chrome screenshot to confirm visual line numbers still render.

Notes

  • Best-practice reference: keep code samples semantic as <pre><code>…</code></pre>, with real whitespace/newlines in the DOM; use CSS for presentation-only line numbers.

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant