agusmakmun / django-markdown-editor Goto Github PK
View Code? Open in Web Editor NEWAwesome Django Markdown Editor, supported for Bootstrap & Semantic-UI
License: GNU General Public License v3.0
Awesome Django Markdown Editor, supported for Bootstrap & Semantic-UI
License: GNU General Public License v3.0
I found the highlight html code is not the same as the original markdown + Pygments.
So can not use the exist github.css from markdown plugin.
It seems that the syntax highlighting doesn't work with template tages. For example, with:
{% load dractags %}
{{ content | safe_makrdown }}
where content is:
```python
import numpy as np
import matplotlib.pyplot as plt
x = np.random.randn(100)
y = np.random.randn(100)
plt.plot(x, y)
\```
only surrounds the string wiht , but doesn't really render any of the hljs tags.
I wonder if I'm doing something wrong or simply this feature is not available (I copied the default settings from front page, using django 1.11 final).
Thanks!
Currently I cant type a capital S because its a shortcut and gets replaced with ~~ ~~ I assume I cant use a capital U either for a similar reason.
Can the shortcuts be turned of as a quick fix ?
rt
Similar to the issue I raised about bold adding double the amount of asterisks, I've found that the same is true for italics, headings, and selecting the "pre" option when you want to highlight code. Please see the following screenshot, which was generated by typing text, selecting it, and then choosing on of the options from the bar. Note: I did not press the button twice, just once. The issue persists in both chrome and safari.
It only happens when you click on the buttons in the toolbar. Using the keyboard shortcuts works as expected.
Is there a way I can remove line numbers from the left margin of the app? See: Google group question
When running fetch_emojii the images are fetched and uploaded to a bucket.
How ever on display the domain and hash's are missing so the used emojiis do not work when displayed if you dont use a bucket and have a localfile system store everything works fine.
Usually {% static %} fixes this but because the path's are worked out before the template is rendered they are incorrect.
Incoming PR which should fix this.
It only working when form is already present in page, or after refresh. But if form is rendered using ajax then it doesn't work.
Please help.
How can I override the css for the widget?
Hi. Currently the template I've written will generate one editor at the top which serves its purpose, however, when I click on a "Reply" button on the page I want another markdown editor form to be appended below.
I've currently tried cloning the form above and changing the ids to avoid conflicts however this renders the form unusable altogether (cannot type, button clicks on the editor do nothing). If I include two forms in the template (so not generated by Javascript) any buttons I click on the second editor will only ever make changes to the 1st editor.
I currently suspect most of these issues are due to the handlers on the Javascript files provided and was wondering if there was a potential workaround without having to change the JS files?
Below is the code in the HTML template which renders the current editor at the top of the page (works correctly)
<form method="POST" id="comment-post-form" class="comment-post-form">
{% csrf_token %}
{% for field in comment_form %}
<p class="{{field.name}}-container">
{{ field }}
</p>
{% endfor %}
<button name="comment_submit" type="submit">Post Comment</button>
</form>
Below is the JS function which when the reply button is pressed is called. It should append the editor to div tag provided, whilst adding a user mention preloaded into the editor. The code below was from my attempt of cloning the editor already on the page using jQuery.
function generateReplyForm(commentIdAppendTo) {
const userReplyTo = $(`#${commentIdAppendTo}`).children('.comment-author-username').html();
let newForm = $('#comment-post-form').clone().removeAttr('id');
newForm.find('.ace_content').text(`@${userReplyTo}`);
newForm.find('#martor-content').attr('id', `#martor-content${commentIdAppendTo}`);
newForm.find('#id_content').attr('id', `#id_content${commentIdAppendTo}`);
$(`#${commentIdAppendTo}`).append(newForm);
}
Hi,
I have multiples titles which are translates as h1, h2 ... But when I try to render, it doesn't add an id attribute on the html tag, which leads me to not having table of content.
Any idea ?
Thanks you :)
Hello,
Can someone help me with very weird bug? On production settings ace.js
makes request to invalid path. Something like this: https://<domain>/en/patterns/snippets/markdown.js/
where correct path must be https://<domain>/static/plugins/js/snippets/markdown.js/
. Development server on local machine doesn't produce such a behaviour. Maybe i miss some setting?
Hi!
I write a blog engine and the martor prints every page load "Successfully loaded extension" or "Successfuly imported extension module". How can I hide these messages?
web01 | Successfuly imported extension module "markdown.extensions.extra".
web01 | Successfuly imported extension module "markdown.extensions.smart_strong".
web01 | Successfully loaded extension "markdown.extensions.smart_strong.SmartEmphasisExtension".
web01 | Successfuly imported extension module "markdown.extensions.fenced_code".
web01 | Successfully loaded extension "markdown.extensions.fenced_code.FencedCodeExtension".
web01 | Successfuly imported extension module "markdown.extensions.footnotes".
web01 | Successfully loaded extension "markdown.extensions.footnotes.FootnoteExtension".
web01 | Successfuly imported extension module "markdown.extensions.attr_list".
web01 | Successfully loaded extension "markdown.extensions.attr_list.AttrListExtension".
web01 | Successfuly imported extension module "markdown.extensions.def_list".
web01 | Successfully loaded extension "markdown.extensions.def_list.DefListExtension".
web01 | Successfuly imported extension module "markdown.extensions.tables".
web01 | Successfully loaded extension "markdown.extensions.tables.TableExtension".
web01 | Successfuly imported extension module "markdown.extensions.abbr".
web01 | Successfully loaded extension "markdown.extensions.abbr.AbbrExtension".
web01 | Successfully loaded extension "markdown.extensions.extra.ExtraExtension".
web01 | Successfuly imported extension module "markdown.extensions.nl2br".
web01 | Successfully loaded extension "markdown.extensions.nl2br.Nl2BrExtension".
web01 | Successfuly imported extension module "markdown.extensions.smarty".
web01 | Successfully loaded extension "markdown.extensions.smarty.SmartyExtension".
web01 | Successfuly imported extension module "markdown.extensions.fenced_code".
web01 | Successfully loaded extension "markdown.extensions.fenced_code.FencedCodeExtension".
web01 | Successfuly imported extension module "martor.extensions.urlize".
web01 | Successfully loaded extension "martor.extensions.urlize.UrlizeExtension".
web01 | Successfuly imported extension module "martor.extensions.del_ins".
web01 | Successfully loaded extension "martor.extensions.del_ins.DelInsExtension".
web01 | Successfuly imported extension module "martor.extensions.mention".
web01 | Successfully loaded extension "martor.extensions.mention.MentionExtension".
web01 | Successfuly imported extension module "martor.extensions.emoji".
web01 | Successfully loaded extension "martor.extensions.emoji.EmojiExtension".
web01 | Successfuly imported extension module "martor.extensions.mdx_video".
web01 | Successfully loaded extension "martor.extensions.mdx_video.VideoExtension".
`
I'm use docker so the web01 is my container name.
Thanks,
Greg
Hello,
I have a simple question about the emojis used in your markdown extension.
Does the assets-cdn used for rendering emojis is under a license ? Can we use it has free ?
Sincerely.
When I use list, it can not automatically complete the number after pressing the Enter key.
Synthax highlighting is not working.
I am getting this (code block is not highlighted in my case though)
def foo():
print("Hi")
Instead of this
def foo():
print("Hi")
Also preview in admin page is not working. The result of the preview is always
"Nothing to preview"
However I can display the markdown content on the page (without synthax highlighting).
Django version 2.1.2.
Markdown version 2.6.11
Hello,
Is it possible to integrate Flickr API instead of Imgur?
Thanks a lot!!
Hi, there is this bug when there are 2 or more martor fields on the same page.
The first one is rendered well, but the others are incompletes, and miss this part of the code:
<div id="martor-content" class="martor-field martor-field-content ace_editor resizable ace-github" draggable="false">
<div style="position: absolute;"></div>
<textarea class="ace_text-input" autocorrect="off" autocapitalize="off" spellcheck="false" style="opacity: 0; font-size: 1px; height: 1px; width: 1px; top: 24px; left: 86px;" wrap="off">
</textarea>
<div class="ace_gutter" aria-hidden="true" style="left: 0px; width: 40px;">
<div class="ace_layer ace_gutter-layer ace_folding-enabled" style="height: 1000000px; top: 10px; left: 0px; width: 40px;">
<div class="ace_gutter-cell ace_gutter-active-line " style="height: 14px; top: 0px;">
1
<span class="ace_fold-widget ace_start ace_open" style="height: 14px; display: inline-block;"></span>
</div>
</div>
</div>
<div class="ace_scroller" style="left: 40px; right: 0px; bottom: 0px;">
<div class="ace_content" style="top: 10px; left: 0px; width: 795px; height: 128px;">
<div class="ace_layer ace_print-margin-layer">
<div class="ace_print-margin" style="left: 564px; visibility: visible;"></div>
</div>
<div class="ace_layer ace_marker-layer">
<div style="height: 14px; top: 0px; left: 0px; right: 0px;" class="ace_active-line"></div>
</div>
<div class="ace_layer ace_text-layer" style="height: 1000000px; margin: 0px 4px; top: 0px; left: 0px;">
<div style="height: 14px; top: 0px;" class="ace_line_group">
<div class="ace_line" style="height: 14px;">
<span class="ace_markup ace_heading ace_1">#</span>
<span class="ace_heading">my awesome markdown</span>
</div>
</div>
</div>
<div class="ace_layer ace_marker-layer"></div>
<div class="ace_layer ace_cursor-layer ace_hidden-cursors">
<div class="ace_cursor" style="display: block; top: 0px; left: 46px; width: 7px; height: 14px; animation-duration: 1000ms;"></div>
</div>
</div>
</div>
<div class="ace_scrollbar ace_scrollbar-v" style="display: none; width: 22px; bottom: 0px;">
<div class="ace_scrollbar-inner" style="width: 22px; height: 34px;"></div>
</div>
<div class="ace_scrollbar ace_scrollbar-h" style="display: none; height: 22px; left: 40px; right: 0px;">
<div class="ace_scrollbar-inner" style="height: 22px; width: 835px;"></div>
</div>
<div style="height: auto; width: auto; top: 0px; left: 0px; visibility: hidden; position: absolute; white-space: pre; font: inherit; overflow: hidden;">
<div style="height: auto; width: auto; top: 0px; left: 0px; visibility: hidden; position: absolute; white-space: pre; font: inherit; overflow: visible;">הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה</div>
<div style="height: auto; width: auto; top: 0px; left: 0px; visibility: hidden; position: absolute; white-space: pre; font-style: inherit; font-variant: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; font-size-adjust: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-language-override: inherit; font-feature-settings: inherit; font-variation-settings: inherit; overflow: visible;">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</div>
</div><div class="resizable-handle resizable-b"></div><div class="resizable-handle resizable-b"></div>
</div>
requirements.txt just has "Markdown" (therefore pip installs the latest version), but the code only allows 2.6.9.
except Exception:
raise VersionNotCompatible("The markdown isn't compatible, please reinstall "
"your python markdown into Markdown==2.6.9")
Can this be updated for newer versions and specify the version required (if necessary) in the requirements.txt?
Also note that the error is displayed for any error I've encountered with martor even when 2.6.9 is installed.
Hello, I followed your instruction to apply the changes to my models.py and expected to see the same toolbar in my frontend blog post editor as the one shown in Admin. However it doesn't work (it looks like this:
I also tried the suggestions in the post , still doesn't work.
Here is my code (model.py):
## models.py
from django.db import models
from django.utils import timezone
from martor.models import MartorField
class Post(models.Model):
author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
title = models.CharField(max_length=200)
#text = models.TextField()
text = MartorField()
created_date = models.DateTimeField(
default=timezone.now)
published_date = models.DateTimeField(
blank=True, null=True)
And forms.py
## forms.py
from django.forms import ModelForm
from martor.fields import MartorFormField
from martor.widgets import AdminMartorWidget
from .models import Post, Comment
class PostForm(ModelForm):
class Meta:
model = Post
fields = ('title', 'text',)
widgets = {
'text': AdminMartorWidget,
}
How can I add the markdown toolbar as in Django Admin (the figure1) into my blog editing page? Thanks in advance!
Hi there, I recently downloaded 1.2.7 today. I noticed that the editor supports embedded videos, which is great! However, I can only display embedded video when MARTOR_MARKDOWN_SAFE_MODE = False. Is there a way to display video while that value is set to true?
For my use case, I am developing a blog where the editor is only present in my admin page. Would it be secure to set the safe mode value to False since I am the only one who has access to the markdown editor?
how can I change the size of an image using Markdown?
I followed the procedures for running the example project, but Preview doesn't work. I got the following errors:
Internal Server Error: /martor/markdownify/
Traceback (most recent call last):
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/Django-2.1.1-py3.6.egg/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/Django-2.1.1-py3.6.egg/django/core/handlers/base.py", line 126, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/Django-2.1.1-py3.6.egg/django/core/handlers/base.py", line 124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/martor-1.3.3-py3.6.egg/martor/views.py", line 17, in markdownfy_view
return HttpResponse(markdownify(request.POST['content']))
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/martor-1.3.3-py3.6.egg/martor/utils.py", line 28, in markdownify
extension_configs=MARTOR_MARKDOWN_EXTENSION_CONFIGS
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/Markdown-3.0.1-py3.6.egg/markdown/core.py", line 390, in markdown
md = Markdown(**kwargs)
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/Markdown-3.0.1-py3.6.egg/markdown/core.py", line 100, in __init__
configs=kwargs.get('extension_configs', {}))
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/Markdown-3.0.1-py3.6.egg/markdown/core.py", line 126, in registerExtensions
ext = self.build_extension(ext, configs.get(ext, {}))
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/Markdown-3.0.1-py3.6.egg/markdown/core.py", line 181, in build_extension
return module.makeExtension(**configs)
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/martor-1.3.3-py3.6.egg/martor/extensions/del_ins.py", line 48, in makeExtension
return DelInsExtension(configs=dict(configs))
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/Markdown-3.0.1-py3.6.egg/markdown/extensions/__init__.py", line 42, in __init__
self.setConfigs(kwargs)
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/Markdown-3.0.1-py3.6.egg/markdown/extensions/__init__.py", line 73, in setConfigs
self.setConfig(key, value)
File "/home/jdshueu/.local/share/virtualenvs/martor-pW1NQgAM/lib/python3.6/site-packages/Markdown-3.0.1-py3.6.egg/markdown/extensions/__init__.py", line 61, in setConfig
if isinstance(self.config[key][0], bool):
KeyError: 'configs'
When I input Chinese, the Pinyin of Chinese characters is also input. Like this, when I input "你好", it got "ni hao你好".
I'm using Mac OS X.
I am trying to save the images to be upload in the post in a local storage. Is it to change the display size of the image at the time of uploading ?
Log:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 158, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 156, in _get_response
response = response.render()
File "/usr/local/lib/python3.6/site-packages/django/template/response.py", line 106, in render
self.content = self.rendered_content
File "/usr/local/lib/python3.6/site-packages/django/template/response.py", line 83, in rendered_content
content = template.render(context, self._request)
File "/usr/local/lib/python3.6/site-packages/django/template/backends/django.py", line 61, in render
return self.template.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 175, in render
return self._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 167, in _render
return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 943, in render
bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 910, in render_annotated
return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py", line 155, in render
return compiled_parent._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 167, in _render
return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 943, in render
bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 910, in render_annotated
return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py", line 155, in render
return compiled_parent._render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 167, in _render
return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 943, in render
bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 910, in render_annotated
return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/defaulttags.py", line 517, in render
return self.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 943, in render
bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 910, in render_annotated
return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py", line 67, in render
result = block.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 943, in render
bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 910, in render_annotated
return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/loader_tags.py", line 67, in render
result = block.nodelist.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 943, in render
bit = node.render_annotated(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 910, in render_annotated
return self.render(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 993, in render
output = self.filter_expression.resolve(context)
File "/usr/local/lib/python3.6/site-packages/django/template/base.py", line 703, in resolve
new_obj = func(obj, *arg_vals)
File "/usr/local/lib/python3.6/site-packages/martor/templatetags/martortags.py", line 21, in safe_markdown
return mark_safe(markdownify(field_name))
File "/usr/local/lib/python3.6/site-packages/martor/utils.py", line 28, in markdownify
extension_configs=MARTOR_MARKDOWN_EXTENSION_CONFIGS
File "/usr/local/lib/python3.6/site-packages/markdown/core.py", line 390, in markdown
md = Markdown(**kwargs)
File "/usr/local/lib/python3.6/site-packages/markdown/core.py", line 100, in __init__
configs=kwargs.get('extension_configs', {}))
File "/usr/local/lib/python3.6/site-packages/markdown/core.py", line 126, in registerExtensions
ext = self.build_extension(ext, configs.get(ext, {}))
File "/usr/local/lib/python3.6/site-packages/markdown/core.py", line 181, in build_extension
return module.makeExtension(**configs)
File "/usr/local/lib/python3.6/site-packages/martor/extensions/del_ins.py", line 48, in makeExtension
return DelInsExtension(configs=dict(configs))
File "/usr/local/lib/python3.6/site-packages/markdown/extensions/__init__.py", line 42, in __init__
self.setConfigs(kwargs)
File "/usr/local/lib/python3.6/site-packages/markdown/extensions/__init__.py", line 73, in setConfigs
self.setConfig(key, value)
File "/usr/local/lib/python3.6/site-packages/markdown/extensions/__init__.py", line 61, in setConfig
if isinstance(self.config[key][0], bool):
KeyError: 'configs'
Downgrading to Markdown 2.6.11 fixed the problem for me.
Hi,
Is it possible to set bigger font size in editor in django-admin?
This uses semantic.js if you install on a site with bootstrap it breaks dialog boxes becuase they have the same .dialog js methods and similar styles.
Is there a way to fix this with out changing an entire site to use bootstraps no conflict mode ?
currently i have had to remove semantic.js to make dialogs work on my site any better solution ?
I am currently trying to integrate this into django wiki i have a PR with my current progress if interested.
Instead of getting a preview, it just looks exactly like the raw text in the editor box.
models.py:
class Question(models.Model, HitCountMixin):
title = models.CharField(max_length=200, blank=False)
description = MartorField()
forms.py
class QuestionForm(forms.ModelForm):
class Meta:
model = Question
fields = ['title', 'description']
widgets = {
'description': AdminMartorWidget,
}
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user')
super(QuestionForm, self).__init__(*args, **kwargs)
self.fields['description'] = MartorFormField()
EDIT
My new form looks like this:
class QuestionForm(forms.ModelForm):
class Meta:
model = Question
fields = ['title', 'description']
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user')
super(QuestionForm, self).__init__(*args, **kwargs)
self.fields['description'] = MartorFormField()
Can it be possible that Preview is not displaying (not even switching to preview tab) because X-Frame-Options is set to DENY ?
Whenever any HTML Code is written inside the editor it is being removed as [HTML_REMOVED]
.
Ideally, this should not happen. Can you please have a look into it.
Hi.
Very nice library. I was using django-markdownx until now but then I saw your app. Great job!
I am wondering if it is possible to show Editor and Preview side-by-side using any existing setting or an easy solution? If not, can you consider such feature, please?
Something like this:
Resource: https://github.com/christopherfouquier/mkeditorjs
Demo: https://www.jqueryscript.net/demo/Feature-rich-WYSIWYG-Markdown-Editor-Plugin-with-jQuery-MKEditor/
Hello,
I just found this plugin and it is just what I need -congratulations for the good work ;)-, after installing and setting up some fields to DraceditorField() I entered the django admin panel and found the following error.
While in a model if you have only just 1 DraceditorField, the widget works as expected
But in the moment that in a same model two DraceditorFields are added when entering admin panel one of the widgets become unresponsive and duplicated with information of the previous field, and of course it is impossible to edit its content also. Try it by yourself, declare a model with two DraceditorField.
See how 2nd Markdown editor looks weird in the following image:
Do you have a guess on why this is happening? Could be easy for you to fix it?
I'm getting this error render() got an unexpected keyword argument 'renderer'
when I access the django admin after I upgraded to django 2.1
when trying to run collectstatic with the gzip storage engine, it errors when processing semantic.min.css.
because the flags.png file is not present so it fails to compress and stops the collect static process.
Its looking for a child path of the below in the css file.
themes/default/assets/images/flags.png
So basically, when I select certain formatting option (lets say bold text) I have to click the toolbar again. is there a way to force autofocus?
Hello! Look at that, code from the docstring of markdownify. I cant get what's wrong
>>> from martor.utils import markdownify
>>> content = "![awesome](http://i.imgur.com/hvguiSn.jpg)"
>>> markdownify(content)
Traceback (most recent call last):
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/serializers.py", line 95, in _escape_cdata
if "&" in text:
TypeError: a bytes-like object is required, not 'str'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/martor/utils.py", line 28, in markdownify
extension_configs=MARTOR_MARKDOWN_EXTENSION_CONFIGS
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/__init__.py", line 494, in markdown
return md.convert(text)
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/__init__.py", line 375, in convert
newRoot = treeprocessor.run(root)
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/extensions/toc.py", line 260, in run
toc = self.markdown.serializer(div)
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/serializers.py", line 282, in to_xhtml_string
return _write_html(ElementTree(element).getroot(), format="xhtml")
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/serializers.py", line 203, in _write_html
_serialize_html(write, root, qnames, namespaces, format)
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/serializers.py", line 188, in _serialize_html
_serialize_html(write, e, qnames, None, format)
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/serializers.py", line 186, in _serialize_html
write(_escape_cdata(text))
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/serializers.py", line 103, in _escape_cdata
_raise_serialization_error(text)
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/serializers.py", line 78, in _raise_serialization_error
"cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize b'Contents' (type bytes)
>>> markdownify(content.encode('utf-8'))
Traceback (most recent call last):
File "/home/vsyrov/Home/PycharmProjects/web-linux36/lib/python3.5/site-packages/markdown/serializers.py", line 95, in _escape_cdata
if "&" in text:
TypeError: a bytes-like object is required, not 'str'
python 3.5.4
When having several MartorFormField in the same form (and thus Django Admin interface, otherwise I would have integrated it in my own template), it is difficult to identify what is the role of each field because the label is emptied at the field creation (see fields.py line 12) :
class MartorFormField(forms.CharField):
def __init__(self, *args, **kwargs):
kwargs['label'] = '' # To set without label.
super(MartorFormField, self).__init__(*args, **kwargs)
if not issubclass(self.widget.__class__, MartorWidget):
self.widget = MartorWidget()
Is it possible to remove this instruction to let the choice to the user ? I patched the code in my project but for maintainability it would be better if this could be integrated in the main branch.
Anyway kudos for this helpful library !
I would like to save the results of this editor in the database and render it as React as it is, what kind of method is there?
I would like to know if there is something good compatible package etc.
If the uploaded photo has been taken in portrait mode, the preview shows the image in landscape mode. It ignores the EXIF data. Is it possible to fix it somehow?
Hi.
Is it possible to specify a different user model for the mentions without forking the repository and manually changing it?
Getting the following trace, has anyone encountered this before?
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/core/handlers/base.py", line 217, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/core/handlers/base.py", line 215, in _get_response
response = response.render()
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/response.py", line 107, in render
self.content = self.rendered_content
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/response.py", line 84, in rendered_content
content = template.render(context, self._request)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/backends/django.py", line 66, in render
return self.template.render(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 207, in render
return self._render(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/loader_tags.py", line 177, in render
return compiled_parent._render(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 199, in _render
return self.nodelist.render(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/loader_tags.py", line 72, in render
result = block.nodelist.render(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 990, in render
bit = node.render_annotated(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 957, in render_annotated
return self.render(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 1040, in render
output = self.filter_expression.resolve(context)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 736, in resolve
new_obj = func(obj, *arg_vals)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/martor/templatetags/martortags.py", line 21, in safe_markdown
return mark_safe(markdownify(field_name))
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/martor/utils.py", line 28, in markdownify
extension_configs=MARTOR_MARKDOWN_EXTENSION_CONFIGS
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/markdown/__init__.py", line 493, in markdown
md = Markdown(*args, **kwargs)
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/markdown/__init__.py", line 159, in __init__
configs=kwargs.get('extension_configs', {}))
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/markdown/__init__.py", line 185, in registerExtensions
ext = self.build_extension(ext, configs.get(ext, {}))
File "/Users/Jonny/anaconda3/lib/python3.6/site-packages/markdown/__init__.py", line 264, in build_extension
module = importlib.import_module(module_name_old_style)
File "/Users/Jonny/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'mdx_martor'
When posting a link after a bullet point the link seems to fail if : is present in this case thing:3121794 it seems fine when no bullet point is used.
This works
[A thingiverse post](https://www.thingiverse.com/thing:3118584)
[https://www.thingiverse.com/thing:3121794](https://www.thingiverse.com/thing:3121794)
vs this which results in a blank url when the page is rendered
+ [A thingiverse post](https://www.thingiverse.com/thing:3118584)
+ [https://www.thingiverse.com/thing:3121794](https://www.thingiverse.com/thing:3121794)
I believe it happening in urlize but have struggle to track down an exact source, running the above directly through markdown in the repl seems to produce the expected result.
Created an imgur dev account with my keys and photo uploads worked at first (a couple weeks ago). Now I'm having an issue where the image will get uploaded to imgur and the url to the image will will work if I manually copy-paste it into the browser, but the markdown editor box will show something like the following rather than the image itself:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.