-
Notifications
You must be signed in to change notification settings - Fork 1
feat: render quantity superscripts in post bodies (v2.12.18) #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
seonghobae
merged 13 commits into
worktree-fix-frontend-build-break
from
feat/quantity-superscript-display-v2129
Aug 23, 2026
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
17167d6
feat: render quantity superscripts in post bodies (v2.12.9)
seonghobae 8b8fa76
fix(frontend): use OIDC return-url helpers and guard AdminPanel render
seonghobae d716da5
fix: preserve superscript exponent case and stop unclosed-tag bleed
seonghobae 534de7c
fix(frontend): decode entities and match multiline sup/sub content
seonghobae 0e0b0b7
fix(chunking): normalize markdown table scripts
seonghobae 446cedd
fix: bound script markup to table cells
seonghobae f445be7
fix: preserve deterministic source unit structure (#515)
seonghobae fccc3a5
test: keep malformed cell blocks inside their row
seonghobae 9f34820
Merge remote-tracking branch 'origin/worktree-fix-frontend-build-brea…
seonghobae 0290387
test: cover malformed quantity table boundaries
seonghobae 882bbe6
fix: preserve encoded-script source parity (#520)
seonghobae 11a0f16
Merge remote-tracking branch 'origin/feat/quantity-superscript-displa…
seonghobae 8633cf5
fix(deps): resolve version-bump and ADR-index conflicts with base branch
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # 2.12.18 — Quantity superscript display | ||
|
|
||
| ## Fixed | ||
|
|
||
| - Post popups now show cubic metres and similar quantities as superscripts | ||
| and subscripts (`12 m³`, `H₂O`) instead of flattened `m^3` or `m3`. | ||
| Semantic units store Unicode so embeddings keep the exponent. Comparison | ||
| operators and leading footnote carets stay literal (ADR 0165). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # ADR 0165: Render quantity superscripts as text runs, Unicode in units | ||
|
|
||
| - Status: Accepted | ||
| - Date: 2026-08-22 | ||
| - Depends on: [0061](0061-post-body-character-reference-decoding.md), [0062](0062-semantic-unit-embedding.md), [0102](0102-semantic-source-unit-boundaries.md) | ||
|
|
||
| ## Context | ||
|
|
||
| Imported posts write cubic metres and similar quantities as HTML | ||
| `<sup>`/`<sub>` or as caret exponents (`m^3`). The display path converted | ||
| `<sup>` into a caret and then rendered the paragraph as a React text node, | ||
| so buyers saw `m^3` instead of a superscript. The DOM chunker dropped the | ||
| tags entirely, so embeddings received concatenated `m3`, which is a | ||
| different quantity. Comparison operators such as `qty < 50` must remain | ||
| plain text, and a leading footnote caret (`^1 …`) is not a unit exponent. | ||
|
|
||
| ## Decision | ||
|
|
||
| - Preserve the source body. Derived semantic text maps HTML `<sup>`/`<sub>` | ||
| and quantity caret exponents onto Unicode Super/Subscript characters | ||
| (The Unicode Consortium, 2024, §22.4) so search and embeddings can tell | ||
| `m³` from `m3` without keeping markup in the unit (Cai, Yu, Wen, & Ma, | ||
| 2003). | ||
| - The buyer post view splits those Unicode (or leftover caret) runs and | ||
| renders them as React `<sup>`/`<sub>` elements. The body is never | ||
| assigned to `innerHTML` (ADR 0061). | ||
| - Only a letter, digit, or closing `)` immediately followed by `^` and a | ||
| short numeric/`n` exponent is treated as a quantity. A leading `^1` | ||
| footnote marker and comparison operators stay literal. | ||
| - Unmapped script runs keep a caret or underscore so they remain visible | ||
| rather than silently concatenating. Full formula ontology remains out of | ||
| scope; this decision covers quantity display and unit-level text. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - The post popup shows `12 m³` and `H₂O` as superscripts and subscripts. | ||
| - Newly persisted `post_content_unit` text stores Unicode quantities, so | ||
| later retrieval does not depend on HTML surviving the chunker. | ||
| - Existing concatenated `m3` units stay until re-ingestion; caret-form | ||
| units still render through the display splitter. | ||
|
|
||
| ## References | ||
|
|
||
| Cai, D., Yu, S., Wen, J.-R., & Ma, W.-Y. (2003). *VIPS: A vision-based | ||
| page segmentation algorithm* (Microsoft Research Technical Report | ||
| MSR-TR-2003-79). Microsoft Research. | ||
|
|
||
| International Organization for Standardization. (2022). *Quantities and | ||
| units — Part 1: General* (ISO 80000-1:2022). | ||
|
|
||
| The Unicode Consortium. (2024). *The Unicode Standard* (Version 16.0.0). | ||
| https://www.unicode.org/versions/Unicode16.0.0/ | ||
|
|
||
| WHATWG. (n.d.). *HTML living standard: The `sub` and `sup` elements*. | ||
| https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-sub-and-sup-elements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.