# Choices are: "semantic", "bootstrap"MARTOR_THEME='bootstrap'# Global martor settings# Input: string boolean, `true/false`MARTOR_ENABLE_CONFIGS= {
'emoji': 'true', # to enable/disable emoji icons.'imgur': 'true', # to enable/disable imgur/custom uploader.'mention': 'false', # to enable/disable mention'jquery': 'true', # to include/revoke jquery (require for admin default django)'living': 'false', # to enable/disable live updates in preview'spellcheck': 'false', # to enable/disable spellcheck in form textareas'hljs': 'true', # to enable/disable hljs highlighting in preview
}
# To show the toolbar buttonsMARTOR_TOOLBAR_BUTTONS= [
'bold', 'italic', 'horizontal', 'heading', 'pre-code',
'blockquote', 'unordered-list', 'ordered-list',
'link', 'image-link', 'image-upload', 'emoji',
'direct-mention', 'toggle-maximize', 'help'
]
# To setup the martor editor with title label or not (default is False)MARTOR_ENABLE_LABEL=False# Imgur API KeysMARTOR_IMGUR_CLIENT_ID='your-client-id'MARTOR_IMGUR_API_KEY='your-api-key'# MarkdownifyMARTOR_MARKDOWNIFY_FUNCTION='martor.utils.markdownify'# defaultMARTOR_MARKDOWNIFY_URL='/martor/markdownify/'# default# Markdown extensions (default)MARTOR_MARKDOWN_EXTENSIONS= [
'markdown.extensions.extra',
'markdown.extensions.nl2br',
'markdown.extensions.smarty',
'markdown.extensions.fenced_code',
# Custom markdown extensions.'martor.extensions.urlize',
'martor.extensions.del_ins', # ~~strikethrough~~ and ++underscores++'martor.extensions.mention', # to parse markdown mention'martor.extensions.emoji', # to parse markdown emoji'martor.extensions.mdx_video', # to parse embed/iframe video'martor.extensions.escape_html', # to handle the XSS vulnerabilities
]
# Markdown Extensions ConfigsMARTOR_MARKDOWN_EXTENSION_CONFIGS= {}
# Markdown urlsMARTOR_UPLOAD_URL='/martor/uploader/'# defaultMARTOR_SEARCH_USERS_URL='/martor/search-user/'# default# Markdown Extensions# MARTOR_MARKDOWN_BASE_EMOJI_URL = 'https://www.webfx.com/tools/emoji-cheat-sheet/graphics/emojis/' # from webfxMARTOR_MARKDOWN_BASE_EMOJI_URL='https://github.githubassets.com/images/icons/emoji/'# default from githubMARTOR_MARKDOWN_BASE_MENTION_URL='https://python.web.id/author/'# please change this to your domain# If you need to use your own themed "bootstrap" or "semantic ui" dependency# replace the values with the file in your static files dirMARTOR_ALTERNATIVE_JS_FILE_THEME="semantic-themed/semantic.min.js"# default NoneMARTOR_ALTERNATIVE_CSS_FILE_THEME="semantic-themed/semantic.min.css"# default NoneMARTOR_ALTERNATIVE_JQUERY_JS_FILE="jquery/dist/jquery.min.js"# default None# URL schemes that are allowed within linksALLOWED_URL_SCHEMES= [
"file", "ftp", "ftps", "http", "https", "irc", "mailto",
"sftp", "ssh", "tel", "telnet", "tftp", "vnc", "xmpp",
]
Check this setting is not set else csrf will not be sent over ajax calls:
Don't miss to include the required css & js files before use.
You can take a look at this folder martor_demo/app/templates for more details.
The below example is a one of the way to implement it when you choose the MARTOR_THEME = 'bootstrap':
请发表评论