Repository navigation
feat(htmd subscript): add new section - #10
belivinge-2 wants to merge 22 commits into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
Please review our PR |
| 2. If the content is empty once its leading and trailing whitespace (as defined | ||
| above) is removed, serialize the element as HTML: `~~` is not an empty | ||
| subscript. | ||
| 3. If the trimmed content contains an unescaped `~`, serialize the element as |
There was a problem hiding this comment.
You should escape ~ found in text nodes.
There was a problem hiding this comment.
Fixed. A ~ in text nodes is now escaped as ~. A tilde can no longer open or close a subscript:
• a~b → a~b
• a~~b → a~~b
| HTML: `~~a~~` reads as strikethrough, and an unmatched `~~` run inside the | ||
| content, such as one left by another handler, stops the closing `~` from | ||
| matching. | ||
| 4. To form a Markdown candidate, trim leading and trailing whitespace from |
There was a problem hiding this comment.
Use "move" instead of "trim", which usually means "remove."
There was a problem hiding this comment.
replaced the word with "move", also fixed the meaning
|
|
||
| Approach: | ||
|
|
||
| 1. If the element has attributes, or is inside another `<sub>`, serialize it as |
There was a problem hiding this comment.
Need two cases: one for Pure mode, another for Faithful mode. These should follow what htmd does for emphasis/strong emphasis.
There was a problem hiding this comment.
i made two cases
- Pure mode: always writes Markdown, even if something gets lost.
- Faithful mode: never loses anything, and keeps raw HTML where needed.
| matching. | ||
| 4. To form a Markdown candidate, trim leading and trailing whitespace from | ||
| the translated content and place it outside the proposed `~content~` pair. | ||
| 5. Apply the single-tilde rules above to the candidate after step 4, using |
There was a problem hiding this comment.
This is impractical -- htmd doesn't have easy access to characters outside the subscript block. See the spec for emphasis/strong emphasis.
There was a problem hiding this comment.
The rule now works the same way as emphasis/strong emphasis.
| Runs of three or more are text, and are escaped only at the start of a line, | ||
| where they would open a code fence, and inside a subscript's content; in both | ||
| places every `~` of the run is escaped, since the `~~` left after an escaped first | ||
| tilde can still open or close. When the reader also enables superscript, a `^` |
There was a problem hiding this comment.
Superscript is outside the scope of this PR.
There was a problem hiding this comment.
the spec no longer mentions superscript
| described in the emphasis section; in Pure mode they are combined, so | ||
| `<sub>a</sub><sub>b</sub>` is written `~ab~`. | ||
|
|
||
| In `TranslationMode::Pure`, which writes no HTML, attributes are dropped, empty |
There was a problem hiding this comment.
Awkward and a bit contradictory here. Move it closer / combine with Faithful mode approach.
There was a problem hiding this comment.
A shared "Approach" section now comes before both modes. resolved
| | Subscript inside subscript | `<sub><sub>a</sub></sub>` | `~<sub>a</sub>~` | | ||
| | Adjacent subscripts | `<sub>a</sub><sub>b</sub>` | `<sub>a</sub><sub>b</sub>` | | ||
|
|
||
| Approach: |
There was a problem hiding this comment.
Missing: the contents of the <sub> element should be translated from HTML to Markdown.
There was a problem hiding this comment.
text nodes and nested elements now are translated to Markdown in an inline context, and the tildes in their text are escaped. That result is the content
| 2. Output of "Verify that you can compile and run the project in the current git repo." | ||
| ---------------------------------------------------------------------------------------- | ||
|
|
||
| Prompting Claude Sonnet 5.5 (`claude-sonnet-5-5`), high effort, with `Verify |
There was a problem hiding this comment.
Which team member is this for? I only see Dustin's verification output.
There was a problem hiding this comment.
It was intended for Daulet Khamzin, who also contributed to it.
| 5. Review (round 7) | ||
| ------------------------ | ||
|
|
||
| Prompting Claude Sonnet 5.5 (`claude-sonnet-5-5`), with a fresh read-only |
There was a problem hiding this comment.
We removed Sonnet usage, so it's only Opus now
| > Context: the rest of that file is the established spec; read the "Translating | ||
| > HTML nodes", "Emphasis and strong emphasis", and "Math" sections for | ||
| > conventions (Faithful vs Pure mode, serialization as HTML, adjacent-element | ||
| > runs). The target reader is pulldown-cmark 0.13.4. There is no Rust toolchain |
There was a problem hiding this comment.
You must install the Rust toolchain! Otherwise your LLM results are poor.
There was a problem hiding this comment.
rust is downloaded, installed, and we reran the LLM
|
This PR is ready to be merged |
# Conflicts: # src/dom_walker.rs # src/element_handler/element_util.rs
The merge 563291b took src/dom_walker.rs and src/element_handler/element_util.rs from this branch instead of upstream, which dropped upstream's crate::Node wrapper and moved math_delimiter and serialize_node, so the crate no longer compiled. Restore upstream's versions of both files and re-apply only the subscript changes (tilde escaping, serialize_subtree_html, pub(crate) escape_html_block_blank_lines). Record the review and verification in submission.md.
b29325e to
c713cdd
Compare
project 2