-
Notifications
You must be signed in to change notification settings - Fork 424
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
Synthesize Github WikiLinks #175
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR, @tweekmonster! I'm going to think about this. On the one hand, this gives Grip the ability to render Wiki-style GFM. On the other, this could cause confusion when using Grip for its intended purpose. For example, it'd be easy to forget to add the For that reason, I'm reluctant to pull in non-GFM behavior like this. How else could Wiki-specific formatting be handled that wouldn't interfere with normal Grip usage? |
@joeyespo I thought about this too in hindsight. I think adding a |
Please merge it asap! This is what I really need to use grip! |
@joeyespo Do you have any thoughts on adding a It looks like adding a new flag would require changes to a lot of function signatures, unless you're not opposed to having a module variable set if |
@tweekmonster I'm not a heavy user of the GitHub Wiki pages, so it's hard for me to know if a particular wiki-related feature belongs in grip. That said, I'm very willing to dive in since Wiki pages are a big part of GitHub. More importantly, the rendering seems to have a lot of overlap with GFM. I'm up for experimenting with a Are you up for adding the |
@tweekmonster One approach would be to subclass class GitHubWikiRenderer(GitHubRenderer):
def render(self, text, auth=None):
if not self.user_content:
text = self.wiki_patch(text)
return super(GitHubWikiRenderer, self).render(text, auth)
def wiki_patch(self, text):
... As for Then finally, add a new I think that should cover it. This would open the doors to playing with other wiki-specific features. |
As far as I can tell, WikiLinks is the only unique markup for wikis. My use case for grip was quickly previewing wiki pages locally because textarea editing is annoying. I don't think the footer or side bar rendering are really necessary, but would be nice.
This is pretty helpful! Now I have an idea of where to get started. I was having trouble following the trail. 😅 |
@joeyespo I added the @EugeneZee If you're in a rush to have WikiLinks, you can run: |
@tweekmonster amazing!!! thanks, it works great, but these is one more enhancement that is needed to be done: |
@EugeneZee I think images will be outside the scope of this PR. Besides, I never needed to use images in GitHub wikis, so I don't think I'm qualified to ensure it would work as expected. |
@EugeneZee Actually, your example image tag is a local image right? It's not relative to a GitHub repo or anything like that? If that's the case, I think it would be trivial to add that. |
@tweekmonster Exactly, it is a local image. Github allows to upload images to a sub-folder and then if it sees a link to a local image it converts it to an image tag. |
@joeyespo Have you been able to review the changes? |
- Append extension to filename if absent
9059cb8
to
af12a51
Compare
Ping @joeyespo |
Is there anything that prevents this from going into master (aside from the resolve)? It would be awesome to be able to use Grip for wiki preview as well.
|
This makes it a little easier to locally preview wiki pages. WikiLinks syntax is converted to standard Markdown links before submission to the Github API. Additionally,
DirectoryReader
will append the file extension tofilename
if it's missing.