Skip to content

content/mojibake should read the same rendered prose as content/placeholder-text #216

Closed

Description

@nc9

PR #214 added getRenderedProseText, which extends getProseTextExcludingCode with three exclusions that apply just as well to content/mojibake:

  • <template> subtrees. linkedom keeps template children in childNodes, so a plain text walk reads markup the browser never renders.
  • Container classes of in-page code editors and syntax highlighters (cm-editor, monaco-editor, hljs, language-* and friends). CodeMirror and Monaco emit no <pre> or <code> at all, so a tag-only exclusion reads their content as prose.
  • A line break at every block boundary, so adjacent blocks do not fuse into one word.

content/mojibake was left on the old helper in #214 to keep that PR's blast radius small. Switching it is a behaviour change and moves the pinned counts in streaming-rules-canonical-golden.test.ts, so it wants its own change.

Acceptance Criteria

  • content/mojibake does not report a sequence that appears only inside a <template> or inside a code-editor container.
  • A page whose mojibake is in ordinary prose is still reported exactly as before.
  • The pinned counts in packages/audit-engine/tests/streaming-rules-canonical-golden.test.ts are updated with a comment saying which rule moved them, or a comment records that they did not move.
  • content/mojibake's docs page lists the same exclusions its code applies.

Follow-up from #214.

Activity

  1. added
    enhancement
    rules
    P3
    size: S
    on Sep 23, 2026
  2. nc9 commented on Oct 11, 2026

    @nc9
    ContributorAuthor

    Reproduced on 0.0.108 with a local fixture. It’s only inside a <template>, and only inside <div class="cm-editor">, each gives content/mojibake, check encoding-corruption, warn, 1 encoding corruption occurrence(s) in visible text (utf8-as-latin1): .... The ordinary-prose control gives the same warning, as it should.

    origin/main still reads getProseTextExcludingCode(body) in packages/rules/src/content/mojibake.ts.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3enhancementrulessize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions