torchbox/wagtail-markdown

Inline link to documents is broken

jcuotpc opened this issue · 2 comments

I tried the inline link to documents (<:doc:My fancy document.pdf>) but it is broken.
ImportError: cannot import name 'wagtaildocs' from 'wagtail'

I believe a fix needs to be made in the module wagtailmarkdown.mdx.linkers.document:

The follwing code at line 13:

from wagtail import wagtaildocs

should be replaced with:

try:  # wagtail < 2.0
    from wagtail.wagtaildocs.models import Document
except ImportError:  # wagtail >= 2.0
    from wagtail.documents.models import Document

and line 25 should be changed to:

doc = Document.objects.get(title=name)

a pull request has been created for this issue:
#74

merged #74.