Skip to content

feat(search): strip math delimiters from the search index - #70

Merged
bits-bytes-nn merged 1 commit into
mainfrom
feat/search-strip-math-delimiters
Aug 19, 2026
Merged

feat(search): strip math delimiters from the search index#70
bits-bytes-nn merged 1 commit into
mainfrom
feat/search-strip-math-delimiters

Conversation

@bits-bytes-nn

Copy link
Copy Markdown
Owner

Follow-up to #69, which was left as an open decision there.

kramdown's mathjax engine leaves \(...\) and \[...\] in the HTML as literal
text. Now that #69 cuts the excerpt around the match instead of taking the
opening, a window landing on a formula shows the delimiters to the reader.
30 of 35 posts carried them.

before   메커니즘의 \(O(L^2)\) 계산 복잡도는
after    메커니즘의 O(L^2) 계산 복잡도는

Only the delimiters go — the TeX inside stays, so O(L^2) remains both readable
and findable. Dropping the formula contents entirely would have made characters
inside math unsearchable.

The inline/display asymmetry is load-bearing. Inline math is replaced with no
padding, display math with spaces. Korean attaches a particle straight onto the
symbol, so \(\theta\)로 has to come out \theta로, not \theta 로 — the same
class of trap as the word-boundary cap in #69. Display math is already its own
block, so it can take the spaces.

Edge cases pinned by tests: an unclosed \( is left alone rather than swallowing
the rest of the post, and a bare f(x) in prose is untouched.

Verification

  • 100 tests / 165 assertions, clean build, html-proofer successful, all 16
    validate-site checks passed.
  • Built index: 0 of 35 posts still hold delimiters.
  • Driven in a real browser against the actual /search/ page: the DeepSeek-V3.2
    result for 어텐션 now reads 바닐라 어텐션 메커니즘의 O(L^2) 계산 복잡도는.

Left in §9

A TeX command still shows when a window lands on one (\theta). Converting to
Unicode symbols needs a TeX→glyph mapping, which is more than a search index
should carry.

kramdown's mathjax engine leaves `\(...\)` and `\[...\]` in the HTML as literal
text, so a flattened post read `메커니즘의 \(O(L^2)\) 계산 복잡도` — and now that the
excerpt is cut around the match rather than taken from the opening, a window
landing on a formula showed those delimiters to the reader. 30 of 35 posts carried
them.

Only the delimiters go. The TeX inside stays, because it is what the sentence is
about and because a symbol inside a formula should remain findable:

    before   메커니즘의 \(O(L^2)\) 계산 복잡도는
    after    메커니즘의 O(L^2) 계산 복잡도는

Inline math is replaced with no padding, display math with spaces. That asymmetry
is load-bearing: Korean attaches a particle straight onto the symbol, so
`\(\theta\)로` has to come out as `\theta로` and not `\theta 로`. Display math is
already its own block.

An unclosed `\(` is left alone rather than swallowing the rest of the post, and a
bare `f(x)` in prose is untouched — both pinned by tests.
@bits-bytes-nn
bits-bytes-nn merged commit 05f80a2 into main Aug 19, 2026
2 checks passed
@bits-bytes-nn
bits-bytes-nn deleted the feat/search-strip-math-delimiters branch August 19, 2026 16:10
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.

1 participant