可以在flask中查看markdown代码
Project description
1.导入方法
pip install flask-markdown
from flask import Flask
from flask_markdown_to_html import flask_markdown_to_html
app=Flask(__name__)
md=flask_markdown_to_html(app)
2.函数使用
确保目录结构为以下结构
app.py
static 为存放markdown的路径
markdown 为存放markdown的路径
2.1 markdown_to_html
使用方法
{{ md.markdown_to_html("markdown代码") }}
确保你已经导入本库
2.2 render_markdown
使用方法
@app.route("/")
def index():
return render_markdown("在static/markdown/路径下的文件.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.3.tar.gz
.
File metadata
- Download URL: flask_markdown_to_html-0.1.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8aac0acfc670708449b8d8234a300710639f2fb166fc11e3919e097194edeab9 |
|
MD5 | bd2775686a95b4f1a40b7e9a86e0ad0c |
|
BLAKE2b-256 | 8b236f8059970ddcc730a8d5693286a8a43cedaebcd5ec9def77d80d49ecef77 |