Snyp是一个命令行实用程序,它简化了在Markdown中创建基于文本的文档和编程教程的过程。

snyp的Python项目详细描述


Snyp公司

Snyp是一个命令行实用程序,它简化了在Markdown中创建基于文本的文档和编程教程的过程。在

Snyp从源文件中提取指定的代码段,对其进行格式化以在Github风格的Markdown中启用语法高亮显示,并在其前缀添加一个注释,精确地指定代码段从何处提取,即:

```python
# snippet from example.py lines 1-2
print('Hey there!')
print('This is an example')
```

将呈现如下:

^{pr2}$

安装:

pip install snyp

用法:snyp --help

Usage: snyp.py [OPTIONS][LINES]...

  Use this tool to extract code snippets from a source file (src) and append
  them to a markdown file (dest)  with proper Github Flavored Markdown
  formatting.

  You can use 0, 1 or 2'lines' arguments:

  With 0 arguments, the entire source file will be extracted

  With 1 argument, the entire source file starting at lines[0] will be
  extracted

  With 2 arguments, lines lines[0] to lines[1](inclusively) will be
  extracted from the source file

  Use snip --config to view and update the configuration

Options:
  -s, --src TEXT   The source file from which to extract the code snippet
  -d, --dest TEXT  The destination file to which to append the formatted
                   snippet. "-"for stdout
  -l, --lang TEXT  The language specific formatting to be applied to the code
                   snippet
  -c, --config     Edit the configuration, i.e. to change defaults, add
                   languages, etc.
  --help           Show this message and exit.

配置snyp --config

上面的命令将在默认编辑器中打开Snyp的配置文件。这是查看和更新配置的最简单方法。在

节[默认值]

# snippet from snyp.ini lines 1-5 [default]default=pythonsrc=snyp.pydest=README.md
  • default:未提供-l,--lang时要使用的默认语言配置文件
  • src:如果未提供-s,--src,则默认源文件的相对路径
  • dest:如果未提供-d,--dest,则默认目标文件的相对路径

语言部分:[python]等

# snippet from snyp.ini lines 16-19 [html]lang=htmlcommentStart=<!--commentEnd=-->
  • 语言的名称。用于确定语法突出显示的前缀
  • commentStart:注释如何在lang中开始
  • commentEnd(可选):注释如何以lang

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

推荐PyPI第三方库


热门话题
java如何将cassandra中的行数据转换为与列相关的嵌套json   java如何使用jcr XPath在jcr:content/@jcr:data中搜索?   java在使用openCV进行安卓开发时如何利用手机的广角镜头   java解析扩展了接口,结束了一个潜在的无限循环   位置服务的@Override方法中存在java Android应用程序错误   java本地线程的用途和需求是什么   具有左右子访问的java节点树遍历   java验证JsonWebToken签名   JUL日志处理程序中的java日志记录   嵌入式Java读取给定时间段的串行数据。   java有没有办法从多个URL获取多个图像?   java线程通过等待intent阻止自己发送intent   java Spring MVC解析多部分内容请求   java JPA/Hibernate静态元模型属性未填充NullPointerException   java格式错误的字符(需要引号,得到I)~正在处理   java为什么PrintWriter对象抛出FileNotFoundException?   java Neo4j未正确保存标签   java IE不加载图像