sv0 / django-markdown-app Goto Github PK
View Code? Open in Web Editor NEWDjango markdown support and wysiwyg.
License: GNU Lesser General Public License v3.0
Django markdown support and wysiwyg.
License: GNU Lesser General Public License v3.0
The requirementst.txt specifies that the highest version of django that it can support is 2.3
ciao, thanks for taking over maintenance of the app.
unless i missed something, flatpages markdown content isn't rendered to html. so i came up with this middleware:
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.contrib.flatpages.views import flatpage, render_flatpage
from django.contrib.sites.shortcuts import get_current_site
from django_markdown.utils import markdown
def get_flatpage_object(request):
url = request.path
if not url.startswith('/'):
url = '/' + url
site_id = get_current_site(request).id
try:
f = FlatPage.objects.get(url=url, sites=site_id)
except FlatPage.DoesNotExist:
if not url.endswith('/') and settings.APPEND_SLASH:
request.path += '/'
return get_flatpage_object(request)
else:
return None
return f
class MarkdownFlatpagesMiddleware:
def process_view(self, request, view_func, view_args, view_kwargs):
if view_func is not flatpage:
return None
f = get_flatpage_object(request)
if f is None:
return None
f.content = markdown(f.content)
return render_flatpage(request, f)
shall i make a pr with this?
on the other hand, i feel that the flatpages-app itself should support custom processors, as it already does preprocess content.
Feature Request
希望这个应用能增加代码语法的解析。例如 ```html
I expect this app may add code syntax parser feature like three backquote code-lang.
目前这个应用没有支持三个反引号的语法解析。
This app does not support three backquote syntax now.
Following error comes up on the console window when clicking preview button of the markdown field.
POST 127.0.0.1:8000/markdown/preview 403 (Forbidden)
I think this is because of csrf token missing in the implementation of the post method of function which triggers on the preview button click.
Please fix this issue.
Django 2.2 form Media got new merging rules and specially in admin it affects widgets that needs to add form media.
See https://docs.djangoproject.com/en/2.2/releases/2.2/#merging-of-form-media-assets for more details.
Currently using MarkdownModelAdmin with Django 2.2.1 causes:
Uncaught TypeError: Cannot read property 'fn' of undefined
at jquery.markitup.js:28
at jquery.markitup.js:665
editor.js:1 Uncaught TypeError: jQuery is not a function
at editor.js:1
Can you push a new release to pypi that is compatible with Django 1.11.
Hi. I've hit an issue with this project because the latest version 0.9.4 is not compatible with Django <= 2.0. The failure is
from django.urls import path
ImportError: cannot import name 'path'
I note in the requirements on PyPI, you now say version 0.9.4 requires "Django (<=2.1,>=2.0)". That's fine. Normally I would fix this by pinning to an older version until we are able to upgrade our application. However it also seems that you've also removed all previous version of django-markdown-app
from PyPI (or at least they have been removed):
Removing old versions of a package is generally considered bad package maintenance practice as it is likely to break build/deployment script for users of your package who have pinned to the deleted versions.
I also had a look to see if I could submit a PR to add backward-compatiblity with older django versions (1.11 is still well inside its support window - many user won't be able to upgrade to 2.0 yet), but the code on master
in this repo doesn't match what I downloaded from PyPI.
Key asks are:
the admin form doesn't do anything when trying to add a code block and if i add it manually it doesn't render it properly in template
With 1.11 I get the error "context must be a dict rather than Context."
According to the release notes templates no longer accept Context objects:
Changing django_markdown/utils.py line 48 from:
ctx = Context(dict( selector=selector, extra_settings=simplejson.dumps(options)), autoescape=False)
to
ctx = dict(selector=selector, extra_settings=simplejson.dumps(options))
Seems to resolve the error.
Features Removed: staticfiles.templatetags
Traceback (most recent call last):
File "lib/python3.7/site-packages/django/template/backends/django.py", line 121, in get_package_libraries
module = import_module(entry[1])
File "lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "lib/python3.7/site-packages/django_markdown/templatetags/django_markdown_static.py", line 7, in
from django.contrib.staticfiles.templatetags.staticfiles import static as _static # noqa
ModuleNotFoundError: No module named 'django.contrib.staticfiles.templatetags'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "lib/python3.7/site-packages/django/core/management/base.py", line 395, in check
include_deployment_checks=include_deployment_checks,
File "lib/python3.7/site-packages/django/core/management/base.py", line 382, in _run_checks
return checks.run_checks(**kwargs)
File "lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "lib/python3.7/site-packages/django/contrib/admin/checks.py", line 76, in check_dependencies
for engine in engines.all():
File "lib/python3.7/site-packages/django/template/utils.py", line 90, in all
return [self[alias] for alias in self]
File "lib/python3.7/site-packages/django/template/utils.py", line 90, in
return [self[alias] for alias in self]
File "lib/python3.7/site-packages/django/template/utils.py", line 81, in getitem
engine = engine_cls(params)
File "lib/python3.7/site-packages/django/template/backends/django.py", line 25, in init
options['libraries'] = self.get_templatetag_libraries(libraries)
File "lib/python3.7/site-packages/django/template/backends/django.py", line 43, in get_templatetag_libraries
libraries = get_installed_libraries()
File "lib/python3.7/site-packages/django/template/backends/django.py", line 108, in get_installed_libraries
for name in get_package_libraries(pkg):
File "lib/python3.7/site-packages/django/template/backends/django.py", line 125, in get_package_libraries
"trying to load '%s': %s" % (entry[1], e)
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'django_markdown.templatetags.django_markdown_static': No module named 'django.contrib.staticfiles.templatetags'
Hallo,
Thank you for creating this application.
After inserting django_markdown
to installed apps, I receive the error:
ImportError: No module named 'django_markdown'
I am using Django 1.9.9
on Python 3.4.2
and:
$ pip freeze
...
django-markdown-app==0.8.6
django-markdown-deux==1.0.5
Markdown==2.6.6
markdown2==2.3.1
Interesting problem I've found is, If I have multiple markdown fields in my model and thus in my admin, only the first field will have the editor initialized. There's multiple jsons embedded in the html with the same id which is the main problem. Also because I have multiple markdown fields in the admin, webpage tries to load same js file over and over too. This was not the case in 0.9.2 but you removed that version from pypi and my production servers are having serious issues right now. I can't deploy any new server with 0.9.2 and 0.9.3.1 breaks the admin. What should I do?
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.