Skip to content

fix(translate): label paragraphs containing only dont-walk children - #2014

Open
JoeJoeflyn wants to merge 1 commit into
mengxi-ream:mainfrom
JoeJoeflyn:fix/issue-1951-dont-walk-paragraph-label
Open

fix(translate): label paragraphs containing only dont-walk children#2014
JoeJoeflyn wants to merge 1 commit into
mengxi-ream:mainfrom
JoeJoeflyn:fix/issue-1951-dont-walk-paragraph-label

Conversation

@JoeJoeflyn

Copy link
Copy Markdown
Contributor

AI model(s) used (required): Gemini 3.6

Type of Changes

  • 🐛 Bug fix (fix)
  • ✅ Test related (test)

Description

SillyTavern renders narration in <code> tags and dialogue in <q> tags. CODE is in DONT_WALK_BUT_TRANSLATE_TAGS, so the old walkNode filtered out <code> children before checking hasInlineNodeChild. A <p> with only <code> never got PARAGRAPH_ATTRIBUTE and was skipped — only <q> dialogue translated. Fix: set hasInlineNodeChild = true for non-empty dont-walk-but-translate children.

Related Issue

#1951

How Has This Been Tested?

  • Reproduced on buggy build: <code> narration untranslated, <q> dialogue translated. Fixed build: all translated.
  • Traced SillyTavern source confirming <code>/<q> rendering.
  • All 104 DOM host tests pass.

…engxi-ream#1951)

SillyTavern renders narration inside <code> tags and dialogue inside <q>
tags. The old walkNode filtered out isDontWalkIntoButTranslateAsChildElement
children before checking hasInlineNodeChild, so a <p> containing only <code>
never received PARAGRAPH_ATTRIBUTE and was skipped for translation. Dialogue
paragraphs with <q> translated normally, causing the "only translates
dialogue" bug.

Set hasInlineNodeChild = true for non-empty dont-walk-but-translate children
so the parent paragraph is labeled and the child is translated as a unit.
@changeset-bot

changeset-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 487fa0d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@read-frog/extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added fix contrib-trust:new PR author trust score is 0-29. needs-maintainer-review Contributor trust automation recommends maintainer review. labels Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Contributor trust score

21/100 — New contributor

This score estimates contributor familiarity with mengxi-ream/read-frog using public GitHub signals. It is advisory only and does not block merges automatically.

Outcome

Score breakdown

Dimension Score Signals
Repo familiarity 11/35 commits in repo, merged PRs, reviews
Community standing 5/25 account age, followers, repo role
OSS influence 0/20 stars on owned non-fork repositories
PR track record 5/20 merge rate across resolved PRs in this repo

Signals used

  • Repo commits: 1 (author commits reachable from the repository default branch)
  • Repo PR history: merged 1, open 1, closed-unmerged 1
  • Repo reviews: 0
  • PR counted changed lines: 39 (+39 / -0)
  • Repo permission: read
  • Followers: 3
  • Account age: 60 months
  • Owned non-fork repos considered: max 0, total 0 (JoeJoeflyn/ui-lab (0), JoeJoeflyn/JoeJoeflyn (0), JoeJoeflyn/e-commerce-web (0), JoeJoeflyn/e-commerce-api (0), JoeJoeflyn/my-portfolio (0), JoeJoeflyn/ReduxProject (0), JoeJoeflyn/todolist-React (0), JoeJoeflyn/Reactjs (0), JoeJoeflyn/learn-UI (0), JoeJoeflyn/learn-js (0))

Policy

  • Low-score review threshold: < 30
  • Auto-close: score < 20 and counted changed lines > 1000
  • Migration-related files are excluded from the auto-close line count
  • Policy version: v1.2

Updated automatically when the PR changes or when a maintainer reruns the workflow.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 487fa0d207

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +142 to +144
if (isDontWalkIntoButTranslateAsChildElement(child, config) && child.textContent?.trim()) {
hasInlineNodeChild = true
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep wrappers out of protected child elements

When this marks a parent whose only content is a dont-walk-but-translate child, the bilingual path later treats the parent as a single block source and unwrapDeepestOnlyHTMLChild can descend into that <code>/.notranslate child because it only stops on dont-walk-and-don't-translate nodes. For the target case <p><code>narration</code></p>, that appends the translation wrapper inside the <code> element rather than after the atomic child/parent, so the translated narration inherits code markup and violates the don't-walk-into boundary; prevent unwrapping into these protected children or place the wrapper outside them.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contrib-trust:new PR author trust score is 0-29. fix needs-maintainer-review Contributor trust automation recommends maintainer review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant