可以在flask中查看markdown代码
Project description
1.导入方法
pip install flask-markdown
from flask import Flask
from flask-markdown import flask_markdown
app=Flask(__name__)
app.config["markdown_path"]="./markdown"
md=flask_markdown(app)
2.函数使用
确保目录结构为以下结构
app.py
markdown 为config中的路径
2.1 markdown_to_html
使用方法
{{ md.markdown_to_html("markdown代码") }}
确保你已经导入本库
2.2 render_markdown
使用方法
@app.route("/")
def index():
return render_markdown("在markdown_path路径下的文件.md")
确保你的markdown_path无误
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file flask_markdown_to_html-0.1.1.tar.gz
.
File metadata
- Download URL: flask_markdown_to_html-0.1.1.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb870c43fe85f6910c6aefa38e0d261a75fa0bef03d73f61c9a492dd7b85d2c3 |
|
MD5 | cd92bd39fb933dde18aa98c558af381a |
|
BLAKE2b-256 | 1c867fe725d5057ca19aea070e62ebe8aa8cd79f1f2482605d950fb322abee70 |