Title: id(web/markdown): HTML width/height that aren't bare integers are silently dropped on markdown import — 200px, 50%, 200.0 sizing vanishes with no trace · Issue #2180 · developing-today/code · GitHub
Open Graph Title: id(web/markdown): HTML width/height that aren't bare integers are silently dropped on markdown import — 200px, 50%, 200.0 sizing vanishes with no trace · Issue #2180 · developing-today/code
X Title: id(web/markdown): HTML width/height that aren't bare integers are silently dropped on markdown import — 200px, 50%, 200.0 sizing vanishes with no trace · Issue #2180 · developing-today/code
Description: id(web/markdown): HTML width/height that aren't bare integers are silently dropped on markdown import — 200px, 50%, 200.0 sizing vanishes with no trace Evidence (verified this run, main c58507a3) pkgs/id/src/web/markdown.rs:1208-12...
Open Graph Description: id(web/markdown): HTML width/height that aren't bare integers are silently dropped on markdown import — 200px, 50%, 200.0 sizing vanishes with no trace Evidence (verified this run, main c5850...
X Description: id(web/markdown): HTML <img> width/height that aren't bare integers are silently dropped on markdown import — 200px, 50%, 200.0 sizing vanishes with no trace Evidence (verified this run, ...
Opengraph URL: https://github.com/developing-today/code/issues/2180
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web/markdown): HTML \u003cimg> width/height that aren't bare integers are silently dropped on markdown import — 200px, 50%, 200.0 sizing vanishes with no trace","articleBody":"# id(web/markdown): HTML `\u003cimg>` width/height that aren't bare integers are silently dropped on markdown import — `200px`, `50%`, `200.0` sizing vanishes with no trace\n\n## Evidence (verified this run, main `c58507a3`)\n\n`pkgs/id/src/web/markdown.rs:1208-1217` (`parse_img_tag`, the #893 HTML-image import path):\n\n```rust\nif let Some(w) = attr(\"width\")\n && let Ok(n) = w.parse::\u003cu64>()\n{\n attrs[\"width\"] = json!(n);\n}\nif let Some(h) = attr(\"height\")\n && let Ok(n) = h.parse::\u003cu64>()\n{\n attrs[\"height\"] = json!(n);\n}\n```\n\nA dimension that fails the bare-`u64` parse is not rejected, not preserved, and not reported — the attribute simply never enters the ProseMirror node. On the next save, `prosemirror_to_markdown` (markdown.rs:1953-1968) emits dimensions only from `attrs.width`/`attrs.height`, so the sizing is gone from the document permanently.\n\nVerbatim-probe (laptop, `~/git/fleet/probe-2026-10-29-laneA-imgwidth/`, `parse_tag_attrs` + `parse_img_tag` copied from main `c58507a3`):\n\n| input | resulting attrs |\n|---|---|\n| `width=\"200\" height=\"100\"` (control) | `width:200, height:100` — kept |\n| `width=\"200px\" height=\"100px\"` | both **dropped** |\n| `width=\"50%\"` | **dropped** |\n| `width=\"200.0\"` | **dropped** |\n| `width=\" 200\"` (leading space) | **dropped** |\n| `width=\"0\"` | kept as `0` |\n| `width=\"+200\"` | kept as `200` (Rust `u64` parse accepts a leading `+`) |\n\n`200px` is the form most of the world's HTML and Markdown-with-inline-HTML actually uses (CSS-style dimensions in exported notes, README badges, pasted web content); percentages are the standard responsive form. Both reach this parser through the raw-HTML image path (#893) and lose their sizing silently on the first load/save round-trip.\n\n## Why it matters\n\n- Silent data loss on import: the document the user saved is not the document they wrote, and nothing anywhere says a dimension was discarded.\n- The accept set is accidental, not designed: `+200` and `0` pass while `200px`, `200.0` and `\" 200\"` fail — that is `u64::from_str`'s grammar, not an image-sizing policy.\n- Sibling asymmetry: the editor's own parseDOM side of this same problem is #2010 (TypeScript, bare `Number()`); this is the Rust markdown-import side, a separate code path with the opposite failure shape (drop instead of reinterpret).\n\n## Acceptance criteria\n\n- [ ] Triage pins the dimension grammar for the markdown import path: which of `200px` (strip a `px` suffix), `50%` (percent — represent or refuse), `200.0`, and whitespace-padded values are accepted, and what happens to the rest.\n- [ ] A dimension the pinned grammar refuses is not silently dropped: it is either preserved in the node or the import surfaces it (the pinned behavior is recorded on this issue).\n- [ ] Regression tests in `web/markdown.rs` cover the pinned grammar end-to-end (import → node attrs → markdown emission) for at least: bare integer (control), `px`-suffixed, fractional, and padded values.\n- [ ] No behavior change for images whose dimensions already parse as bare integers.\n\nDedup: #2010 is the TypeScript editor `parseDOM` path (bare `Number()` — NaN/fraction/hex pass through); #872 (closed) was substring attribute shadowing in this same function; #893 (closed) added the sized-image import form itself. None covers the Rust import-side dimension grammar.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-29T07:44:49Z","url":"https://github.com/developing-today/code/issues/2180"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d98174a8-377a-8371-63c2-67dac1a01f03 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A69A:1293AE:C9B628:105B67E:6B064247 |
| html-safe-nonce | 181a1543ac012f060c0d8a2d01c30315a1763249ab607438a531dae94544ce19 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjlBOjEyOTNBRTpDOUI2Mjg6MTA1QjY3RTo2QjA2NDI0NyIsInZpc2l0b3JfaWQiOiI1MDEyNTM4NTQ3Nzc0MDQ2NzkxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 32602faf26b2f0c6db960347345dc7239b6b11736e36596b5e4479aaad77f4cb |
| hovercard-subject-tag | issue:6095260276 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/2180/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ada1f9f3d7136310876f5bfb1cdc89a2011886faefc98977b43e2fdedadb10e5/developing-today/code/issues/2180 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ada1f9f3d7136310876f5bfb1cdc89a2011886faefc98977b43e2fdedadb10e5/developing-today/code/issues/2180 |
| og:image:alt | id(web/markdown): HTML |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width