-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.x] Dynamic Markdown links #1590
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 2.x-dev #1590 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 1866 1876 +10
===========================================
Files 191 192 +1
Lines 4924 4954 +30
===========================================
+ Hits 4924 4954 +30 ☔ View full report in Codecov by Sentry. |
ChatGPT Response to RFC Proposal: Dynamic Markdown Links in HydePHP Benefits:
Drawbacks:
Syntax Improvement: Considering the DX goals of HydePHP, the syntax should prioritize clarity, conciseness, and unambiguousness. While all proposed syntaxes have their merits, Syntax 1 appears to strike the best balance between these criteria: [Home](hyde::route('home'))
![Image](hyde::media('image.png')) This syntax maintains clarity by clearly delineating Hyde-specific functionality ( Recommendation: Given the benefits of dynamic Markdown links in enhancing developer experience and content management capabilities, along with the proposed syntax improvement, it's recommended to proceed with the RFC for implementation. However, it's crucial to address potential ambiguities and assess any performance implications during the implementation phase. Additionally, thorough documentation and examples should accompany the feature to assist users in understanding and leveraging its full potential. In conclusion, the proposed dynamic Markdown links feature aligns well with HydePHP's goals and offers significant advantages in content management. With careful attention to syntax clarity and performance considerations, integrating this functionality would be a valuable addition to HydePHP's feature set. |
Looking back at this, using my favourite syntax:
|
Switching to rebase and target v2 due to v1 feature freeze #1877 |
b86a1c3
to
6a0df7b
Compare
This reverts commit 091a8d5.
8fd4d5e
to
9a08865
Compare
caf1c63
to
6ec38dd
Compare
Dynamic Markdown Links
PR Abstract
Based on RFC 1590 proposed in https://twitter.com/CodeWithCaen/status/1761810371063497098
Overview
HydePHP provides a powerful feature for automatically converting Markdown links to source files to the corresponding routes in the built site.
This allows for much better writing experience when using an IDE, as you can easily navigate to the source file by clicking on the link.
Usage
Using the feature is simple: Just use source file paths for links:
As you can see, it works for both pages and media assets. The leading slash is optional and will be ignored by Hyde, but including it often gives better IDE support.
Behind the Scenes
During the build process, HydePHP converts source paths to their corresponding routes, and evaluates them depending on the page being rendered.
If your page is in the site root then:
/_pages/index.blade.php
becomesindex.html
/_media/logo.svg
becomesmedia/logo.svg
If your page is in a subdirectory then:
/_pages/index.blade.php
becomes../index.html
/_media/logo.svg
becomes../media/logo.svg
Of course, if your page is in a more deeply nested directory, the number of
../
will increase accordingly.We will of course also match your configured preference for
pretty_urls
and only include the.html
extension when desired.Limitations
There are some limitations and considerations to keep in mind when using this feature: