-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[Documentation] fix link to edit-post documentation #12835
Conversation
@chrisvanpatten - we need to find a way to properly link urls to make them work with:
The correct full url is: From npm it links to https://github.com/WordPress/gutenberg/blob/edit-post/ - which is also broken. A simple approach would be to always link npm packages for packages README files. Any thoughts? |
@gziolo I’m open to ideas. Right now the parser on dot org requires a full relative path which also works on github, eg Obviously that sucks from a UX perspective but also it does mean it works on GitHub and the handbook, although I hadn’t even considered there would be npm issues. Yay :) For NPM readmes I think either the full URL is reasonable (I’d prefer linking to the GH version but the NPM version is fine too) but we need help from @dd32 (or someone else with bandwidth) to make sure the parser knows how to handle that and rewrite it to a handbook URL. EDIT Actually looking at it again for npm we just may be able to do the full relative path as well and they’ll rewrite it too, I think. Worth trying that too for now? |
It looks like npm takes |
So I found related issues: I can confirm that I'm wondering if that would also work for docs: @dd32 - assuming that I'm correct, would it be possible to make it work this way for the handbook? It seems like it would make it much easier at least on the GitHub side of things. |
packages/plugins/README.md
Outdated
@@ -29,7 +29,7 @@ This method takes two arguments: | |||
or an element (or function returning an element) if you choose to render your own SVG. | |||
- `render`: A component containing the UI elements to be rendered. | |||
|
|||
See [the edit-post module documentation](../edit-post/) for available components. | |||
See [the edit-post module documentation](../packages-edit-post/) for available components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See [the edit-post module documentation](../packages-edit-post/) for available components. | |
See [the edit-post module documentation](/packages/edit-post/) for available components. |
It seems like it works properly when I try it in the preview mode.
@gziolo I like the idea of EDIT: I'm an idiot, missed your review comment. That makes sense to me, I like the idea, as long as we can get the parser updated on dot org first so our links don't break for a third (or fourth or fifth? I'm losing track) time 😅 |
You need to try with the file edit feature on GitHub and preview mode. |
@gziolo If i'm understanding correctly, you'd like to make links starting as If i'm misunderstanding, an exact list of how each should be treated would be helpful, similar to this:
|
All documentation pages for packages are grouped under: https://wordpress.org/gutenberg/handbook/designers-developers/developers/packages/ It looks like it will be a slightly different then. I will check also which different patterns we use. There should be also something custom for components from the components package. I will comment soon with the list of mappings. |
{
"title": "Packages",
"slug": "packages",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/designers-developers/developers/packages.md",
"parent": "developers"
},
{
"title": "@wordpress/edit-post",
"slug": "packages-edit-post",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/edit-post/README.md",
"parent": "packages"
},
{
"title": "Components",
"slug": "components",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/README.md",
"parent": "developers"
},
{
"title": "WithFilters",
"slug": "with-filters",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/higher-order/with-filters/README.md",
"parent": "components"
}, I think we need to support 4 url patterns from the list extracted above. Turning them into absolute urls would end up with the following regular expressions for the handbook:
It might be buggy but shares the general idea :) |
@gziolo @dd32 I think For package and component documentation, let's target that separately… I'll try to devote an hour or so today/tomorrow to figuring out there's a cleaner approach with packages and components. (I have an idea of two I want to try.) |
I've added support for these links in https://meta.trac.wordpress.org/changeset/7989 As adding the extra links formats as mentioned by @gziolo in #12835 (comment) was easier to do at the same time, I've added them all - If they don't get used let me know and I'll pull them back out of the docs importer, but having them there doesn't negatively affect anything. The old-style |
@dd32 I did some debugging with the following snippet: $markdown = preg_replace( '/(\[.*?\]\((\.\.\/)+.*?)((\/readme)?\.md)?(#.*)?\)/i', '$1$5)', $markdown );
$markdown = preg_replace( '@(\[.*?\])\(/packages/(.*?)/?(#.*)?\)@i', '$1(https://wordpress.org/gutenberg/handbook/designers-developers/developers/packages/packages-$2/$3)', $markdown );
print $markdown; It works perfectly fine for:
However, it doesn't remove
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good now. Thanks for opening this PR 👍
I can confirm that the link in https://wordpress.org/gutenberg/handbook/designers-developers/developers/packages/packages-plugins/ works as expected 🎉 |
Thanks @gziolo!! 🎉 |
Ahh yes, I had forgotten that change was actually needed.. Fixed up in https://meta.trac.wordpress.org/changeset/7993 |
* fix link to edit-post documentation * Update README.md * Update README.md
* fix link to edit-post documentation * Update README.md * Update README.md
Description
Fixes #12332.
Fix link to edit-post documentation.