Skip to content

Conversation

junseok44
Copy link
Contributor

@junseok44 junseok44 commented Sep 6, 2025

Related to #527

This PR resolves broken links on:

https://p5js.org/contribute/friendly_error_system/

https://p5js.org/contribute/steward_guidelines/

What this PR does

  • Adds support for reference-style links: Fixed rewriteRelativeMdLinks function which previously only handled inline links but not reference-style markdown links
  • Corrects misleading comment: Updated comment for inlineLinkRegexPattern to accurately describe what it captures
  • Fixes hash fragment handling: Resolved issue where .md extension wasn't being removed from relative links when followed by hash fragments (e.g., file.md#section)

What this PR does not address

  • Pre-existing malformed links: Links without proper relative paths (e.g., [Issues](steward_guidelines.md#issues)) still result in incorrect URLs due to the ../ prefix being added by existing logic. These were already broken before this PR.
  • Typos in source content: The broken link [_fesErrorMonitor()] on the friendly error system page is a typo in the source documentation from the p5.js repository. This will be addressed in a separate PR to the main p5.js repo.

junseok44 and others added 4 commits September 6, 2025 19:52
- Extend rewriteRelativeMdLinks to handle reference link syntax
- Support both inline links and reference links for markdown files
- Maintain backward compatibility with existing inline link processing
- Replace endsWith() with includes() to detect .md files with hash fragments
- Use lookahead regex to avoid breaking .mdx and other extensions
- Properly convert links like 'file.md#section' to 'file/#section'
- Add comprehensive test for reference link syntax processing
- Verify both inline and reference links are handled correctly
- Test hash fragment preservation in reference links
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