Skip to content

Flag relative and .mdx internal links on changed lines - #3137

Open
ElliotFriend wants to merge 1 commit into
mainfrom
chore/link-style-check
Open

ElliotFriend wants to merge 1 commit into
mainfrom
chore/link-style-check

Conversation

@ElliotFriend

Copy link
Copy Markdown
Contributor

What

  • scripts/check-link-style.mjs flags internal links that aren't root-relative, or that end in .md/.mdx. It checks Markdown links and images, reference-style definitions, and href attributes, and skips external URLs, anchors, and code.
  • It runs in the pre-commit hook (staged lines) and in the checks CI job (lines the PR adds or changes, so checkout now fetches two commits).
  • pnpm check:link-style --all <path> lists every violation in a section, for the conversion PRs.
  • CONTRIBUTING mentions the check.

Why

The conversion to root-relative links will take several PRs, and this keeps new relative links out in the meantime. It also catches .mdx in reference definitions, which mint broken-links passes but Mintlify emits as-is, so those links 404.

Known limitations

  • Editing any line that already has a relative link means converting that link too.

Adds scripts/check-link-style.mjs, run by the pre-commit hook on staged
lines and by CI on the lines a PR adds. Existing links are left for the
section-by-section conversion.
@mintlify

mintlify Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
stellar-docs 🟢 Ready View Preview Nov 13, 2026, 9:00 PM

@ElliotFriend

Copy link
Copy Markdown
Contributor Author

/triage

@stellar-doxie

stellar-doxie Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

🤖 Automated message from the Stellar Triage Bot.

Reviewing because @ElliotFriend asked with /triage.

This edits .github/workflows/mintlify-checks.yml, so a human merges it (security gate, hold: stellar/github-triage-bot#102). The change itself reads clean: contents: read and persist-credentials: false stay, and the new step runs a repo script with no secrets. @kaankacar @ElliotFriend
Not run: scripts/check-link-style.mjs on a line that breaks the rule. CI ran it here, but this PR adds no docs lines.

What I checked
  • checks at 34f80c9: step 10 "Check the link style of added lines" passed with no output. So HEAD^1 resolved with fetch-depth: 2. CodeQL, Socket and Mintlify Deployment are green too.
  • Triggers are pull_request and workflow_dispatch, not pull_request_target. Fork code still runs without secrets. On workflow_dispatch, HEAD^1 is the previous commit, so the step checks only the last commit.
  • Inline .mdx links: production rewrites them. lumens.mdx:28 links ./liquidity-on-stellar-sdex-liquidity-pools.mdx#trustlines and serves /docs/learn/fundamentals/liquidity-on-stellar-sdex-liquidity-pools#trustlines.
  • Not verified: the 404 for .mdx in reference definitions. Main has no such definition left to test.
  • False positives on main: no root-relative .md/.mdx targets, no relative href values, no relative images. The three footnote lines ([^1]: ...) do not match the definition regex.
  • pnpm check:link-style --all docs/learn works: pnpm passes options after the script name to the script (pnpm.io docs/cli/run.md:99; repo pins pnpm 11.6.0).
  • Sweep: MIGRATING.md:20, README.md:99 and CONTRIBUTING.md:62 still read true with the new check. .github/copilot-instructions.md:16-18 already asks to flag relative and .mdx links.
  • Preview is live at the head. The PR changes no rendered page.
  • No Copilot review on this PR.
  • Non-blocking: fencedLines reads a four-backtick fence as three backticks and closes on a line with an info string. docs/build/apps/wallet/contributing.mdx:30-54 nests fences that way, so lines 35, 42 and 49 count as prose. They hold no links today. Matching the full backtick run, and closing only on a bare run at least as long, would fix it.

@stellar-doxie stellar-doxie Bot added the bot:blocked-security Security-surface change; a human must review and merge label Nov 13, 2026

This branch was successfully deployed

1 active deployment
staging — 34f80c91 Deployed Nov 13, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:blocked-security Security-surface change; a human must review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant