开始使用
使用pip install pillowmd
如何使用
先使用style = pillowmd.LoadMarkdownStyles(style路径),然后使用style.Render(markdown内容)即可快速渲染。若没有style,则可以pillowmd.MdToImage(内容)使用默认风格渲染
注:MdToImage是异步函数,若想使用默认风格进行同步渲染,请使用:
import pillowmd
style = pillowmd.MdStyle()
style.Render("# Is Markdown")
自定义style
见docs目录下的how_to……,里面有进一步指南,也可以进入Q群498427849
使用例
见tests目录
元素支持
markdown元素
| 元素 | 样例 | 是否支持 | 备注 |
|---|---|---|---|
| 标题 | # 标题 | ✅️ | 仅支持1~3级标题 |
| 引用 | > 123 | ✅️ | |
| 无序列表 | * 123 * 123 |
✅️ | |
| 有序列表 | 1. 123 2. 123 |
✅️ | |
| 行中代码 | 这是`行中代码` | ✅️ | 不支持高亮 |
| 行中表达式 | 这是$行中表达式$ | ✅️ | 支持latex,且支持latex拆分换行,详见pillowlatex |
| 表格 | |这是|表格| |-|-| |1|2| |
✅️ | 表格中仅支持普通文本,且不支持自定义对其方式。会自动换行 |
| 代码块 | ```python print("hello world") ``` |
✅️ | 不支持高亮 |
| 行间表达式 | && \frac{1}{2} && |
✅️ | 支持latex,且支持latex拆分换行,详见pillowlatex |
| HTML | <br> | ❎️ | 暂不支持 |
额外元素
| 元素 | 样例 | 备注 |
|---|---|---|
| 自定义颜色 | <color=#FF0000> | 强制更改颜色,填入#xxxxxx格式的颜色,填入None则为取消强制更改 |
| 快捷图片 | !sgm[图片名] !sgm[图片名|比例] !sgm[图片名|x比例,y比例] |
需要设置快捷图片路径,可在渲染时取消使用该元素 |
| 自定义元素 | !sgexter[元素名,参数……] !sgexter[card,"title","content",800,400,"图片.jpg"] |
可在渲染时取消使用该元素 |
渲染差异
当仅有一个\n时,也会换行
图片预览
元素预览
分页+侧边图渲染
新版本LaTeX支持
Style下载
其他
欢迎各位分享你自己的style风格,联系QQ614675349,或者直接在GitHub上提交PR
更新日志
0.7.0
新增行间latex支持,优化readme,现在引用一级的线会被渲染出来了
0.6.0
新增latex支持,详见pillowlatex
0.5.3
修复了表格渲染会错误的在前后加上行间距的问题 增加了表格的debug显示
Metadata
Release files for pillowmd 0.7.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pillowmd-0.7.3.tar.gz | 20.0 MB | Without provenance | Details for pillowmd-0.7.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pillowmd-0.7.3-py3-none-any.whl | Python 3 | none | any | Details for pillowmd-0.7.3-py3-none-any.whl |
Total release size: 40.1 MB
Release files / pillowmd-0.7.3.tar.gz
| Download URL | pillowmd-0.7.3.tar.gz |
|---|---|
| Size | 20.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4be5c16768c5dad643b897784a097fd038059514cd5abdd005150e057559edd8
|
|
BLAKE2b-256 checksum How to use checksums |
9ee8869d3bf879e84c2e88d7e0f8a21ab31221cc0f29ff77b3e52cd2a2828d14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.4
|
Release files / pillowmd-0.7.3-py3-none-any.whl
| Download URL | pillowmd-0.7.3-py3-none-any.whl |
|---|---|
| Size | 20.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13fe0200905f159919cdb05052e0e4d54b806db7c0e96a99e479ba8a3b6f6bfc
|
|
BLAKE2b-256 checksum How to use checksums |
c9be7860ebfdbbb32b9454814569c62b9f5cfc5a8ba88e415eea65840d6a9b45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.4
|
Security for pillowmd 0.7.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.