joeyespo / grip

Preview GitHub README.md files locally before committing them.
MIT License
6.42k stars 423 forks source link

Add GitLabRenderer #316

Open jerrykan opened 4 years ago

jerrykan commented 4 years ago

An initial attempt at creating a renderer using the GitLab API. Authentication has not yet been implemented, so the --context option can only be used with public repositories.

This is mainly meant as some initial work to see if there is interest in the feature. I assume the next steps would be to implement some sort of --renderer options to enable the GitLabRenderer, add support for authentication, and tests.

jerrykan commented 4 years ago

Thought I would add a --renderer option while I was at it, just to fill out the proof of concept a bit.

Lucas-C commented 4 years ago

I do not maintain this repo, but thanks for this PR that adds a useful feature !

I've just tested it and it works fine:

pip install --user git+https://github.com/jerrykan/grip.git@gitlab-renderer
grip -b --renderer=gitlab
ericfrederich commented 4 years ago

:-1: Do not merge. This breaks configuration. :-1:

The GitLab rendering works but this, as it is, breaks the ability to use ~/.grip/settings.py for configuration. The renderer ends up getting instantiated before the settings are read. This change even affected the GitHub renderer as well. Also, if --renderer is added as an option there should also be a way to configure it in the configuration file.

jerrykan commented 4 years ago

@ericfrederich yeah, this was only meant as a proof-of-concept. I didn't want to spend too much time on it if there was no chance of it being merged.

Unfortunately is seem the projects doesn't seem to have been active for a while, so :shrug:

ericfrederich commented 4 years ago

I think it's a worthy feature. I'd like to render my Markdown stuff locally without making commits and without sending confidential information over the internet to GitHub. We host our own GitLab. I'd be in support of this.

MarcelRobitaille commented 2 years ago

Thanks for this PR. I found that KaTeX is not being rendered. Is that a supported feature?

verm commented 3 months ago

GitLab now requires authentication to access the MarkDown API. Adding PRIVATE-TOKEN to GitLabRenderer in renderers.py fixes the issue. You'll need to create an API token.

Otherwise this works great! Hopefully it makes it in officially one day. Thank you.