-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Automatically transform in-source links to in-wiki links #8
Comments
Sorry, I don't want to leave you hanging for too long like last time, but I've got finals coming up so I won't be able to return back until mid December when they're over. Apologies in advance. |
@Andrew-Chen-Wang No problem and thanks for replying. Will be looking forward to your return. |
@ribtoks The error is not on this repository. Instead, GitHub wiki apparently follows MediaWiki's link syntax: https://stackoverflow.com/a/8972756 https://docs.github.com/en/communities/documenting-your-project-with-wikis/editing-wiki-content#adding-links I've tested this with your example. Instead of |
@Andrew-Chen-Wang Thanks for investigating. I do not agree about usage of MediaWiki example right in the |
Hm in this case, a potential "loophole" is that in this action, I can create a quick regex and optionally change the links to be of MediaWiki format and commit the changes to the wiki git. |
@Andrew-Chen-Wang Yes, changing links before the deploy sounds like a good idea! |
The problem is not the markdown type linking! MediaWiki type linking also doesn't work for GitHub's wiki shows the page source if there is an extension in the link, like in If one would strip the extensions from the links with a script, then the title functionality should taken into account! This is a test with a [link to other page](Second.md "a nice title with an .md inside" ). |
yes but |
Thats why I wrote: the deploy script should just remove the extension from the link. |
@ribtoks do you have an opinion on whether you think this should be a separate preprocessing step/action or included in this Andrew-Chen-Wang/github-wiki-action ? - uses: octocat/strip-md-links@v1
with:
path: wiki/**.md
- uses: Andrew-Chen-Wang/github-wiki-action@v4 vs - uses: Andrew-Chen-Wang/github-wiki-action@v4
with:
strip_md_links: true Related to #21 /cc @xabolcs |
I'd vote for the latter |
@ribtoks Maybe I'm misunderstanding, what do you mean by "change"? Do you mean that the action will auto-update? Have new params? I don't think it does that since it's pinned at I guess the whole discussion comes down to how much coupling/complexity you, a user, want in your options and how much coupling/complexity, Andrew-Chen-Wang, the main dev is OK maintaining. |
I assume that the issue outlined here is this: Check out our [How it works](./How-it-works.md) page! That this 👆 doesn't work in the deployed GitHub wiki tab. That's because the URLs that GitHub wikis use are https://github.com/marketplace/actions/strip-markdown-extensions-from-links-action for (const file of readDirSync(filesPath)) {
const filename: string = file.toString()
const oldContent: string = readFileSync(filename, 'utf8')
const newContent: string = replacer.transformMarkdownLinks(oldContent)
if (oldContent != newContent) {
debug(filename + ' updated')
writeFileSync(filename, newContent)
}
} to solve the problem. Am I right? I think that this problem is a great thing that we should highlight in our examples in the readme! We can point out https://github.com/marketplace/actions/strip-markdown-extensions-from-links-action like this:
see a potential version of it: https://github.com/Andrew-Chen-Wang/github-wiki-action/tree/jcbhmr#preprocessing @ribtoks does this meet with your expectations of this action? thoughts? 🤔 |
As time has passed, my opinion on whether or not this is in-scope for this action have changed.
SO in summary, while it was good to get v4 out and in the wild, I guess now it's time to revisit the goal of what "github-wiki-action" means. #26 Taken maximally, it does include this feature builtin. |
To do this, it would seem that it's relatively basic:
Actually, that will fail with codeblocks or other stuff like To do it the right way, it looks like I need to use something like this: const visit = require('unist-util-visit');
module.exports = function (options) {
function visitor(node) {
if (/\.md$/.test(node.url)) {
node.url = node.url.replace(/\.md$/, "")
}
}
function transform(tree) {
visit(tree, ['link', 'linkReference'], visitor);
}
return transform;
}; https://github.com/Pondorasti/remark-img-links |
Hi
Thanks for developing github-wiki-action. There's a small problem with cross-links:
Steps to reproduce:
docs/First.md
anddocs/Second.md
[Second](./Second.md)
to theFirst.md
The text was updated successfully, but these errors were encountered: