flask-markdown-to-html库用法

# 1.导入方法

```cmd
pip install flask-markdown-to-html
```

```python
    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

使用方法 

```html
    {{ md.markdown_to_html("markdown代码") }}
```
_确保你已经导入本库_

## 2.2 render_markdown

使用方法

```python
    @app.route("/")
    def index():
        return render_markdown("在static/markdown路径下的文件.md")
```
 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值