Skip to main content

可以在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

flask_markdown_to_html-0.1.2.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file flask_markdown_to_html-0.1.2.tar.gz.

File metadata

File hashes

Hashes for flask_markdown_to_html-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2c5a97b14ce3413e6fcfe815461818fc3031e530e0c1304807a7d8c8fb7baaf5
MD5 e02a23faedce6d972df73b33cc2a83f7
BLAKE2b-256 e411ff10771d3dbd6a764a4016e3ac6068e3edd7abd0a0cb9324fc92db0a1d1f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page