推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
ansheng
V2EX  ›  Python

如何在 Django-admin 后台中添加 markdown 编辑器呢?

  •  
  •   ansheng ·
    anshengme · Dec 25, 2016 · 3001 views
    This topic created in 3563 days ago, the information mentioned may be changed or developed.

    比如我就准备添加simplemde,如果有做过的 V 友,请指导下,正在开发一个博客,编辑器对我来说太重要了,一直都是用markdown语法写文章,富文本编辑器的话,就用这没那么顺手了。

    NaVient
        1
    NaVient  
       Dec 25, 2016
    自己写个 admin
    crazycabbage
        2
    crazycabbage  
       Dec 25, 2016
    https://www.crazyc.cn/artciles/15/
    用 markdown2 可以把 markdown 解析成 html ,实时显示的话还没有想到什么办法
    StJames
        3
    StJames  
       Dec 25, 2016
    先在 settings 中设置下静态文件地址
    在 admin.py 修改

    ```

    class Media:
    js = (
    'js/jquery.min.js',
    'js/module.min.js',
    'js/hotkeys.min.js',
    'js/simditor.min.js',
    'js/config.js',
    )

    css = {
    'all' : ('css/simditor.css')
    }

    ```

    config.js

    ```

    window.onload = function(){
    var editor = new Simditor({textarea : $('#id_content')});
    }

    ```
    ansheng
        4
    ansheng  
    OP
       Dec 25, 2016
    @ranjiayu
    @crazycabbage
    表示在 django 的 admin 添加了一个 markdown 编辑器,左边编辑,右边阅览,前段展示用 js 插件渲染
    chuanqirenwu
        5
    chuanqirenwu  
       Dec 25, 2016 via iPhone
    Django pagedown 我感觉是个不错的选择。 simplemde 有一个 django simplemde 的 app ,但我使用中发现一个 bug ,移动端无法输入汉字,查了下相关的 issue ,发现至今没有解决。所以弃用了。
    ansheng
        6
    ansheng  
    OP
       Dec 25, 2016
    @chuanqirenwu 我在后台用的就是这个,只不过把默认的编辑器换成`simplemde `的了,前段其他插件渲染
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   859 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 22:09 · PVG 06:09 · LAX 15:09 · JFK 18:09
    ♥ Do have faith in what you're doing.