We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In the docs I can see I can alter the path to the image using MARKDOWNX_URLS_PATH https://neutronx.github.io/django-markdownx/customization/#markdownx_urls_path
However, the docs say this is a "Relative URL to which the Markdown text is sent to be encoded as HTML", can I not use an absolute path here?
The text was updated successfully, but these errors were encountered:
I haven't tried this myself, but it should be possible via the MARKDOWNX_MEDIA_PATH setting variable (see the documentation).
MARKDOWNX_MEDIA_PATH
If that doesn't work, we can always look into adding a new feature.
Sorry, something went wrong.
Ah, I think I may have confused my own question as I misunderstood the purpose of those settings.
To explain a bit further, what I'm looking to do is to drag in the image, and instead of generating markdown such as:
[](/media/markdownx/myimage.png)
Instead generate an absolute URL that includes the domain:
[](https://mydomain.com/media/markdownx/myimage.png)
I'll take a look and see if I can find a way to prepend the domain etc to the relative '/media/markdownx/' path.
I was able to achieve this in the end by overriding ImageUploadView.
ImageUploadView
In views:
class AbsoluteImageUploadView(ImageUploadView): def form_valid(self, form): response = super(ImageUploadView, self).form_valid(form) if self.request.is_ajax(): image_path = form.save(commit=True) absolute_image_path = self.request.build_absolute_uri(image_path) image_code = '![]({})'.format(absolute_image_path) return JsonResponse({'image_code': image_code}) return response
In urls:
re_path(r'^markdownx/absolute-upload/', AbsoluteImageUploadView.as_view()),
In settings:
MARKDOWNX_UPLOAD_URLS_PATH = '/markdownx/absolute-upload/'
No branches or pull requests
In the docs I can see I can alter the path to the image using MARKDOWNX_URLS_PATH https://neutronx.github.io/django-markdownx/customization/#markdownx_urls_path
However, the docs say this is a "Relative URL to which the Markdown text is sent to be encoded as HTML", can I not use an absolute path here?
The text was updated successfully, but these errors were encountered: