Skip to content

fix: ignore bash [[ ]] conditionals and disable single-dollar math#1203

Merged
perber merged 2 commits into
mainfrom
fix/1200-wiki-links-katex-conflict-bash
Jun 25, 2026
Merged

fix: ignore bash [[ ]] conditionals and disable single-dollar math#1203
perber merged 2 commits into
mainfrom
fix/1200-wiki-links-katex-conflict-bash

Conversation

@perber

@perber perber commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Wiki-link regex now requires a non-whitespace first character after [[, which prevents bash-style conditionals (e.g. [[ -n "$var" ]]) from being matched as wiki-links in both the Go backend and the TS preprocessor.

Disables singleDollarTextMath in remarkMath to avoid conflicts between $var in bash prose and math delimiters; use $$...$$ for math blocks.

Wiki-link regex now requires a non-whitespace first character after [[,
which prevents bash-style conditionals (e.g. [[ -n "$var" ]]) from being
matched as wiki-links in both the Go backend and the TS preprocessor.

Disables singleDollarTextMath in remarkMath to avoid conflicts between
$var in bash prose and math delimiters; use $$...$$ for math blocks.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates wikilink parsing and Markdown preview math handling to avoid false-positive link parsing in bash-style [[ ... ]] conditionals, and documents the resulting math delimiter expectations.

Changes:

  • Tighten wikilink regex (UI + server) to require a non-whitespace first character in the wikilink target.
  • Add regression tests to ensure bash [[ ... ]] conditionals are ignored as wikilinks (UI + server).
  • Disable single-dollar inline math parsing in the Markdown preview and update README to reflect $$...$$ math blocks.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ui/leafwiki-ui/src/lib/preprocessWikilinks.ts Tightens wikilink target regex to avoid matching bash conditionals.
ui/leafwiki-ui/src/lib/preprocessWikilinks.test.ts Adjusts whitespace test and adds regression coverage for bash [[ ... ]].
ui/leafwiki-ui/src/features/preview/MarkdownPreview.tsx Disables single-dollar inline math parsing to reduce conflicts with $var patterns.
internal/links/link_service_test.go Adds server-side regression test ensuring bash conditionals don’t produce wikilinks.
internal/links/helpers.go Aligns server wikilink regex with UI behavior to reject targets starting with whitespace.
README.md Documents KaTeX math blocks using $$...$$.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/leafwiki-ui/src/lib/preprocessWikilinks.ts
Comment thread internal/links/helpers.go
Comment thread ui/leafwiki-ui/src/lib/preprocessWikilinks.test.ts
Comment thread ui/leafwiki-ui/src/features/preview/MarkdownPreview.tsx
Adds explicit regression test for leading-whitespace syntax to lock in
the intended behavior introduced in the #1200 fix. Also clarifies in the
README that inline $...$ math is not supported; use $$...$$ instead.
@perber
perber merged commit 57baba7 into main Jun 25, 2026
9 checks passed
@perber
perber deleted the fix/1200-wiki-links-katex-conflict-bash branch June 25, 2026 15:04
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.

2 participants