*非常简单的标记格式

dumbdown的Python项目详细描述


CircleCI

简化

极为简化的准标记到HTML解析,在JavaScript和Python中都有。

安装

要安装python包:

pip install dumbdown

要安装npm包:

npm install dumbdown

演示

要查看演示:克隆此repo,请从package.json安装节点模块,然后在您喜爱的浏览器中打开demo.html。尝试键入一些带有*和\字符的文本。

用法

它允许3种格式标记,bolditalic和>;块引号,但它使用slack的语法而不是标记语法。

粗体文本必须有*环绕:

For example, *this would be bold*.

斜体文本周围有_

And _this would be in italics_.

粗体和斜体可以相互嵌套:

*bold _bold-italics_*, _italics with some *bold* inside_. *_Nice!_*.

块引号是以>

开头的行。
> this is a blockquote
> woo

python api

python版本提供了两个函数:to_htmlto_plain

>>>fromdumbdownimportto_html,to_plain>>>to_html("*This is bold _this is bold ital._*\nThis is on a new line")'<p><strong>This is bold <i>this is bold ital.</i></strong></p><p>This is on a new line</p>'>>>to_plain("*This is bold _this is bold ital._*\nThis is on a new line")'This is bold this is bold ital. This is on a new line'

javascript api

javascript版本提供了两个函数:toHtmltoPlain

>>>import{toHtml,toPlain}from"dumbdown";>>>toHtml("*This is bold _this is bold ital._*\nThis is on a new line");'<p><strong>This is bold <i>this is bold ital.</i></strong></p><p>This is on a new line</p>'>>>toPlain("*This is bold _this is bold ital._*\nThis is on a new line")'This is bold this is bold ital. This is on a new line'

测试

测试:

Python

pytest

javascript

yarn run test

释放

python/pypi

建造

python setup.py sdist bdist_wheel

释放

twine upload dist/*

javascript/npm

建造

yarn run build

释放

npm publish

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
virtualbox无法从java移动共享文件夹中的文件   java如何连接Android 4.3.5(GA)的apache HttpClient库?   片段中的java Recyclerview未立即显示警报对话框结果   javac(n,r)计算器程序不工作   java使用BooleanQuery还是编写更多索引?   如何在java中设置y/n循环?   java不兼容的通用通配符捕获   java如何在安卓xml中编写数据绑定时的三元操作条件   java如何使用FileDialog?   java如何创建单元测试来检测是否有人使用错误的编码编辑了文件?   java如何从唯一的字符串生成唯一的int?   java gradletomcatplugin:log4j:WARN找不到记录器的附加程序   java我的动态编程解决方案(Kefa和第一步)在codeforces中有什么问题?   java每天更新两个数据库,使它们都包含相同的有效数据集   java如何检查给定的时间是否在时间限制之间   java在单个json POST上保存父级和子级   java如何获取Solr字段类型