Blackfriday
[![Build Status][BuildSVG]][BuildURL]
[![Godoc][GodocV2SVG]][GodocV2URL]
===========
Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It
is paranoid about its input (so you can safely feed it user-supplied
data), it is fast, it supports common extensions (tables, smart
punctuation substitutions, etc.), and it is safe for all utf-8
(unicode) input.
HTML output is currently supported, along with Smartypants
extensions.
It started as a translation from C of [Sundown][3].
Installation
------------
Blackfriday is compatible with any modern Go release. With Go and git installed:
go get -u gopkg.in/russross/blackfriday.v2
will download, compile, and install the package into your `$GOPATH` directory
hierarchy.
Versions
--------
Currently maintained and recommended version of Blackfriday is `v2`. It's being
developed on its own branch: https://github.com/russross/blackfriday/tree/v2 and the
documentation is available at
https://godoc.org/gopkg.in/russross/blackfriday.v2.
It is `go get`-able via [gopkg.in][6] at `gopkg.in/russross/blackfriday.v2`,
but we highly recommend using package management tool like [dep][7] or
[Glide][8] and make use of semantic versioning. With package management you
should import `github.com/russross/blackfriday` and specify that you're using
version 2.0.0.
Version 2 offers a number of improvements over v1:
* Cleaned up API
* A separate call to [`Parse`][4], which produces an abstract syntax tree for
the document
* Latest bug fixes
* Flexibility to easily add your own rendering extensions
Potential drawbacks:
* Our benchmarks show v2 to be slightly slower than v1. Currently in the
ballpark of around 15%.
* API breakage. If you can't afford modifying your code to adhere to the new API
and don't care too much about the new features, v2 is probably not for you.
* Several bug fixes are trailing behind and still need to be forward-ported to
v2. See issue [#348](https://github.com/russross/blackfriday/issues/348) for
tracking.
If you are still interested in the legacy `v1`, you can import it from
`github.com/russross/blackfriday`. Documentation for the legacy v1 can be found
here: https://godoc.org/github.com/russross/blackfriday
### Known issue with `dep`
There is a known problem with using Blackfriday v1 _transitively_ and `dep`.
Currently `dep` prioritizes semver versions over anything else, and picks the
latest one, plus it does not apply a `[[constraint]]` specifier to transitively
pulled in packages. So if you're using something that uses Blackfriday v1, but
that something does not use `dep` yet, you will get Blackfriday v2 pulled in and
your first dependency will fail to build.
There are couple of fixes for it, documented here:
https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-constrain-a-transitive-dependencys-version
Meanwhile, `dep` team is working on a more general solution to the constraints
on transitive dependencies problem: https://github.com/golang/dep/issues/1124.
Usage
-----
### v1
For basic usage, it is as simple as getting your input into a byte
slice and calling:
output := blackfriday.MarkdownBasic(input)
This renders it with no extensions enabled. To get a more useful
feature set, use this instead:
output := blackfriday.MarkdownCommon(input)
### v2
For the most sensible markdown processing, it is as simple as getting your input
into a byte slice and calling:
```go
output := blackfriday.Run(input)
```
Your input will be parsed and the output rendered with a set of most popular
extensions enabled. If you want the most basic feature set, corresponding with
the bare Markdown specification, use:
```go
output := blackfriday.Run(input, blackfriday.WithNoExtensions())
```
### Sanitize untrusted content
Blackfriday itself does nothing to protect against malicious content. If you are
dealing with user-supplied markdown, we recommend running Blackfriday's output
through HTML sanitizer such as [Bluemonday][5].
Here's an example of simple usage of Blackfriday together with Bluemonday:
```go
import (
"github.com/microcosm-cc/bluemonday"
"gopkg.in/russross/blackfriday.v2"
)
// ...
unsafe := blackfriday.Run(input)
html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
```
### Custom options, v1
If you want to customize the set of options, first get a renderer
(currently only the HTML output engine), then use it to
call the more general `Markdown` function. For examples, see the
implementations of `MarkdownBasic` and `MarkdownCommon` in
`markdown.go`.
### Custom options, v2
If you want to customize the set of options, use `blackfriday.WithExtensions`,
`blackfriday.WithRenderer` and `blackfriday.WithRefOverride`.
### `blackfriday-tool`
You can also check out `blackfriday-tool` for a more complete example
of how to use it. Download and install it using:
go get github.com/russross/blackfriday-tool
This is a simple command-line tool that allows you to process a
markdown file using a standalone program. You can also browse the
source directly on github if you are just looking for some example
code:
* <http://github.com/russross/blackfriday-tool>
Note that if you have not already done so, installing
`blackfriday-tool` will be sufficient to download and install
blackfriday in addition to the tool itself. The tool binary will be
installed in `$GOPATH/bin`. This is a statically-linked binary that
can be copied to wherever you need it without worrying about
dependencies and library versions.
### Sanitized anchor names
Blackfriday includes an algorithm for creating sanitized anchor names
corresponding to a given input text. This algorithm is used to create
anchors for headings when `EXTENSION_AUTO_HEADER_IDS` is enabled. The
algorithm has a specification, so that other packages can create
compatible anchor names and links to those anchors.
The specification is located at https://godoc.org/github.com/russross/blackfriday#hdr-Sanitized_Anchor_Names.
[`SanitizedAnchorName`](https://godoc.org/github.com/russross/blackfriday#SanitizedAnchorName) exposes this functionality, and can be used to
create compatible links to the anchor names generated by blackfriday.
This algorithm is also implemented in a small standalone package at
[`github.com/shurcooL/sanitized_anchor_name`](https://godoc.org/github.com/shurcooL/sanitized_anchor_name). It can be useful for clients
that want a small package and don't need full functionality of blackfriday.
Features
--------
All features of Sundown are supported, including:
* **Compatibility**. The Markdown v1.0.3 test suite passes with
the `--tidy` option. Without `--tidy`, the differences are
mostly in whitespace and entity escaping, where blackfriday is
more consistent and cleaner.
* **Common extensions**, including table support, fenced code
blocks, autolinks, strikethroughs, non-strict emphasis, etc.
* **Safety**. Blackfriday is paranoid when parsing, making it safe
to feed untrusted user input without fear of bad things
happening. The test suite stress tests this and there are no
known inputs that make it crash. If you find one, please let me
know and send me the input that does it.
NOTE: "safety" in this context means *runtime safety only*. In order to
protect yourself against JavaScript injection in untrusted content, see
[this example](https://github.com/russross/blackfriday#sanitize-untrusted-content).
* **Fast processing**. It is fast enough to render on-demand in
most web applications without having to cache the output.
* **Thread safety**. You can run multiple parsers in different
goroutines without ill effect. There is no dependence on global
shared state.
* **Minimal dependencies**. Blackfriday only depends on standard
library packages in Go. The source code is pretty
self-contained, so it is easy to add to any project, including
Google App Engine projects.
* **Standards compliant**. Outpu
没有合适的资源?快使用搜索试试~ 我知道了~
conmon-2.1.7.zip
共106个文件
go:22个
h:17个
c:16个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 168 浏览量
2023-08-20
18:54:05
上传
评论
收藏 190KB ZIP 举报
温馨提示
conmon-2.1.7.zip,An OCI container runtime monitor. Conmon is a monitoring program and communication tool between a container manager (like Podman or CRI-O) and an OCI runtime (like runc or crun) for a single container. Upon being launched, conmon (usually) double-forks to daemonize and detach from the parent that launched it. It then launches the runtime as its child. This allows managing processes to die in the foreground, but still be able to watch over......
资源推荐
资源详情
资源评论
收起资源包目录
conmon-2.1.7.zip (106个子文件)
meson.build 3KB
conn_sock.c 18KB
ctr_logging.c 18KB
conmon.c 17KB
cli.c 9KB
cgroup.c 9KB
seccomp_notify.c 8KB
ctrl.c 8KB
ctr_exit.c 6KB
ctr_stdio.c 4KB
cmsg.c 4KB
runtime_args.c 4KB
utils.c 3KB
close_fds.c 2KB
parent_pipe_fd.c 2KB
oom.c 549B
globals.c 446B
.clang-format 3KB
Containerfile 486B
Dockerfile 260B
.dir-locals.el 101B
github-actions-setup 3KB
.gitignore 458B
.gitignore 46B
.gitignore 14B
block.go 30KB
markdown.go 24KB
html.go 23KB
inline.go 23KB
smartypants.go 11KB
conmon_test.go 10KB
latex.go 8KB
roff.go 6KB
suite_test.go 4KB
options.go 4KB
pipes.go 4KB
ctr_logs_test.go 3KB
conmon.go 3KB
runtime_test.go 3KB
doc.go 2KB
md2man.go 900B
conmon-config.go 677B
config.go 653B
md2man.go 612B
tools.go 162B
config_windows.go 92B
config_unix.go 91B
utils.h 6KB
seccomp_notify_plugin.h 2KB
conn_sock.h 2KB
cli.h 1KB
cmsg.h 1010B
ctr_exit.h 999B
seccomp_notify.h 820B
globals.h 610B
ctr_logging.h 497B
ctrl.h 462B
config.h 290B
cgroup.h 286B
ctr_stdio.h 248B
parent_pipe_fd.h 217B
runtime_args.h 159B
oom.h 106B
close_fds.h 65B
conmon.spec.in 1KB
nixpkgs.json 347B
kubernetes-e2e 3KB
LICENSE 11KB
Makefile 5KB
Makefile 954B
Makefile 617B
Makefile 443B
Makefile 351B
README.md 13KB
README.md 4KB
conmon.8.md 3KB
LICENSE.md 1KB
go-md2man.1.md 662B
README.md 451B
SECURITY.md 235B
CODE-OF-CONDUCT.md 187B
go.mod 6KB
go.mod 110B
go.mod 94B
go.mod 39B
default-arm64.nix 1KB
default.nix 767B
derivation.nix 673B
static.nix 238B
nixpkgs.nix 236B
get_ci_vm.sh 2KB
prepare.sh 583B
tree_status.sh 358B
seccomp-notify.sh 220B
go.sum 123KB
go.sum 360B
go.sum 181B
changelog.txt 3KB
LICENSE.txt 1KB
modules.txt 192B
共 106 条
- 1
- 2
资源评论
YunFeiDong
- 粉丝: 172
- 资源: 4034
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 使用 JavaScript 进行 YOLOv8 推理.zip
- 使用 Google Open Images V4 数据集进行数据准备和训练 PJReddie 的 YOLOv3 检测自定义对象的端到端教程 包括从 OIv4 下载特定类的说明,以及用于准备数据.zip
- 使用 Go 进行 YOLOv8 推理.zip
- j基于目标检测的yolov1原始论文
- 使用 darknet-ros (YOLOv3) 的跟踪器 ROS 节点(排序和深度排序).zip
- 使用 Darknet Weights 在 Keras 上运行 YOLO.zip
- 51单片机学习笔记(矩阵键盘-时钟)
- 使用 C# 训练 Yolo.zip
- 使用 BOSCH 小型交通灯数据集训练 YOLOv3 检测交通灯的教程 .zip
- 使用 Apple 的 CoreML 和 YOLO v1 进行近乎实时的物体检测 -.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功