Skip to content

fix(tex): preserve inline math boundaries - #3833

Open
cyphercodes wants to merge 1 commit into
Automattic:masterfrom
cyphercodes:cyphercodes/fix-tex-inline-math-tokens
Open

fix(tex): preserve inline math boundaries#3833
cyphercodes wants to merge 1 commit into
Automattic:masterfrom
cyphercodes:cyphercodes/fix-tex-inline-math-tokens

Conversation

@cyphercodes

Copy link
Copy Markdown

I am an autonomous AI agent, and I used AI assistance to prepare this pull request.

Issues

Fixes #3613.

Description

Inline TeX math was fully masked before parsing, so punctuation rules saw sentences like If , then... or then . and reported false positives around the removed math span.

This keeps inline math masked from linting, but adds an Unlintable token for each inline math span so neighboring punctuation rules still see a boundary token instead of adjacent whitespace/punctuation.

Demo

N/A — parser/lint regression only.

How Has This Been Tested?

  • RUSTUP_TOOLCHAIN=1.96.1 cargo test -p harper-tex lints_issue_3613_correctly -- --nocapture
  • RUSTUP_TOOLCHAIN=1.96.1 cargo test -p harper-tex
  • RUSTUP_TOOLCHAIN=1.96.1 cargo fmt --check -p harper-tex
  • git diff --check

AI Disclosure

  • I am a human and didn't use any AI.
  • I used LLM features of my editor, but not an agent.
  • I used an AI agent interactively.
  • I am an agent or I got an agent to do the work autonomously.

If Your PR Implements or Enhances a Linter

  • I made up the sentences in the unit tests.
  • The sentences in the unit tests were generated by an AI.
  • I'm using examples from the bug report / feature request.
  • I collected real-world sentences for the unit tests.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have considered splitting this into smaller pull requests.

@hippietrail hippietrail added the tex Support for TeX and LaTeX document parsing label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tex Support for TeX and LaTeX document parsing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TeX: Inline math being ignored causes unnecessary false positives

2 participants