Skip to content

Render the README header on nuget.org - #52

Merged
ipjohnson merged 1 commit into
mainfrom
fix/nuget-readme-logo
Aug 29, 2026
Merged

Render the README header on nuget.org#52
ipjohnson merged 1 commit into
mainfrom
fix/nuget-readme-logo

Conversation

@ipjohnson

Copy link
Copy Markdown
Owner

What broke

The nuget.org package page shows the 1.2.2 README title as a wall of escaped HTML: nuget.org renders CommonMark only, so the <picture><source…><img width="64" align="middle"> header lands in the h1 as literal text. Its relative assets/… paths were a second, latent bug — nuget.org only renders README images from allowlisted absolute URLs, never from relative paths or the package itself.

The fix

One self-sized mark, plain markdown:

  • assets/logo-readme.svg is the icon artwork with an intrinsic width="40" height="40" — declaring the size in the SVG root is what removes the need for an HTML width attribute.
  • The white tile carries its own background, so a single file serves both themes (bare glyph on light pages, the package-icon tile on dark ones) — which retires the <picture> switch and both offset-compensated variant cuts.
  • The h1 references it by absolute raw.githubusercontent.com/…/main/… URL, a domain nuget.org allowlists (the coverage badge already relies on it).
  • The license badge links absolutely for the same reason: nuget.org resolves relative hrefs against its own pages.

Note: the README image in this PR's branch view will show broken until merge — the URL points at main, which doesn't have the asset yet. That's expected.

Release plan

READMEs are immutable per published version, so the live page updates on the next publish. Sequence after merge: tag v1.2.3-preview.1 to see the rendering on a real package page, then cut v1.2.3 (version bump + changelog date, per convention).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WUBuxPxvyctDSNQNqNo6e5

nuget.org renders CommonMark only: the <picture> markup 1.2.2 shipped is
escaped into the visible h1, and its relative srcset paths could never
resolve there anyway - README images render solely from allowlisted
absolute URLs.
The mark is now one file, assets/logo-readme.svg: the icon artwork with
an intrinsic 40px size, referenced with plain markdown from
raw.githubusercontent.com (an allowlisted domain). Declaring the size in
the SVG root removes the need for a width attribute, and the white tile
carrying its own background removes the need for a light/dark <picture>
switch - the tile disappears into light pages leaving the bare glyph,
and reads as the package icon on dark ones. Sitting on the baseline it
behaves like a capital letter, so no align hack either. The two
offset-compensated variant cuts retire with the markup that needed them.
The license badge now links absolutely for the same reason relative
images fail: nuget.org resolves relative hrefs against its own pages.
The live package pages pick this up with the next published version.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUBuxPxvyctDSNQNqNo6e5
@ipjohnson
ipjohnson merged commit 4e69b0a into mainAug 29, 2026
2 checks passed
ipjohnson added a commit that referenced this pull request Aug 29, 2026
Version and changelog, plus one word: the README mark now carries alt
text, because nuget.org substitutes a visible-to-screen-readers nag
string into images whose alt is empty.
The header fix itself landed in #52 and was verified on the
1.2.3-preview.1 package page; this is the release that puts it on the
stable page, since a README is per published version.
Claude-Session: https://claude.ai/code/session_01WUBuxPxvyctDSNQNqNo6e5
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for freeto 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

@ipjohnson