0

I've got a Django app that I'm working on, with a wiki (powered by django-wiki) sitting under the wiki/ folder.

The problem I'm having is that if I create links using Markdown, they all direct to the root /, whereas I want any links generated from the markdown to go into the same subdirectory (under /wiki). The documentation doesn't appear to be particularly forthcoming on this (mainly directing me to to the source code, which so far has revealed nothing).

The other avenue I'm looking into is how to direct Markdown itself to prefix all links with a specified path fragment. Is there a Markdown extension or trick that might be useful for accomplishing this?

Adam Luchjenbroers
  • 4,917
  • 2
  • 30
  • 35

1 Answers1

0

Well, it looks like there is just such an extension for this in MarkDown (WikiLinkExtension - which takes a base_url parameter).

I've had to modify my copy of django-wiki to add a new setting to use it (submitted an upstream pull request for it too, since I suspect this will be useful to others). Kinda surprised django-wiki didn't have this support already built but there you go.

EDIT: Ok, it looks like this approach doesn't play nice with a hierarchical Wiki layout (which Django-wiki is designed for). I've cobbled together a hack that allows me to link to child pages of the current page, which is enough to be workable even if it's kind of limited.

Adam Luchjenbroers
  • 4,917
  • 2
  • 30
  • 35
  • Heh, scratch that. Doesn't look like this solution handles hierarchically organised pages. – Adam Luchjenbroers Oct 25 '15 at 10:48
  • 1
    As the developer of Python-Markdown, I would expect that django-wiki would provide an extension of their own to provide support for a feature like this. If they don't, then I expect that there is no way to do what you want outside of manually authoring every URL path yourself. – Waylan Oct 26 '15 at 14:00
  • I think there's some tricky semantics in how it should behave too - since django-wiki has chosen to go with a hierarchical approach to organizing content. I can hack together something that might work for me (I've figured out how to base the URL off the current page path - which seems workable but only really allows you to link child pages) - not sure if it covers every necessary case though. Debating neutering my django-wiki installation so it's flat, and just not providing the functionality for nested pages. – Adam Luchjenbroers Oct 27 '15 at 07:39