wordpress-markdown-git icon indicating copy to clipboard operation
wordpress-markdown-git copied to clipboard

[feature request] support for gitlab wiki pages

Open pReya opened this issue 4 years ago • 12 comments

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.

pReya avatar Feb 01 '21 21:02 pReya

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.

nilsnolde avatar Feb 02 '21 07:02 nilsnolde

@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 avatar Feb 02 '21 07:02 pReya

@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.

pReya avatar Feb 02 '21 13:02 pReya

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 avatar Feb 02 '21 18:02 nilsnolde

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;)

nilsnolde avatar Feb 02 '21 18:02 nilsnolde

@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 avatar Feb 02 '21 21:02 pReya

@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

pReya avatar Feb 04 '21 16:02 pReya

:shrug:

nilsnolde avatar Feb 05 '21 08:02 nilsnolde

:(

ElDavoo avatar Sep 05 '21 09:09 ElDavoo

@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.

ElDavoo avatar Sep 05 '21 09:09 ElDavoo

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

pReya avatar Sep 08 '21 08:09 pReya

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

nilsnolde avatar Sep 08 '21 09:09 nilsnolde