Skip to content
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

[feature request] support for gitlab wiki pages #23

Open
pReya opened this issue Feb 1, 2021 · 12 comments
Open

[feature request] support for gitlab wiki pages #23

pReya opened this issue Feb 1, 2021 · 12 comments

Comments

@pReya
Copy link

pReya commented Feb 1, 2021

Aside from regular markdown files, Gitlab also supports wiki pages, which behave a little differently from regular repo files. There's a separate API endpoint for wiki pages: https://docs.gitlab.com/ee/api/wikis.html

Would be great if these could be embedded as well, since these often contain static markdown content which is a good candidate to embed in a website.

@nilsnolde
Copy link
Owner

Sounds helpful. I won’t work in that direction myself (no use for us), but I’d be happy to review a PR if you wanna give it a shot.

@pReya
Copy link
Author

pReya commented Feb 2, 2021

@nilsnolde I might give it a try. Would you prefer to use a separate short code/provider (like git-gitlabwiki) or to detect this from the URL structure and use the same gitlab shortcode/provider?

@pReya
Copy link
Author

pReya commented Feb 2, 2021

@nilsnolde Sorry, this is slightly off topic, but I'm very interested in your reasoning: When you started this plugin, why did you chose to get the Git content via the API and not the regular raw web view that Gitlab/Github offer? (e.g. https://raw.githubusercontent.com/gis-ops/wordpress-markdown-git/master/README.md)

Wouldn't it be easier to use the web view, because you don't need to parse and split the URLs and just request the given URL directly?

Would you be open to accepting a PR, that adds a "direct/raw" shortcode or parameter, which does exactly that? Just requests the given URL and sends it to the GitHub API to be parsed? This would also allow to embed Markdown files outside of git repos.

@nilsnolde
Copy link
Owner

nilsnolde commented Feb 2, 2021

You're raising good points.

Wouldn't it be easier to use the web view, because you don't need to parse and split the URLs and just request the given URL directly?

Not sure (why I didn't think of that before) ;) Indeed that would eliminate a lot of the complexity, esp from provider specific implementations! Now it's a little late to change without breaking anything, but I'd be happy to have the direct/raw view and maybe eventually change it all to that logic. Be aware of private repos though, all providers differ here again in auth specifics. But surely easier than the current URL parsing/splitting!

Long story short: definitely would welcome that. Probably (for now) also best to have separate shortcodes for that (git-<provider>-markdownraw?). What do you think?

Would you prefer to use a separate short code/provider (like git-gitlabwiki)

Yep, I like that better and easier to implement I guess. Feel free to skip the other providers for now (goes for both raw and wiki), as long as you can implement it fairly generic (as much in base classes as possible).

@nilsnolde
Copy link
Owner

btw, feel free to change code as well if you feel there would be more elegant ways to do stuff. not really a PHP/WP guy here, this repo powers our tutorials section, that's the only reason it exists;)

@pReya
Copy link
Author

pReya commented Feb 2, 2021

@nilsnolde Thanks for the answer. I'll see if I can cook something up. Also, I'm "not really a PHP/WP guy" either 😄

@pReya
Copy link
Author

pReya commented Feb 4, 2021

@nilsnolde Sorry, but adjusting your plugin seemed like a lot of work. So I decided to create a new plugin on my own, which is a much simpler version of your concept. Hope you don't mind. https://github.com/pReya/wordpress-external-markdown/tree/main#readme

@nilsnolde
Copy link
Owner

🤷

@ElDavoo
Copy link

ElDavoo commented Sep 5, 2021

:(

@ElDavoo
Copy link

ElDavoo commented Sep 5, 2021

@nilsnolde Sorry, but adjusting your plugin seemed like a lot of work. So I decided to create a new plugin on my own, which is a much simpler version of your concept. Hope you don't mind. https://github.com/pReya/wordpress-external-markdown/tree/main#readme

thing is, private wiki pages are not supported this way, you still need to auth.

@pReya
Copy link
Author

pReya commented Sep 8, 2021

@ElDavoo that's correct – it's intended that way. But you can still use wordpress-markdown-git for this, right?

@nilsnolde
Copy link
Owner

maybe you can cherry pick @pReya work into a PR here. as he mentioned it's a little more involved, but not too hard if you know php a bit. again, it's fair enough to only implement for now for gitlab, leaving github/bitbucket for others to contribute if they need it

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

No branches or pull requests

3 participants