Skip to content

feat(htmd subscript): add new section - #10

Open
belivinge-2 wants to merge 22 commits into
bjones1:mainfrom
ASPLightNext:subscript-htmd
Open

belivinge-2 wants to merge 22 commits into
bjones1:mainfrom
ASPLightNext:subscript-htmd

Conversation

@belivinge-2

Copy link
Copy Markdown

project 2

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e6fec178-b198-4e7d-89ca-5ad5f4882400
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ASPLightNext

Copy link
Copy Markdown

Please review our PR

Comment thread translation_approach.md Outdated
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should escape ~ found in text nodes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread translation_approach.md Outdated
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use "move" instead of "trim", which usually means "remove."

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced the word with "move", also fixed the meaning

Comment thread translation_approach.md Outdated

Approach:

1. If the element has attributes, or is inside another `<sub>`, serialize it as

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need two cases: one for Pure mode, another for Faithful mode. These should follow what htmd does for emphasis/strong emphasis.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i made two cases

  1. Pure mode: always writes Markdown, even if something gets lost.
  2. Faithful mode: never loses anything, and keeps raw HTML where needed.

Comment thread translation_approach.md Outdated
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is impractical -- htmd doesn't have easy access to characters outside the subscript block. See the spec for emphasis/strong emphasis.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule now works the same way as emphasis/strong emphasis.

Comment thread translation_approach.md Outdated
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 `^`

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superscript is outside the scope of this PR.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the spec no longer mentions superscript

Comment thread translation_approach.md Outdated
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awkward and a bit contradictory here. Move it closer / combine with Faithful mode approach.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A shared "Approach" section now comes before both modes. resolved

Comment thread translation_approach.md Outdated
| 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:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing: the contents of the <sub> element should be translated from HTML to Markdown.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread submission.md Outdated
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which team member is this for? I only see Dustin's verification output.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was intended for Daulet Khamzin, who also contributed to it.

Comment thread submission.md Outdated
5. Review (round 7)
------------------------

Prompting Claude Sonnet 5.5 (`claude-sonnet-5-5`), with a fresh read-only

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Opus if you can.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We removed Sonnet usage, so it's only Opus now

Comment thread submission.md Outdated
> 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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must install the Rust toolchain! Otherwise your LLM results are poor.

@belivinge-2 belivinge-2 Nov 16, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rust is downloaded, installed, and we reran the LLM

@ASPLightNext

Copy link
Copy Markdown

This PR is ready to be merged

daulet.khamzin and others added 3 commits November 17, 2026 10:34
# 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.
Sign up for free to 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.

4 participants