pax_global_header00006660000000000000000000000064146365521110014516gustar00rootroot0000000000000052 comment=15ade8aace9a9f269846fb83d36fc7bcec875cd5 goldmark-1.7.4/000077500000000000000000000000001463655211100133275ustar00rootroot00000000000000goldmark-1.7.4/.github/000077500000000000000000000000001463655211100146675ustar00rootroot00000000000000goldmark-1.7.4/.github/ISSUE_TEMPLATE.md000066400000000000000000000024221463655211100173740ustar00rootroot00000000000000goldmark has [https://github.com/yuin/goldmark/discussions](Discussions) in github. You should post only issues here. Feature requests and questions should be posted at discussions. - [ ] goldmark is fully compliant with the CommonMark. Before submitting issue, you **must** read [CommonMark spec](https://spec.commonmark.org/0.29/) and confirm your output is different from [CommonMark online demo](https://spec.commonmark.org/dingus/). - [ ] **Extensions(Autolink without `<` `>`, Table, etc) are not part of CommonMark spec.** You should confirm your output is different from other official renderers correspond with an extension. - [ ] **goldmark is not dedicated for Hugo**. If you are Hugo user and your issue was raised by your experience in Hugo, **you should consider create issue at Hugo repository at first** . Please answer the following before submitting your issue: 1. What version of goldmark are you using? : 2. What version of Go are you using? : 3. What operating system and processor architecture are you using? : 4. What did you do? : 5. What did you expect to see? : 6. What did you see instead? : 7. Did you confirm your output is different from [CommonMark online demo](https://spec.commonmark.org/dingus/) or other official renderer correspond with an extension?: goldmark-1.7.4/.github/workflows/000077500000000000000000000000001463655211100167245ustar00rootroot00000000000000goldmark-1.7.4/.github/workflows/stale.yaml000066400000000000000000000020401463655211100207140ustar00rootroot00000000000000name: Close inactive issues on: schedule: - cron: "30 9 * * *" jobs: close-issues: runs-on: ubuntu-latest permissions: issues: write pull-requests: write steps: - uses: actions/stale@v5 with: days-before-issue-stale: 30 days-before-issue-close: 14 stale-issue-label: "stale" stale-issue-message: "This issue is stale because it has been open for 30 days with no activity." close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." exempt-issue-labels: "pinned,security" days-before-pr-stale: 180 days-before-pr-close: 14 stale-pr-label: "stale" stale-pr-message: "This PR is stale because it has been open for 180 days with no activity." close-pr-message: "This PR was closed because it has been inactive for 14 days since being marked as stale." exempt-pr-labels: "pinned,security" repo-token: ${{ secrets.GITHUB_TOKEN }} goldmark-1.7.4/.github/workflows/test.yaml000066400000000000000000000020571463655211100205730ustar00rootroot00000000000000on: [push, pull_request] name: test jobs: test: strategy: fail-fast: false matrix: go-version: [1.21.x, 1.22.x] platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: - name: Install Go uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} - name: Checkout code uses: actions/checkout@v3 - name: Run lints uses: golangci/golangci-lint-action@v6 with: version: latest if: "matrix.platform == 'ubuntu-latest'" # gofmt linter fails on Windows for CRLF problems - name: Run tests env: GOLDMARK_TEST_TIMEOUT_MULTIPLIER: 5 run: go test -v ./... -covermode=count -coverprofile=coverage.out -coverpkg=./... - name: Install goveralls run: go install github.com/mattn/goveralls@latest - name: Send coverage if: "matrix.platform == 'ubuntu-latest'" env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: goveralls -coverprofile=coverage.out -service=github goldmark-1.7.4/.gitignore000066400000000000000000000004221463655211100153150ustar00rootroot00000000000000# Binaries for programs and plugins *.exe *.exe~ *.dll *.so *.dylib # Test binary, build with `go test -c` *.test *.pprof # Output of the go coverage tool, specifically when used with LiteIDE *.out .DS_Store fuzz/corpus fuzz/crashers fuzz/suppressions fuzz/fuzz-fuzz.zip goldmark-1.7.4/.golangci.yml000066400000000000000000000044051463655211100157160ustar00rootroot00000000000000run: deadline: 10m issues: exclude-use-default: false exclude-rules: - path: _test.go linters: - errcheck - lll exclude: - "Package util" linters: disable-all: true enable: - errcheck - gosimple - govet - ineffassign - staticcheck - typecheck - unused - gofmt - godot - makezero - misspell - revive - wastedassign - lll linters-settings: revive: severity: "warning" confidence: 0.8 rules: - name: blank-imports severity: warning disabled: false - name: context-as-argument severity: warning disabled: false - name: context-keys-type severity: warning disabled: false - name: dot-imports severity: warning disabled: true - name: error-return severity: warning disabled: false - name: error-strings severity: warning disabled: false - name: error-naming severity: warning disabled: false - name: exported severity: warning disabled: false - name: increment-decrement severity: warning disabled: false - name: var-naming severity: warning disabled: false - name: var-declaration severity: warning disabled: false - name: package-comments severity: warning disabled: false - name: range severity: warning disabled: false - name: receiver-naming severity: warning disabled: false - name: time-naming severity: warning disabled: false - name: unexported-return severity: warning disabled: false - name: indent-error-flow severity: warning disabled: false - name: errorf severity: warning disabled: false - name: empty-block severity: warning disabled: true - name: superfluous-else severity: warning disabled: false - name: unused-parameter severity: warning disabled: true - name: unreachable-code severity: warning disabled: false - name: redefines-builtin-id severity: warning disabled: false goldmark-1.7.4/LICENSE000066400000000000000000000020571463655211100143400ustar00rootroot00000000000000MIT License Copyright (c) 2019 Yusuke Inuzuka Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. goldmark-1.7.4/Makefile000066400000000000000000000007731463655211100147760ustar00rootroot00000000000000.PHONY: test fuzz lint lint: golangci-lint run -c .golangci.yml ./... test: go test -coverprofile=profile.out -coverpkg=github.com/yuin/goldmark,github.com/yuin/goldmark/ast,github.com/yuin/goldmark/extension,github.com/yuin/goldmark/extension/ast,github.com/yuin/goldmark/parser,github.com/yuin/goldmark/renderer,github.com/yuin/goldmark/renderer/html,github.com/yuin/goldmark/text,github.com/yuin/goldmark/util ./... cov: test go tool cover -html=profile.out fuzz: cd ./fuzz && go test -fuzz=Fuzz goldmark-1.7.4/README.md000066400000000000000000000601151463655211100146110ustar00rootroot00000000000000goldmark ========================================== [![https://pkg.go.dev/github.com/yuin/goldmark](https://pkg.go.dev/badge/github.com/yuin/goldmark.svg)](https://pkg.go.dev/github.com/yuin/goldmark) [![https://github.com/yuin/goldmark/actions?query=workflow:test](https://github.com/yuin/goldmark/workflows/test/badge.svg?branch=master&event=push)](https://github.com/yuin/goldmark/actions?query=workflow:test) [![https://coveralls.io/github/yuin/goldmark](https://coveralls.io/repos/github/yuin/goldmark/badge.svg?branch=master)](https://coveralls.io/github/yuin/goldmark) [![https://goreportcard.com/report/github.com/yuin/goldmark](https://goreportcard.com/badge/github.com/yuin/goldmark)](https://goreportcard.com/report/github.com/yuin/goldmark) > A Markdown parser written in Go. Easy to extend, standards-compliant, well-structured. goldmark is compliant with CommonMark 0.31.2. - [goldmark playground](https://yuin.github.io/goldmark/playground/) : Try goldmark online. This playground is built with WASM(5-10MB). Motivation ---------------------- I needed a Markdown parser for Go that satisfies the following requirements: - Easy to extend. - Markdown is poor in document expressions compared to other light markup languages such as reStructuredText. - We have extensions to the Markdown syntax, e.g. PHP Markdown Extra, GitHub Flavored Markdown. - Standards-compliant. - Markdown has many dialects. - GitHub-Flavored Markdown is widely used and is based upon CommonMark, effectively mooting the question of whether or not CommonMark is an ideal specification. - CommonMark is complicated and hard to implement. - Well-structured. - AST-based; preserves source position of nodes. - Written in pure Go. [golang-commonmark](https://gitlab.com/golang-commonmark/markdown) may be a good choice, but it seems to be a copy of [markdown-it](https://github.com/markdown-it). [blackfriday.v2](https://github.com/russross/blackfriday/tree/v2) is a fast and widely-used implementation, but is not CommonMark-compliant and cannot be extended from outside of the package, since its AST uses structs instead of interfaces. Furthermore, its behavior differs from other implementations in some cases, especially regarding lists: [Deep nested lists don't output correctly #329](https://github.com/russross/blackfriday/issues/329), [List block cannot have a second line #244](https://github.com/russross/blackfriday/issues/244), etc. This behavior sometimes causes problems. If you migrate your Markdown text from GitHub to blackfriday-based wikis, many lists will immediately be broken. As mentioned above, CommonMark is complicated and hard to implement, so Markdown parsers based on CommonMark are few and far between. Features ---------------------- - **Standards-compliant.** goldmark is fully compliant with the latest [CommonMark](https://commonmark.org/) specification. - **Extensible.** Do you want to add a `@username` mention syntax to Markdown? You can easily do so in goldmark. You can add your AST nodes, parsers for block-level elements, parsers for inline-level elements, transformers for paragraphs, transformers for the whole AST structure, and renderers. - **Performance.** goldmark's performance is on par with that of cmark, the CommonMark reference implementation written in C. - **Robust.** goldmark is tested with `go test --fuzz`. - **Built-in extensions.** goldmark ships with common extensions like tables, strikethrough, task lists, and definition lists. - **Depends only on standard libraries.** Installation ---------------------- ```bash $ go get github.com/yuin/goldmark ``` Usage ---------------------- Import packages: ```go import ( "bytes" "github.com/yuin/goldmark" ) ``` Convert Markdown documents with the CommonMark-compliant mode: ```go var buf bytes.Buffer if err := goldmark.Convert(source, &buf); err != nil { panic(err) } ``` With options ------------------------------ ```go var buf bytes.Buffer if err := goldmark.Convert(source, &buf, parser.WithContext(ctx)); err != nil { panic(err) } ``` | Functional option | Type | Description | | ----------------- | ---- | ----------- | | `parser.WithContext` | A `parser.Context` | Context for the parsing phase. | Context options ---------------------- | Functional option | Type | Description | | ----------------- | ---- | ----------- | | `parser.WithIDs` | A `parser.IDs` | `IDs` allows you to change logics that are related to element id(ex: Auto heading id generation). | Custom parser and renderer -------------------------- ```go import ( "bytes" "github.com/yuin/goldmark" "github.com/yuin/goldmark/extension" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer/html" ) md := goldmark.New( goldmark.WithExtensions(extension.GFM), goldmark.WithParserOptions( parser.WithAutoHeadingID(), ), goldmark.WithRendererOptions( html.WithHardWraps(), html.WithXHTML(), ), ) var buf bytes.Buffer if err := md.Convert(source, &buf); err != nil { panic(err) } ``` | Functional option | Type | Description | | ----------------- | ---- | ----------- | | `goldmark.WithParser` | `parser.Parser` | This option must be passed before `goldmark.WithParserOptions` and `goldmark.WithExtensions` | | `goldmark.WithRenderer` | `renderer.Renderer` | This option must be passed before `goldmark.WithRendererOptions` and `goldmark.WithExtensions` | | `goldmark.WithParserOptions` | `...parser.Option` | | | `goldmark.WithRendererOptions` | `...renderer.Option` | | | `goldmark.WithExtensions` | `...goldmark.Extender` | | Parser and Renderer options ------------------------------ ### Parser options | Functional option | Type | Description | | ----------------- | ---- | ----------- | | `parser.WithBlockParsers` | A `util.PrioritizedSlice` whose elements are `parser.BlockParser` | Parsers for parsing block level elements. | | `parser.WithInlineParsers` | A `util.PrioritizedSlice` whose elements are `parser.InlineParser` | Parsers for parsing inline level elements. | | `parser.WithParagraphTransformers` | A `util.PrioritizedSlice` whose elements are `parser.ParagraphTransformer` | Transformers for transforming paragraph nodes. | | `parser.WithASTTransformers` | A `util.PrioritizedSlice` whose elements are `parser.ASTTransformer` | Transformers for transforming an AST. | | `parser.WithAutoHeadingID` | `-` | Enables auto heading ids. | | `parser.WithAttribute` | `-` | Enables custom attributes. Currently only headings supports attributes. | ### HTML Renderer options | Functional option | Type | Description | | ----------------- | ---- | ----------- | | `html.WithWriter` | `html.Writer` | `html.Writer` for writing contents to an `io.Writer`. | | `html.WithHardWraps` | `-` | Render newlines as `
`.| | `html.WithXHTML` | `-` | Render as XHTML. | | `html.WithUnsafe` | `-` | By default, goldmark does not render raw HTML or potentially dangerous links. With this option, goldmark renders such content as written. | ### Built-in extensions - `extension.Table` - [GitHub Flavored Markdown: Tables](https://github.github.com/gfm/#tables-extension-) - `extension.Strikethrough` - [GitHub Flavored Markdown: Strikethrough](https://github.github.com/gfm/#strikethrough-extension-) - `extension.Linkify` - [GitHub Flavored Markdown: Autolinks](https://github.github.com/gfm/#autolinks-extension-) - `extension.TaskList` - [GitHub Flavored Markdown: Task list items](https://github.github.com/gfm/#task-list-items-extension-) - `extension.GFM` - This extension enables Table, Strikethrough, Linkify and TaskList. - This extension does not filter tags defined in [6.11: Disallowed Raw HTML (extension)](https://github.github.com/gfm/#disallowed-raw-html-extension-). If you need to filter HTML tags, see [Security](#security). - If you need to parse github emojis, you can use [goldmark-emoji](https://github.com/yuin/goldmark-emoji) extension. - `extension.DefinitionList` - [PHP Markdown Extra: Definition lists](https://michelf.ca/projects/php-markdown/extra/#def-list) - `extension.Footnote` - [PHP Markdown Extra: Footnotes](https://michelf.ca/projects/php-markdown/extra/#footnotes) - `extension.Typographer` - This extension substitutes punctuations with typographic entities like [smartypants](https://daringfireball.net/projects/smartypants/). - `extension.CJK` - This extension is a shortcut for CJK related functionalities. ### Attributes The `parser.WithAttribute` option allows you to define attributes on some elements. Currently only headings support attributes. **Attributes are being discussed in the [CommonMark forum](https://talk.commonmark.org/t/consistent-attribute-syntax/272). This syntax may possibly change in the future.** #### Headings ``` ## heading ## {#id .className attrName=attrValue class="class1 class2"} ## heading {#id .className attrName=attrValue class="class1 class2"} ``` ``` heading {#id .className attrName=attrValue} ============ ``` ### Table extension The Table extension implements [Table(extension)](https://github.github.com/gfm/#tables-extension-), as defined in [GitHub Flavored Markdown Spec](https://github.github.com/gfm/). Specs are defined for XHTML, so specs use some deprecated attributes for HTML5. You can override alignment rendering method via options. | Functional option | Type | Description | | ----------------- | ---- | ----------- | | `extension.WithTableCellAlignMethod` | `extension.TableCellAlignMethod` | Option indicates how are table cells aligned. | ### Typographer extension The Typographer extension translates plain ASCII punctuation characters into typographic-punctuation HTML entities. Default substitutions are: | Punctuation | Default entity | | ------------ | ---------- | | `'` | `‘`, `’` | | `"` | `“`, `”` | | `--` | `–` | | `---` | `—` | | `...` | `…` | | `<<` | `«` | | `>>` | `»` | You can override the default substitutions via `extensions.WithTypographicSubstitutions`: ```go markdown := goldmark.New( goldmark.WithExtensions( extension.NewTypographer( extension.WithTypographicSubstitutions(extension.TypographicSubstitutions{ extension.LeftSingleQuote: []byte("‚"), extension.RightSingleQuote: nil, // nil disables a substitution }), ), ), ) ``` ### Linkify extension The Linkify extension implements [Autolinks(extension)](https://github.github.com/gfm/#autolinks-extension-), as defined in [GitHub Flavored Markdown Spec](https://github.github.com/gfm/). Since the spec does not define details about URLs, there are numerous ambiguous cases. You can override autolinking patterns via options. | Functional option | Type | Description | | ----------------- | ---- | ----------- | | `extension.WithLinkifyAllowedProtocols` | `[][]byte \| []string` | List of allowed protocols such as `[]string{ "http:" }` | | `extension.WithLinkifyURLRegexp` | `*regexp.Regexp` | Regexp that defines URLs, including protocols | | `extension.WithLinkifyWWWRegexp` | `*regexp.Regexp` | Regexp that defines URL starting with `www.`. This pattern corresponds to [the extended www autolink](https://github.github.com/gfm/#extended-www-autolink) | | `extension.WithLinkifyEmailRegexp` | `*regexp.Regexp` | Regexp that defines email addresses` | Example, using [xurls](https://github.com/mvdan/xurls): ```go import "mvdan.cc/xurls/v2" markdown := goldmark.New( goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( extension.NewLinkify( extension.WithLinkifyAllowedProtocols([]string{ "http:", "https:", }), extension.WithLinkifyURLRegexp( xurls.Strict(), ), ), ), ) ``` ### Footnotes extension The Footnote extension implements [PHP Markdown Extra: Footnotes](https://michelf.ca/projects/php-markdown/extra/#footnotes). This extension has some options: | Functional option | Type | Description | | ----------------- | ---- | ----------- | | `extension.WithFootnoteIDPrefix` | `[]byte \| string` | a prefix for the id attributes.| | `extension.WithFootnoteIDPrefixFunction` | `func(gast.Node) []byte` | a function that determines the id attribute for given Node.| | `extension.WithFootnoteLinkTitle` | `[]byte \| string` | an optional title attribute for footnote links.| | `extension.WithFootnoteBacklinkTitle` | `[]byte \| string` | an optional title attribute for footnote backlinks. | | `extension.WithFootnoteLinkClass` | `[]byte \| string` | a class for footnote links. This defaults to `footnote-ref`. | | `extension.WithFootnoteBacklinkClass` | `[]byte \| string` | a class for footnote backlinks. This defaults to `footnote-backref`. | | `extension.WithFootnoteBacklinkHTML` | `[]byte \| string` | a class for footnote backlinks. This defaults to `↩︎`. | Some options can have special substitutions. Occurrences of “^^” in the string will be replaced by the corresponding footnote number in the HTML output. Occurrences of “%%” will be replaced by a number for the reference (footnotes can have multiple references). `extension.WithFootnoteIDPrefix` and `extension.WithFootnoteIDPrefixFunction` are useful if you have multiple Markdown documents displayed inside one HTML document to avoid footnote ids to clash each other. `extension.WithFootnoteIDPrefix` sets fixed id prefix, so you may write codes like the following: ```go for _, path := range files { source := readAll(path) prefix := getPrefix(path) markdown := goldmark.New( goldmark.WithExtensions( NewFootnote( WithFootnoteIDPrefix(path), ), ), ) var b bytes.Buffer err := markdown.Convert(source, &b) if err != nil { t.Error(err.Error()) } } ``` `extension.WithFootnoteIDPrefixFunction` determines an id prefix by calling given function, so you may write codes like the following: ```go markdown := goldmark.New( goldmark.WithExtensions( NewFootnote( WithFootnoteIDPrefixFunction(func(n gast.Node) []byte { v, ok := n.OwnerDocument().Meta()["footnote-prefix"] if ok { return util.StringToReadOnlyBytes(v.(string)) } return nil }), ), ), ) for _, path := range files { source := readAll(path) var b bytes.Buffer doc := markdown.Parser().Parse(text.NewReader(source)) doc.Meta()["footnote-prefix"] = getPrefix(path) err := markdown.Renderer().Render(&b, source, doc) } ``` You can use [goldmark-meta](https://github.com/yuin/goldmark-meta) to define a id prefix in the markdown document: ```markdown --- title: document title slug: article1 footnote-prefix: article1 --- # My article ``` ### CJK extension CommonMark gives compatibilities a high priority and original markdown was designed by westerners. So CommonMark lacks considerations for languages like CJK. This extension provides additional options for CJK users. | Functional option | Type | Description | | ----------------- | ---- | ----------- | | `extension.WithEastAsianLineBreaks` | `...extension.EastAsianLineBreaksStyle` | Soft line breaks are rendered as a newline. Some asian users will see it as an unnecessary space. With this option, soft line breaks between east asian wide characters will be ignored. This defaults to `EastAsianLineBreaksStyleSimple`. | | `extension.WithEscapedSpace` | `-` | Without spaces around an emphasis started with east asian punctuations, it is not interpreted as an emphasis(as defined in CommonMark spec). With this option, you can avoid this inconvenient behavior by putting 'not rendered' spaces around an emphasis like `太郎は\ **「こんにちわ」**\ といった`. | #### Styles of Line Breaking | Style | Description | | ----- | ----------- | | `EastAsianLineBreaksStyleSimple` | Soft line breaks are ignored if both sides of the break are east asian wide character. This behavior is the same as [`east_asian_line_breaks`](https://pandoc.org/MANUAL.html#extension-east_asian_line_breaks) in Pandoc. | | `EastAsianLineBreaksCSS3Draft` | This option implements CSS text level3 [Segment Break Transformation Rules](https://drafts.csswg.org/css-text-3/#line-break-transform) with [some enhancements](https://github.com/w3c/csswg-drafts/issues/5086). | #### Example of `EastAsianLineBreaksStyleSimple` Input Markdown: ```md 私はプログラマーです。 東京の会社に勤めています。 GoでWebアプリケーションを開発しています。 ``` Output: ```html

私はプログラマーです。東京の会社に勤めています。\nGoでWebアプリケーションを開発しています。

``` #### Example of `EastAsianLineBreaksCSS3Draft` Input Markdown: ```md 私はプログラマーです。 東京の会社に勤めています。 GoでWebアプリケーションを開発しています。 ``` Output: ```html

私はプログラマーです。東京の会社に勤めています。GoでWebアプリケーションを開発しています。

``` Security -------------------- By default, goldmark does not render raw HTML or potentially-dangerous URLs. If you need to gain more control over untrusted contents, it is recommended that you use an HTML sanitizer such as [bluemonday](https://github.com/microcosm-cc/bluemonday). Benchmark -------------------- You can run this benchmark in the `_benchmark` directory. ### against other golang libraries blackfriday v2 seems to be the fastest, but as it is not CommonMark compliant, its performance cannot be directly compared to that of the CommonMark-compliant libraries. goldmark, meanwhile, builds a clean, extensible AST structure, achieves full compliance with CommonMark, and consumes less memory, all while being reasonably fast. - MBP 2019 13″(i5, 16GB), Go1.17 ``` BenchmarkMarkdown/Blackfriday-v2-8 302 3743747 ns/op 3290445 B/op 20050 allocs/op BenchmarkMarkdown/GoldMark-8 280 4200974 ns/op 2559738 B/op 13435 allocs/op BenchmarkMarkdown/CommonMark-8 226 5283686 ns/op 2702490 B/op 20792 allocs/op BenchmarkMarkdown/Lute-8 12 92652857 ns/op 10602649 B/op 40555 allocs/op BenchmarkMarkdown/GoMarkdown-8 13 81380167 ns/op 2245002 B/op 22889 allocs/op ``` ### against cmark (CommonMark reference implementation written in C) - MBP 2019 13″(i5, 16GB), Go1.17 ``` ----------- cmark ----------- file: _data.md iteration: 50 average: 0.0044073057 sec ------- goldmark ------- file: _data.md iteration: 50 average: 0.0041611990 sec ``` As you can see, goldmark's performance is on par with cmark's. Extensions -------------------- ### List of extensions - [goldmark-meta](https://github.com/yuin/goldmark-meta): A YAML metadata extension for the goldmark Markdown parser. - [goldmark-highlighting](https://github.com/yuin/goldmark-highlighting): A syntax-highlighting extension for the goldmark markdown parser. - [goldmark-emoji](https://github.com/yuin/goldmark-emoji): An emoji extension for the goldmark Markdown parser. - [goldmark-mathjax](https://github.com/litao91/goldmark-mathjax): Mathjax support for the goldmark markdown parser - [goldmark-pdf](https://github.com/stephenafamo/goldmark-pdf): A PDF renderer that can be passed to `goldmark.WithRenderer()`. - [goldmark-hashtag](https://github.com/abhinav/goldmark-hashtag): Adds support for `#hashtag`-based tagging to goldmark. - [goldmark-wikilink](https://github.com/abhinav/goldmark-wikilink): Adds support for `[[wiki]]`-style links to goldmark. - [goldmark-anchor](https://github.com/abhinav/goldmark-anchor): Adds anchors (permalinks) next to all headers in a document. - [goldmark-figure](https://github.com/mangoumbrella/goldmark-figure): Adds support for rendering paragraphs starting with an image to `
` elements. - [goldmark-frontmatter](https://github.com/abhinav/goldmark-frontmatter): Adds support for YAML, TOML, and custom front matter to documents. - [goldmark-toc](https://github.com/abhinav/goldmark-toc): Adds support for generating tables-of-contents for goldmark documents. - [goldmark-mermaid](https://github.com/abhinav/goldmark-mermaid): Adds support for rendering [Mermaid](https://mermaid-js.github.io/mermaid/) diagrams in goldmark documents. - [goldmark-pikchr](https://github.com/jchenry/goldmark-pikchr): Adds support for rendering [Pikchr](https://pikchr.org/home/doc/trunk/homepage.md) diagrams in goldmark documents. - [goldmark-embed](https://github.com/13rac1/goldmark-embed): Adds support for rendering embeds from YouTube links. - [goldmark-latex](https://github.com/soypat/goldmark-latex): A $\LaTeX$ renderer that can be passed to `goldmark.WithRenderer()`. - [goldmark-fences](https://github.com/stefanfritsch/goldmark-fences): Support for pandoc-style [fenced divs](https://pandoc.org/MANUAL.html#divs-and-spans) in goldmark. - [goldmark-d2](https://github.com/FurqanSoftware/goldmark-d2): Adds support for [D2](https://d2lang.com/) diagrams. - [goldmark-katex](https://github.com/FurqanSoftware/goldmark-katex): Adds support for [KaTeX](https://katex.org/) math and equations. - [goldmark-img64](https://github.com/tenkoh/goldmark-img64): Adds support for embedding images into the document as DataURL (base64 encoded). - [goldmark-enclave](https://github.com/quail-ink/goldmark-enclave): Adds support for embedding youtube/bilibili video, X's [oembed tweet](https://publish.twitter.com/), [tradingview](https://www.tradingview.com/widget/)'s chart, [quail](https://quail.ink)'s widget into the document. - [goldmark-wiki-table](https://github.com/movsb/goldmark-wiki-table): Adds support for embedding Wiki Tables. - [goldmark-tgmd](https://github.com/Mad-Pixels/goldmark-tgmd): A Telegram markdown renderer that can be passed to `goldmark.WithRenderer()`. ### Loading extensions at runtime [goldmark-dynamic](https://github.com/yuin/goldmark-dynamic) allows you to write a goldmark extension in Lua and load it at runtime without re-compilation. Please refer to [goldmark-dynamic](https://github.com/yuin/goldmark-dynamic) for details. goldmark internal(for extension developers) ---------------------------------------------- ### Overview goldmark's Markdown processing is outlined in the diagram below. ``` | V +-------- parser.Parser --------------------------- | 1. Parse block elements into AST | 1. If a parsed block is a paragraph, apply | ast.ParagraphTransformer | 2. Traverse AST and parse blocks. | 1. Process delimiters(emphasis) at the end of | block parsing | 3. Apply parser.ASTTransformers to AST | V | V +------- renderer.Renderer ------------------------ | 1. Traverse AST and apply renderer.NodeRenderer | corespond to the node type | V ``` ### Parsing Markdown documents are read through `text.Reader` interface. AST nodes do not have concrete text. AST nodes have segment information of the documents, represented by `text.Segment` . `text.Segment` has 3 attributes: `Start`, `End`, `Padding` . (TBC) **TODO** See `extension` directory for examples of extensions. Summary: 1. Define AST Node as a struct in which `ast.BaseBlock` or `ast.BaseInline` is embedded. 2. Write a parser that implements `parser.BlockParser` or `parser.InlineParser`. 3. Write a renderer that implements `renderer.NodeRenderer`. 4. Define your goldmark extension that implements `goldmark.Extender`. Donation -------------------- BTC: 1NEDSyUmo4SMTDP83JJQSWi1MvQUGGNMZB License -------------------- MIT Author -------------------- Yusuke Inuzuka goldmark-1.7.4/_benchmark/000077500000000000000000000000001463655211100154205ustar00rootroot00000000000000goldmark-1.7.4/_benchmark/cmark/000077500000000000000000000000001463655211100165155ustar00rootroot00000000000000goldmark-1.7.4/_benchmark/cmark/.gitignore000066400000000000000000000000351463655211100205030ustar00rootroot00000000000000cmark-master cmark_benchmark goldmark-1.7.4/_benchmark/cmark/Makefile000066400000000000000000000025331463655211100201600ustar00rootroot00000000000000CMARK_BIN=cmark_benchmark CMARK_RUN=LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./cmark-master/build/src ./$(CMARK_BIN) ifeq ($(OS),Windows_NT) CMARK_BIN=cmark_benchmark.exe CMARK_RUN=bash -c "PATH=./cmark-master/build/src:$${PATH} ./$(CMARK_BIN)" endif ifneq ($(WSL_INTEROP),) CMARK_BIN=cmark_benchmark.exe CMARK_RUN=cp ./cmark-master/build-mingw/windows/bin/libcmark.dll . && ./$(CMARK_BIN); rm -f libcmark.dll endif .PHONY: run run: $(CMARK_BIN) @ $(CMARK_RUN) @ if [ -z "$${WSL_INTEROP}" ]; then \ go run ./goldmark_benchmark.go; \ else \ GOOS=windows GOARCH=amd64 go build -o goldmark_benchmark.exe ./goldmark_benchmark.go && ./goldmark_benchmark.exe; \ fi ./cmark-master/Makefile: wget -nc -O cmark.zip https://github.com/commonmark/cmark/archive/master.zip unzip cmark.zip rm -f cmark.zip @ if [ -z "$${WSL_INTEROP}" ]; then \ cd cmark-master && make; \ else \ cd cmark-master && make mingw; \ fi $(CMARK_BIN): ./cmark-master/Makefile @ if [ -z "$${WSL_INTEROP}" ]; then \ gcc -I./cmark-master/build/src -I./cmark-master/src cmark_benchmark.c -o $(CMARK_BIN) -L./cmark-master/build/src -lcmark; \ else \ i686-w64-mingw32-gcc -I./cmark-master/build-mingw/windows/include cmark_benchmark.c -o $(CMARK_BIN) -L./cmark-master/build-mingw/windows/lib -lcmark.dll; \ fi .PHONY: clean clean: rm -f $(CMARK_BIN) rm -f goldmark_benchmark.exe goldmark-1.7.4/_benchmark/cmark/_data.md000066400000000000000000006136461463655211100201270ustar00rootroot00000000000000# Introduction ## What is Markdown? Markdown is a plain text format for writing structured documents, based on conventions for indicating formatting in email and usenet posts. It was developed by John Gruber (with help from Aaron Swartz) and released in 2004 in the form of a [syntax description](http://daringfireball.net/projects/markdown/syntax) and a Perl script (`Markdown.pl`) for converting Markdown to HTML. In the next decade, dozens of implementations were developed in many languages. Some extended the original Markdown syntax with conventions for footnotes, tables, and other document elements. Some allowed Markdown documents to be rendered in formats other than HTML. Websites like Reddit, StackOverflow, and GitHub had millions of people using Markdown. And Markdown started to be used beyond the web, to author books, articles, slide shows, letters, and lecture notes. What distinguishes Markdown from many other lightweight markup syntaxes, which are often easier to write, is its readability. As Gruber writes: > The overriding design goal for Markdown's formatting syntax is > to make it as readable as possible. The idea is that a > Markdown-formatted document should be publishable as-is, as > plain text, without looking like it's been marked up with tags > or formatting instructions. > () The point can be illustrated by comparing a sample of [AsciiDoc](http://www.methods.co.nz/asciidoc/) with an equivalent sample of Markdown. Here is a sample of AsciiDoc from the AsciiDoc manual: ``` 1. List item one. + List item one continued with a second paragraph followed by an Indented block. + ................. $ ls *.sh $ mv *.sh ~/tmp ................. + List item continued with a third paragraph. 2. List item two continued with an open block. + -- This paragraph is part of the preceding list item. a. This list is nested and does not require explicit item continuation. + This paragraph is part of the preceding list item. b. List item b. This paragraph belongs to item two of the outer list. -- ``` And here is the equivalent in Markdown: ``` 1. List item one. List item one continued with a second paragraph followed by an Indented block. $ ls *.sh $ mv *.sh ~/tmp List item continued with a third paragraph. 2. List item two continued with an open block. This paragraph is part of the preceding list item. 1. This list is nested and does not require explicit item continuation. This paragraph is part of the preceding list item. 2. List item b. This paragraph belongs to item two of the outer list. ``` The AsciiDoc version is, arguably, easier to write. You don't need to worry about indentation. But the Markdown version is much easier to read. The nesting of list items is apparent to the eye in the source, not just in the processed document. ## Why is a spec needed? John Gruber's [canonical description of Markdown's syntax](http://daringfireball.net/projects/markdown/syntax) does not specify the syntax unambiguously. Here are some examples of questions it does not answer: 1. How much indentation is needed for a sublist? The spec says that continuation paragraphs need to be indented four spaces, but is not fully explicit about sublists. It is natural to think that they, too, must be indented four spaces, but `Markdown.pl` does not require that. This is hardly a "corner case," and divergences between implementations on this issue often lead to surprises for users in real documents. (See [this comment by John Gruber](http://article.gmane.org/gmane.text.markdown.general/1997).) 2. Is a blank line needed before a block quote or heading? Most implementations do not require the blank line. However, this can lead to unexpected results in hard-wrapped text, and also to ambiguities in parsing (note that some implementations put the heading inside the blockquote, while others do not). (John Gruber has also spoken [in favor of requiring the blank lines](http://article.gmane.org/gmane.text.markdown.general/2146).) 3. Is a blank line needed before an indented code block? (`Markdown.pl` requires it, but this is not mentioned in the documentation, and some implementations do not require it.) ``` markdown paragraph code? ``` 4. What is the exact rule for determining when list items get wrapped in `

` tags? Can a list be partially "loose" and partially "tight"? What should we do with a list like this? ``` markdown 1. one 2. two 3. three ``` Or this? ``` markdown 1. one - a - b 2. two ``` (There are some relevant comments by John Gruber [here](http://article.gmane.org/gmane.text.markdown.general/2554).) 5. Can list markers be indented? Can ordered list markers be right-aligned? ``` markdown 8. item 1 9. item 2 10. item 2a ``` 6. Is this one list with a thematic break in its second item, or two lists separated by a thematic break? ``` markdown * a * * * * * * b ``` 7. When list markers change from numbers to bullets, do we have two lists or one? (The Markdown syntax description suggests two, but the perl scripts and many other implementations produce one.) ``` markdown 1. fee 2. fie - foe - fum ``` 8. What are the precedence rules for the markers of inline structure? For example, is the following a valid link, or does the code span take precedence ? ``` markdown [a backtick (`)](/url) and [another backtick (`)](/url). ``` 9. What are the precedence rules for markers of emphasis and strong emphasis? For example, how should the following be parsed? ``` markdown *foo *bar* baz* ``` 10. What are the precedence rules between block-level and inline-level structure? For example, how should the following be parsed? ``` markdown - `a long code span can contain a hyphen like this - and it can screw things up` ``` 11. Can list items include section headings? (`Markdown.pl` does not allow this, but does allow blockquotes to include headings.) ``` markdown - # Heading ``` 12. Can list items be empty? ``` markdown * a * * b ``` 13. Can link references be defined inside block quotes or list items? ``` markdown > Blockquote [foo]. > > [foo]: /url ``` 14. If there are multiple definitions for the same reference, which takes precedence? ``` markdown [foo]: /url1 [foo]: /url2 [foo][] ``` In the absence of a spec, early implementers consulted `Markdown.pl` to resolve these ambiguities. But `Markdown.pl` was quite buggy, and gave manifestly bad results in many cases, so it was not a satisfactory replacement for a spec. Because there is no unambiguous spec, implementations have diverged considerably. As a result, users are often surprised to find that a document that renders one way on one system (say, a GitHub wiki) renders differently on another (say, converting to docbook using pandoc). To make matters worse, because nothing in Markdown counts as a "syntax error," the divergence often isn't discovered right away. ## About this document This document attempts to specify Markdown syntax unambiguously. It contains many examples with side-by-side Markdown and HTML. These are intended to double as conformance tests. An accompanying script `spec_tests.py` can be used to run the tests against any Markdown program: python test/spec_tests.py --spec spec.txt --program PROGRAM Since this document describes how Markdown is to be parsed into an abstract syntax tree, it would have made sense to use an abstract representation of the syntax tree instead of HTML. But HTML is capable of representing the structural distinctions we need to make, and the choice of HTML for the tests makes it possible to run the tests against an implementation without writing an abstract syntax tree renderer. This document is generated from a text file, `spec.txt`, written in Markdown with a small extension for the side-by-side tests. The script `tools/makespec.py` can be used to convert `spec.txt` into HTML or CommonMark (which can then be converted into other formats). In the examples, the `→` character is used to represent tabs. # Preliminaries ## Characters and lines Any sequence of [characters] is a valid CommonMark document. A [character](@) is a Unicode code point. Although some code points (for example, combining accents) do not correspond to characters in an intuitive sense, all code points count as characters for purposes of this spec. This spec does not specify an encoding; it thinks of lines as composed of [characters] rather than bytes. A conforming parser may be limited to a certain encoding. A [line](@) is a sequence of zero or more [characters] other than newline (`U+000A`) or carriage return (`U+000D`), followed by a [line ending] or by the end of file. A [line ending](@) is a newline (`U+000A`), a carriage return (`U+000D`) not followed by a newline, or a carriage return and a following newline. A line containing no characters, or a line containing only spaces (`U+0020`) or tabs (`U+0009`), is called a [blank line](@). The following definitions of character classes will be used in this spec: A [whitespace character](@) is a space (`U+0020`), tab (`U+0009`), newline (`U+000A`), line tabulation (`U+000B`), form feed (`U+000C`), or carriage return (`U+000D`). [Whitespace](@) is a sequence of one or more [whitespace characters]. A [Unicode whitespace character](@) is any code point in the Unicode `Zs` general category, or a tab (`U+0009`), carriage return (`U+000D`), newline (`U+000A`), or form feed (`U+000C`). [Unicode whitespace](@) is a sequence of one or more [Unicode whitespace characters]. A [space](@) is `U+0020`. A [non-whitespace character](@) is any character that is not a [whitespace character]. An [ASCII punctuation character](@) is `!`, `"`, `#`, `$`, `%`, `&`, `'`, `(`, `)`, `*`, `+`, `,`, `-`, `.`, `/` (U+0021–2F), `:`, `;`, `<`, `=`, `>`, `?`, `@` (U+003A–0040), `[`, `\`, `]`, `^`, `_`, `` ` `` (U+005B–0060), `{`, `|`, `}`, or `~` (U+007B–007E). A [punctuation character](@) is an [ASCII punctuation character] or anything in the general Unicode categories `Pc`, `Pd`, `Pe`, `Pf`, `Pi`, `Po`, or `Ps`. ## Tabs Tabs in lines are not expanded to [spaces]. However, in contexts where whitespace helps to define block structure, tabs behave as if they were replaced by spaces with a tab stop of 4 characters. Thus, for example, a tab can be used instead of four spaces in an indented code block. (Note, however, that internal tabs are passed through as literal tabs, not expanded to spaces.) ```````````````````````````````` example →foo→baz→→bim .

foo→baz→→bim
```````````````````````````````` ```````````````````````````````` example →foo→baz→→bim .
foo→baz→→bim
```````````````````````````````` ```````````````````````````````` example a→a ὐ→a .
a→a
ὐ→a
```````````````````````````````` In the following example, a continuation paragraph of a list item is indented with a tab; this has exactly the same effect as indentation with four spaces would: ```````````````````````````````` example - foo →bar .
  • foo

    bar

```````````````````````````````` ```````````````````````````````` example - foo →→bar .
  • foo

      bar
    
```````````````````````````````` Normally the `>` that begins a block quote may be followed optionally by a space, which is not considered part of the content. In the following case `>` is followed by a tab, which is treated as if it were expanded into three spaces. Since one of these spaces is considered part of the delimiter, `foo` is considered to be indented six spaces inside the block quote context, so we get an indented code block starting with two spaces. ```````````````````````````````` example >→→foo .
  foo
```````````````````````````````` ```````````````````````````````` example -→→foo .
  •   foo
    
```````````````````````````````` ```````````````````````````````` example foo →bar .
foo
bar
```````````````````````````````` ```````````````````````````````` example - foo - bar → - baz .
  • foo
    • bar
      • baz
```````````````````````````````` ```````````````````````````````` example #→Foo .

Foo

```````````````````````````````` ```````````````````````````````` example *→*→*→ .
```````````````````````````````` ## Insecure characters For security reasons, the Unicode character `U+0000` must be replaced with the REPLACEMENT CHARACTER (`U+FFFD`). # Blocks and inlines We can think of a document as a sequence of [blocks](@)---structural elements like paragraphs, block quotations, lists, headings, rules, and code blocks. Some blocks (like block quotes and list items) contain other blocks; others (like headings and paragraphs) contain [inline](@) content---text, links, emphasized text, images, code spans, and so on. ## Precedence Indicators of block structure always take precedence over indicators of inline structure. So, for example, the following is a list with two items, not a list with one item containing a code span: ```````````````````````````````` example - `one - two` .
  • `one
  • two`
```````````````````````````````` This means that parsing can proceed in two steps: first, the block structure of the document can be discerned; second, text lines inside paragraphs, headings, and other block constructs can be parsed for inline structure. The second step requires information about link reference definitions that will be available only at the end of the first step. Note that the first step requires processing lines in sequence, but the second can be parallelized, since the inline parsing of one block element does not affect the inline parsing of any other. ## Container blocks and leaf blocks We can divide blocks into two types: [container blocks](@), which can contain other blocks, and [leaf blocks](@), which cannot. # Leaf blocks This section describes the different kinds of leaf block that make up a Markdown document. ## Thematic breaks A line consisting of 0-3 spaces of indentation, followed by a sequence of three or more matching `-`, `_`, or `*` characters, each followed optionally by any number of spaces or tabs, forms a [thematic break](@). ```````````````````````````````` example *** --- ___ .


```````````````````````````````` Wrong characters: ```````````````````````````````` example +++ .

+++

```````````````````````````````` ```````````````````````````````` example === .

===

```````````````````````````````` Not enough characters: ```````````````````````````````` example -- ** __ .

-- ** __

```````````````````````````````` One to three spaces indent are allowed: ```````````````````````````````` example *** *** *** .


```````````````````````````````` Four spaces is too many: ```````````````````````````````` example *** .
***
```````````````````````````````` ```````````````````````````````` example Foo *** .

Foo ***

```````````````````````````````` More than three characters may be used: ```````````````````````````````` example _____________________________________ .
```````````````````````````````` Spaces are allowed between the characters: ```````````````````````````````` example - - - .
```````````````````````````````` ```````````````````````````````` example ** * ** * ** * ** .
```````````````````````````````` ```````````````````````````````` example - - - - .
```````````````````````````````` Spaces are allowed at the end: ```````````````````````````````` example - - - - .
```````````````````````````````` However, no other characters may occur in the line: ```````````````````````````````` example _ _ _ _ a a------ ---a--- .

_ _ _ _ a

a------

---a---

```````````````````````````````` It is required that all of the [non-whitespace characters] be the same. So, this is not a thematic break: ```````````````````````````````` example *-* .

-

```````````````````````````````` Thematic breaks do not need blank lines before or after: ```````````````````````````````` example - foo *** - bar .
  • foo

  • bar
```````````````````````````````` Thematic breaks can interrupt a paragraph: ```````````````````````````````` example Foo *** bar .

Foo


bar

```````````````````````````````` If a line of dashes that meets the above conditions for being a thematic break could also be interpreted as the underline of a [setext heading], the interpretation as a [setext heading] takes precedence. Thus, for example, this is a setext heading, not a paragraph followed by a thematic break: ```````````````````````````````` example Foo --- bar .

Foo

bar

```````````````````````````````` When both a thematic break and a list item are possible interpretations of a line, the thematic break takes precedence: ```````````````````````````````` example * Foo * * * * Bar .
  • Foo

  • Bar
```````````````````````````````` If you want a thematic break in a list item, use a different bullet: ```````````````````````````````` example - Foo - * * * .
  • Foo

```````````````````````````````` ## ATX headings An [ATX heading](@) consists of a string of characters, parsed as inline content, between an opening sequence of 1--6 unescaped `#` characters and an optional closing sequence of any number of unescaped `#` characters. The opening sequence of `#` characters must be followed by a [space] or by the end of line. The optional closing sequence of `#`s must be preceded by a [space] and may be followed by spaces only. The opening `#` character may be indented 0-3 spaces. The raw contents of the heading are stripped of leading and trailing spaces before being parsed as inline content. The heading level is equal to the number of `#` characters in the opening sequence. Simple headings: ```````````````````````````````` example # foo ## foo ### foo #### foo ##### foo ###### foo .

foo

foo

foo

foo

foo
foo
```````````````````````````````` More than six `#` characters is not a heading: ```````````````````````````````` example ####### foo .

####### foo

```````````````````````````````` At least one space is required between the `#` characters and the heading's contents, unless the heading is empty. Note that many implementations currently do not require the space. However, the space was required by the [original ATX implementation](http://www.aaronsw.com/2002/atx/atx.py), and it helps prevent things like the following from being parsed as headings: ```````````````````````````````` example #5 bolt #hashtag .

#5 bolt

#hashtag

```````````````````````````````` This is not a heading, because the first `#` is escaped: ```````````````````````````````` example \## foo .

## foo

```````````````````````````````` Contents are parsed as inlines: ```````````````````````````````` example # foo *bar* \*baz\* .

foo bar *baz*

```````````````````````````````` Leading and trailing [whitespace] is ignored in parsing inline content: ```````````````````````````````` example # foo .

foo

```````````````````````````````` One to three spaces indentation are allowed: ```````````````````````````````` example ### foo ## foo # foo .

foo

foo

foo

```````````````````````````````` Four spaces are too much: ```````````````````````````````` example # foo .
# foo
```````````````````````````````` ```````````````````````````````` example foo # bar .

foo # bar

```````````````````````````````` A closing sequence of `#` characters is optional: ```````````````````````````````` example ## foo ## ### bar ### .

foo

bar

```````````````````````````````` It need not be the same length as the opening sequence: ```````````````````````````````` example # foo ################################## ##### foo ## .

foo

foo
```````````````````````````````` Spaces are allowed after the closing sequence: ```````````````````````````````` example ### foo ### .

foo

```````````````````````````````` A sequence of `#` characters with anything but [spaces] following it is not a closing sequence, but counts as part of the contents of the heading: ```````````````````````````````` example ### foo ### b .

foo ### b

```````````````````````````````` The closing sequence must be preceded by a space: ```````````````````````````````` example # foo# .

foo#

```````````````````````````````` Backslash-escaped `#` characters do not count as part of the closing sequence: ```````````````````````````````` example ### foo \### ## foo #\## # foo \# .

foo ###

foo ###

foo #

```````````````````````````````` ATX headings need not be separated from surrounding content by blank lines, and they can interrupt paragraphs: ```````````````````````````````` example **** ## foo **** .

foo


```````````````````````````````` ```````````````````````````````` example Foo bar # baz Bar foo .

Foo bar

baz

Bar foo

```````````````````````````````` ATX headings can be empty: ```````````````````````````````` example ## # ### ### .

```````````````````````````````` ## Setext headings A [setext heading](@) consists of one or more lines of text, each containing at least one [non-whitespace character], with no more than 3 spaces indentation, followed by a [setext heading underline]. The lines of text must be such that, were they not followed by the setext heading underline, they would be interpreted as a paragraph: they cannot be interpretable as a [code fence], [ATX heading][ATX headings], [block quote][block quotes], [thematic break][thematic breaks], [list item][list items], or [HTML block][HTML blocks]. A [setext heading underline](@) is a sequence of `=` characters or a sequence of `-` characters, with no more than 3 spaces indentation and any number of trailing spaces. If a line containing a single `-` can be interpreted as an empty [list items], it should be interpreted this way and not as a [setext heading underline]. The heading is a level 1 heading if `=` characters are used in the [setext heading underline], and a level 2 heading if `-` characters are used. The contents of the heading are the result of parsing the preceding lines of text as CommonMark inline content. In general, a setext heading need not be preceded or followed by a blank line. However, it cannot interrupt a paragraph, so when a setext heading comes after a paragraph, a blank line is needed between them. Simple examples: ```````````````````````````````` example Foo *bar* ========= Foo *bar* --------- .

Foo bar

Foo bar

```````````````````````````````` The content of the header may span more than one line: ```````````````````````````````` example Foo *bar baz* ==== .

Foo bar baz

```````````````````````````````` The contents are the result of parsing the headings's raw content as inlines. The heading's raw content is formed by concatenating the lines and removing initial and final [whitespace]. ```````````````````````````````` example Foo *bar baz*→ ==== .

Foo bar baz

```````````````````````````````` The underlining can be any length: ```````````````````````````````` example Foo ------------------------- Foo = .

Foo

Foo

```````````````````````````````` The heading content can be indented up to three spaces, and need not line up with the underlining: ```````````````````````````````` example Foo --- Foo ----- Foo === .

Foo

Foo

Foo

```````````````````````````````` Four spaces indent is too much: ```````````````````````````````` example Foo --- Foo --- .
Foo
---

Foo

```````````````````````````````` The setext heading underline can be indented up to three spaces, and may have trailing spaces: ```````````````````````````````` example Foo ---- .

Foo

```````````````````````````````` Four spaces is too much: ```````````````````````````````` example Foo --- .

Foo ---

```````````````````````````````` The setext heading underline cannot contain internal spaces: ```````````````````````````````` example Foo = = Foo --- - .

Foo = =

Foo


```````````````````````````````` Trailing spaces in the content line do not cause a line break: ```````````````````````````````` example Foo ----- .

Foo

```````````````````````````````` Nor does a backslash at the end: ```````````````````````````````` example Foo\ ---- .

Foo\

```````````````````````````````` Since indicators of block structure take precedence over indicators of inline structure, the following are setext headings: ```````````````````````````````` example `Foo ---- ` .

`Foo

`

<a title="a lot

of dashes"/>

```````````````````````````````` The setext heading underline cannot be a [lazy continuation line] in a list item or block quote: ```````````````````````````````` example > Foo --- .

Foo


```````````````````````````````` ```````````````````````````````` example > foo bar === .

foo bar ===

```````````````````````````````` ```````````````````````````````` example - Foo --- .
  • Foo

```````````````````````````````` A blank line is needed between a paragraph and a following setext heading, since otherwise the paragraph becomes part of the heading's content: ```````````````````````````````` example Foo Bar --- .

Foo Bar

```````````````````````````````` But in general a blank line is not required before or after setext headings: ```````````````````````````````` example --- Foo --- Bar --- Baz .

Foo

Bar

Baz

```````````````````````````````` Setext headings cannot be empty: ```````````````````````````````` example ==== .

====

```````````````````````````````` Setext heading text lines must not be interpretable as block constructs other than paragraphs. So, the line of dashes in these examples gets interpreted as a thematic break: ```````````````````````````````` example --- --- .

```````````````````````````````` ```````````````````````````````` example - foo ----- .
  • foo

```````````````````````````````` ```````````````````````````````` example foo --- .
foo

```````````````````````````````` ```````````````````````````````` example > foo ----- .

foo


```````````````````````````````` If you want a heading with `> foo` as its literal text, you can use backslash escapes: ```````````````````````````````` example \> foo ------ .

> foo

```````````````````````````````` **Compatibility note:** Most existing Markdown implementations do not allow the text of setext headings to span multiple lines. But there is no consensus about how to interpret ``` markdown Foo bar --- baz ``` One can find four different interpretations: 1. paragraph "Foo", heading "bar", paragraph "baz" 2. paragraph "Foo bar", thematic break, paragraph "baz" 3. paragraph "Foo bar --- baz" 4. heading "Foo bar", paragraph "baz" We find interpretation 4 most natural, and interpretation 4 increases the expressive power of CommonMark, by allowing multiline headings. Authors who want interpretation 1 can put a blank line after the first paragraph: ```````````````````````````````` example Foo bar --- baz .

Foo

bar

baz

```````````````````````````````` Authors who want interpretation 2 can put blank lines around the thematic break, ```````````````````````````````` example Foo bar --- baz .

Foo bar


baz

```````````````````````````````` or use a thematic break that cannot count as a [setext heading underline], such as ```````````````````````````````` example Foo bar * * * baz .

Foo bar


baz

```````````````````````````````` Authors who want interpretation 3 can use backslash escapes: ```````````````````````````````` example Foo bar \--- baz .

Foo bar --- baz

```````````````````````````````` ## Indented code blocks An [indented code block](@) is composed of one or more [indented chunks] separated by blank lines. An [indented chunk](@) is a sequence of non-blank lines, each indented four or more spaces. The contents of the code block are the literal contents of the lines, including trailing [line endings], minus four spaces of indentation. An indented code block has no [info string]. An indented code block cannot interrupt a paragraph, so there must be a blank line between a paragraph and a following indented code block. (A blank line is not needed, however, between a code block and a following paragraph.) ```````````````````````````````` example a simple indented code block .
a simple
  indented code block
```````````````````````````````` If there is any ambiguity between an interpretation of indentation as a code block and as indicating that material belongs to a [list item][list items], the list item interpretation takes precedence: ```````````````````````````````` example - foo bar .
  • foo

    bar

```````````````````````````````` ```````````````````````````````` example 1. foo - bar .
  1. foo

    • bar
```````````````````````````````` The contents of a code block are literal text, and do not get parsed as Markdown: ```````````````````````````````` example
*hi* - one .
<a/>
*hi*

- one
```````````````````````````````` Here we have three chunks separated by blank lines: ```````````````````````````````` example chunk1 chunk2 chunk3 .
chunk1

chunk2



chunk3
```````````````````````````````` Any initial spaces beyond four will be included in the content, even in interior blank lines: ```````````````````````````````` example chunk1 chunk2 .
chunk1
  
  chunk2
```````````````````````````````` An indented code block cannot interrupt a paragraph. (This allows hanging indents and the like.) ```````````````````````````````` example Foo bar .

Foo bar

```````````````````````````````` However, any non-blank line with fewer than four leading spaces ends the code block immediately. So a paragraph may occur immediately after indented code: ```````````````````````````````` example foo bar .
foo

bar

```````````````````````````````` And indented code can occur immediately before and after other kinds of blocks: ```````````````````````````````` example # Heading foo Heading ------ foo ---- .

Heading

foo

Heading

foo

```````````````````````````````` The first line can be indented more than four spaces: ```````````````````````````````` example foo bar .
    foo
bar
```````````````````````````````` Blank lines preceding or following an indented code block are not included in it: ```````````````````````````````` example foo .
foo
```````````````````````````````` Trailing spaces are included in the code block's content: ```````````````````````````````` example foo .
foo  
```````````````````````````````` ## Fenced code blocks A [code fence](@) is a sequence of at least three consecutive backtick characters (`` ` ``) or tildes (`~`). (Tildes and backticks cannot be mixed.) A [fenced code block](@) begins with a code fence, indented no more than three spaces. The line with the opening code fence may optionally contain some text following the code fence; this is trimmed of leading and trailing whitespace and called the [info string](@). If the [info string] comes after a backtick fence, it may not contain any backtick characters. (The reason for this restriction is that otherwise some inline code would be incorrectly interpreted as the beginning of a fenced code block.) The content of the code block consists of all subsequent lines, until a closing [code fence] of the same type as the code block began with (backticks or tildes), and with at least as many backticks or tildes as the opening code fence. If the leading code fence is indented N spaces, then up to N spaces of indentation are removed from each line of the content (if present). (If a content line is not indented, it is preserved unchanged. If it is indented less than N spaces, all of the indentation is removed.) The closing code fence may be indented up to three spaces, and may be followed only by spaces, which are ignored. If the end of the containing block (or document) is reached and no closing code fence has been found, the code block contains all of the lines after the opening code fence until the end of the containing block (or document). (An alternative spec would require backtracking in the event that a closing code fence is not found. But this makes parsing much less efficient, and there seems to be no real down side to the behavior described here.) A fenced code block may interrupt a paragraph, and does not require a blank line either before or after. The content of a code fence is treated as literal text, not parsed as inlines. The first word of the [info string] is typically used to specify the language of the code sample, and rendered in the `class` attribute of the `code` tag. However, this spec does not mandate any particular treatment of the [info string]. Here is a simple example with backticks: ```````````````````````````````` example ``` < > ``` .
<
 >
```````````````````````````````` With tildes: ```````````````````````````````` example ~~~ < > ~~~ .
<
 >
```````````````````````````````` Fewer than three backticks is not enough: ```````````````````````````````` example `` foo `` .

foo

```````````````````````````````` The closing code fence must use the same character as the opening fence: ```````````````````````````````` example ``` aaa ~~~ ``` .
aaa
~~~
```````````````````````````````` ```````````````````````````````` example ~~~ aaa ``` ~~~ .
aaa
```
```````````````````````````````` The closing code fence must be at least as long as the opening fence: ```````````````````````````````` example ```` aaa ``` `````` .
aaa
```
```````````````````````````````` ```````````````````````````````` example ~~~~ aaa ~~~ ~~~~ .
aaa
~~~
```````````````````````````````` Unclosed code blocks are closed by the end of the document (or the enclosing [block quote][block quotes] or [list item][list items]): ```````````````````````````````` example ``` .
```````````````````````````````` ```````````````````````````````` example ````` ``` aaa .

```
aaa
```````````````````````````````` ```````````````````````````````` example > ``` > aaa bbb .
aaa

bbb

```````````````````````````````` A code block can have all empty lines as its content: ```````````````````````````````` example ``` ``` .

  
```````````````````````````````` A code block can be empty: ```````````````````````````````` example ``` ``` .
```````````````````````````````` Fences can be indented. If the opening fence is indented, content lines will have equivalent opening indentation removed, if present: ```````````````````````````````` example ``` aaa aaa ``` .
aaa
aaa
```````````````````````````````` ```````````````````````````````` example ``` aaa aaa aaa ``` .
aaa
aaa
aaa
```````````````````````````````` ```````````````````````````````` example ``` aaa aaa aaa ``` .
aaa
 aaa
aaa
```````````````````````````````` Four spaces indentation produces an indented code block: ```````````````````````````````` example ``` aaa ``` .
```
aaa
```
```````````````````````````````` Closing fences may be indented by 0-3 spaces, and their indentation need not match that of the opening fence: ```````````````````````````````` example ``` aaa ``` .
aaa
```````````````````````````````` ```````````````````````````````` example ``` aaa ``` .
aaa
```````````````````````````````` This is not a closing fence, because it is indented 4 spaces: ```````````````````````````````` example ``` aaa ``` .
aaa
    ```
```````````````````````````````` Code fences (opening and closing) cannot contain internal spaces: ```````````````````````````````` example ``` ``` aaa .

aaa

```````````````````````````````` ```````````````````````````````` example ~~~~~~ aaa ~~~ ~~ .
aaa
~~~ ~~
```````````````````````````````` Fenced code blocks can interrupt paragraphs, and can be followed directly by paragraphs, without a blank line between: ```````````````````````````````` example foo ``` bar ``` baz .

foo

bar

baz

```````````````````````````````` Other blocks can also occur before and after fenced code blocks without an intervening blank line: ```````````````````````````````` example foo --- ~~~ bar ~~~ # baz .

foo

bar

baz

```````````````````````````````` An [info string] can be provided after the opening code fence. Although this spec doesn't mandate any particular treatment of the info string, the first word is typically used to specify the language of the code block. In HTML output, the language is normally indicated by adding a class to the `code` element consisting of `language-` followed by the language name. ```````````````````````````````` example ```ruby def foo(x) return 3 end ``` .
def foo(x)
  return 3
end
```````````````````````````````` ```````````````````````````````` example ~~~~ ruby startline=3 $%@#$ def foo(x) return 3 end ~~~~~~~ .
def foo(x)
  return 3
end
```````````````````````````````` ```````````````````````````````` example ````; ```` .
```````````````````````````````` [Info strings] for backtick code blocks cannot contain backticks: ```````````````````````````````` example ``` aa ``` foo .

aa foo

```````````````````````````````` [Info strings] for tilde code blocks can contain backticks and tildes: ```````````````````````````````` example ~~~ aa ``` ~~~ foo ~~~ .
foo
```````````````````````````````` Closing code fences cannot have [info strings]: ```````````````````````````````` example ``` ``` aaa ``` .
``` aaa
```````````````````````````````` ## HTML blocks An [HTML block](@) is a group of lines that is treated as raw HTML (and will not be escaped in HTML output). There are seven kinds of [HTML block], which can be defined by their start and end conditions. The block begins with a line that meets a [start condition](@) (after up to three spaces optional indentation). It ends with the first subsequent line that meets a matching [end condition](@), or the last line of the document, or the last line of the [container block](#container-blocks) containing the current HTML block, if no line is encountered that meets the [end condition]. If the first line meets both the [start condition] and the [end condition], the block will contain just that line. 1. **Start condition:** line begins with the string ``, or the end of the line.\ **End condition:** line contains an end tag ``, ``, or `` (case-insensitive; it need not match the start tag). 2. **Start condition:** line begins with the string ``. 3. **Start condition:** line begins with the string ``. 4. **Start condition:** line begins with the string ``. 5. **Start condition:** line begins with the string ``. 6. **Start condition:** line begins the string `<` or ``, or the string `/>`.\ **End condition:** line is followed by a [blank line]. 7. **Start condition:** line begins with a complete [open tag] (with any [tag name] other than `script`, `style`, or `pre`) or a complete [closing tag], followed only by [whitespace] or the end of the line.\ **End condition:** line is followed by a [blank line]. HTML blocks continue until they are closed by their appropriate [end condition], or the last line of the document or other [container block](#container-blocks). This means any HTML **within an HTML block** that might otherwise be recognised as a start condition will be ignored by the parser and passed through as-is, without changing the parser's state. For instance, `
` within a HTML block started by `` will not affect
the parser state; as the HTML block was started in by start condition 6, it
will end at any blank line. This can be surprising:

```````````````````````````````` example
**Hello**,

_world_.
.
**Hello**,

world.

```````````````````````````````` In this case, the HTML block is terminated by the newline — the `**Hello**` text remains verbatim — and regular parsing resumes, with a paragraph, emphasised `world` and inline and block HTML following. All types of [HTML blocks] except type 7 may interrupt a paragraph. Blocks of type 7 may not interrupt a paragraph. (This restriction is intended to prevent unwanted interpretation of long tags inside a wrapped paragraph as starting HTML blocks.) Some simple examples follow. Here are some basic HTML blocks of type 6: ```````````````````````````````` example
hi
okay. .
hi

okay.

```````````````````````````````` ```````````````````````````````` example
*foo* ```````````````````````````````` Here we have two HTML blocks with a Markdown paragraph between them: ```````````````````````````````` example
*Markdown*
.

Markdown

```````````````````````````````` The tag on the first line can be partial, as long as it is split where there would be whitespace: ```````````````````````````````` example
.
```````````````````````````````` ```````````````````````````````` example
.
```````````````````````````````` An open tag need not be closed: ```````````````````````````````` example
*foo* *bar* .
*foo*

bar

```````````````````````````````` A partial tag need not even be completed (garbage in, garbage out): ```````````````````````````````` example
. ```````````````````````````````` ```````````````````````````````` example
foo
.
foo
```````````````````````````````` Everything until the next blank line or end of document gets included in the HTML block. So, in the following example, what looks like a Markdown code block is actually part of the HTML block, which continues until a blank line or the end of the document is reached: ```````````````````````````````` example
``` c int x = 33; ``` .
``` c int x = 33; ``` ```````````````````````````````` To start an [HTML block] with a tag that is *not* in the list of block-level tags in (6), you must put the tag by itself on the first line (and it must be complete): ```````````````````````````````` example *bar* . *bar* ```````````````````````````````` In type 7 blocks, the [tag name] can be anything: ```````````````````````````````` example *bar* . *bar* ```````````````````````````````` ```````````````````````````````` example *bar* . *bar* ```````````````````````````````` ```````````````````````````````` example *bar* . *bar* ```````````````````````````````` These rules are designed to allow us to work with tags that can function as either block-level or inline-level tags. The `` tag is a nice example. We can surround content with `` tags in three different ways. In this case, we get a raw HTML block, because the `` tag is on a line by itself: ```````````````````````````````` example *foo* . *foo* ```````````````````````````````` In this case, we get a raw HTML block that just includes the `` tag (because it ends with the following blank line). So the contents get interpreted as CommonMark: ```````````````````````````````` example *foo* .

foo

```````````````````````````````` Finally, in this case, the `` tags are interpreted as [raw HTML] *inside* the CommonMark paragraph. (Because the tag is not on a line by itself, we get inline HTML rather than an [HTML block].) ```````````````````````````````` example *foo* .

foo

```````````````````````````````` HTML tags designed to contain literal content (`script`, `style`, `pre`), comments, processing instructions, and declarations are treated somewhat differently. Instead of ending at the first blank line, these blocks end at the first line containing a corresponding end tag. As a result, these blocks can contain blank lines: A pre tag (type 1): ```````````````````````````````` example

import Text.HTML.TagSoup

main :: IO ()
main = print $ parseTags tags
okay .

import Text.HTML.TagSoup

main :: IO ()
main = print $ parseTags tags

okay

```````````````````````````````` A script tag (type 1): ```````````````````````````````` example okay .

okay

```````````````````````````````` A style tag (type 1): ```````````````````````````````` example okay .

okay

```````````````````````````````` If there is no matching end tag, the block will end at the end of the document (or the enclosing [block quote][block quotes] or [list item][list items]): ```````````````````````````````` example *foo* .

foo

```````````````````````````````` ```````````````````````````````` example *bar* *baz* . *bar*

baz

```````````````````````````````` Note that anything on the last line after the end tag will be included in the [HTML block]: ```````````````````````````````` example 1. *bar* . 1. *bar* ```````````````````````````````` A comment (type 2): ```````````````````````````````` example okay .

okay

```````````````````````````````` A processing instruction (type 3): ```````````````````````````````` example '; ?> okay . '; ?>

okay

```````````````````````````````` A declaration (type 4): ```````````````````````````````` example . ```````````````````````````````` CDATA (type 5): ```````````````````````````````` example okay .

okay

```````````````````````````````` The opening tag can be indented 1-3 spaces, but not 4: ```````````````````````````````` example .
<!-- foo -->
```````````````````````````````` ```````````````````````````````` example
.
<div>
```````````````````````````````` An HTML block of types 1--6 can interrupt a paragraph, and need not be preceded by a blank line. ```````````````````````````````` example Foo
bar
.

Foo

bar
```````````````````````````````` However, a following blank line is needed, except at the end of a document, and except for blocks of types 1--5, [above][HTML block]: ```````````````````````````````` example
bar
*foo* .
bar
*foo* ```````````````````````````````` HTML blocks of type 7 cannot interrupt a paragraph: ```````````````````````````````` example Foo baz .

Foo baz

```````````````````````````````` This rule differs from John Gruber's original Markdown syntax specification, which says: > The only restrictions are that block-level HTML elements — > e.g. `
`, ``, `
`, `

`, etc. — must be separated from > surrounding content by blank lines, and the start and end tags of the > block should not be indented with tabs or spaces. In some ways Gruber's rule is more restrictive than the one given here: - It requires that an HTML block be preceded by a blank line. - It does not allow the start tag to be indented. - It requires a matching end tag, which it also does not allow to be indented. Most Markdown implementations (including some of Gruber's own) do not respect all of these restrictions. There is one respect, however, in which Gruber's rule is more liberal than the one given here, since it allows blank lines to occur inside an HTML block. There are two reasons for disallowing them here. First, it removes the need to parse balanced tags, which is expensive and can require backtracking from the end of the document if no matching end tag is found. Second, it provides a very simple and flexible way of including Markdown content inside HTML tags: simply separate the Markdown from the HTML using blank lines: Compare: ```````````````````````````````` example

*Emphasized* text.
.

Emphasized text.

```````````````````````````````` ```````````````````````````````` example
*Emphasized* text.
.
*Emphasized* text.
```````````````````````````````` Some Markdown implementations have adopted a convention of interpreting content inside tags as text if the open tag has the attribute `markdown=1`. The rule given above seems a simpler and more elegant way of achieving the same expressive power, which is also much simpler to parse. The main potential drawback is that one can no longer paste HTML blocks into Markdown documents with 100% reliability. However, *in most cases* this will work fine, because the blank lines in HTML are usually followed by HTML block tags. For example: ```````````````````````````````` example
Hi
.
Hi
```````````````````````````````` There are problems, however, if the inner tags are indented *and* separated by spaces, as then they will be interpreted as an indented code block: ```````````````````````````````` example
Hi
.
<td>
  Hi
</td>
```````````````````````````````` Fortunately, blank lines are usually not necessary and can be deleted. The exception is inside `
` tags, but as described
[above][HTML blocks], raw HTML blocks starting with `
`
*can* contain blank lines.

## Link reference definitions

A [link reference definition](@)
consists of a [link label], indented up to three spaces, followed
by a colon (`:`), optional [whitespace] (including up to one
[line ending]), a [link destination],
optional [whitespace] (including up to one
[line ending]), and an optional [link
title], which if it is present must be separated
from the [link destination] by [whitespace].
No further [non-whitespace characters] may occur on the line.

A [link reference definition]
does not correspond to a structural element of a document.  Instead, it
defines a label which can be used in [reference links]
and reference-style [images] elsewhere in the document.  [Link
reference definitions] can come either before or after the links that use
them.

```````````````````````````````` example
[foo]: /url "title"

[foo]
.

foo

```````````````````````````````` ```````````````````````````````` example [foo]: /url 'the title' [foo] .

foo

```````````````````````````````` ```````````````````````````````` example [Foo*bar\]]:my_(url) 'title (with parens)' [Foo*bar\]] .

Foo*bar]

```````````````````````````````` ```````````````````````````````` example [Foo bar]: 'title' [Foo bar] .

Foo bar

```````````````````````````````` The title may extend over multiple lines: ```````````````````````````````` example [foo]: /url ' title line1 line2 ' [foo] .

foo

```````````````````````````````` However, it may not contain a [blank line]: ```````````````````````````````` example [foo]: /url 'title with blank line' [foo] .

[foo]: /url 'title

with blank line'

[foo]

```````````````````````````````` The title may be omitted: ```````````````````````````````` example [foo]: /url [foo] .

foo

```````````````````````````````` The link destination may not be omitted: ```````````````````````````````` example [foo]: [foo] .

[foo]:

[foo]

```````````````````````````````` However, an empty link destination may be specified using angle brackets: ```````````````````````````````` example [foo]: <> [foo] .

foo

```````````````````````````````` The title must be separated from the link destination by whitespace: ```````````````````````````````` example [foo]: (baz) [foo] .

[foo]: (baz)

[foo]

```````````````````````````````` Both title and destination can contain backslash escapes and literal backslashes: ```````````````````````````````` example [foo]: /url\bar\*baz "foo\"bar\baz" [foo] .

foo

```````````````````````````````` A link can come before its corresponding definition: ```````````````````````````````` example [foo] [foo]: url .

foo

```````````````````````````````` If there are several matching definitions, the first one takes precedence: ```````````````````````````````` example [foo] [foo]: first [foo]: second .

foo

```````````````````````````````` As noted in the section on [Links], matching of labels is case-insensitive (see [matches]). ```````````````````````````````` example [FOO]: /url [Foo] .

Foo

```````````````````````````````` ```````````````````````````````` example [ΑΓΩ]: /φου [αγω] .

αγω

```````````````````````````````` Here is a link reference definition with no corresponding link. It contributes nothing to the document. ```````````````````````````````` example [foo]: /url . ```````````````````````````````` Here is another one: ```````````````````````````````` example [ foo ]: /url bar .

bar

```````````````````````````````` This is not a link reference definition, because there are [non-whitespace characters] after the title: ```````````````````````````````` example [foo]: /url "title" ok .

[foo]: /url "title" ok

```````````````````````````````` This is a link reference definition, but it has no title: ```````````````````````````````` example [foo]: /url "title" ok .

"title" ok

```````````````````````````````` This is not a link reference definition, because it is indented four spaces: ```````````````````````````````` example [foo]: /url "title" [foo] .
[foo]: /url "title"

[foo]

```````````````````````````````` This is not a link reference definition, because it occurs inside a code block: ```````````````````````````````` example ``` [foo]: /url ``` [foo] .
[foo]: /url

[foo]

```````````````````````````````` A [link reference definition] cannot interrupt a paragraph. ```````````````````````````````` example Foo [bar]: /baz [bar] .

Foo [bar]: /baz

[bar]

```````````````````````````````` However, it can directly follow other block elements, such as headings and thematic breaks, and it need not be followed by a blank line. ```````````````````````````````` example # [Foo] [foo]: /url > bar .

Foo

bar

```````````````````````````````` ```````````````````````````````` example [foo]: /url bar === [foo] .

bar

foo

```````````````````````````````` ```````````````````````````````` example [foo]: /url === [foo] .

=== foo

```````````````````````````````` Several [link reference definitions] can occur one after another, without intervening blank lines. ```````````````````````````````` example [foo]: /foo-url "foo" [bar]: /bar-url "bar" [baz]: /baz-url [foo], [bar], [baz] .

foo, bar, baz

```````````````````````````````` [Link reference definitions] can occur inside block containers, like lists and block quotations. They affect the entire document, not just the container in which they are defined: ```````````````````````````````` example [foo] > [foo]: /url .

foo

```````````````````````````````` Whether something is a [link reference definition] is independent of whether the link reference it defines is used in the document. Thus, for example, the following document contains just a link reference definition, and no visible content: ```````````````````````````````` example [foo]: /url . ```````````````````````````````` ## Paragraphs A sequence of non-blank lines that cannot be interpreted as other kinds of blocks forms a [paragraph](@). The contents of the paragraph are the result of parsing the paragraph's raw content as inlines. The paragraph's raw content is formed by concatenating the lines and removing initial and final [whitespace]. A simple example with two paragraphs: ```````````````````````````````` example aaa bbb .

aaa

bbb

```````````````````````````````` Paragraphs can contain multiple lines, but no blank lines: ```````````````````````````````` example aaa bbb ccc ddd .

aaa bbb

ccc ddd

```````````````````````````````` Multiple blank lines between paragraph have no effect: ```````````````````````````````` example aaa bbb .

aaa

bbb

```````````````````````````````` Leading spaces are skipped: ```````````````````````````````` example aaa bbb .

aaa bbb

```````````````````````````````` Lines after the first may be indented any amount, since indented code blocks cannot interrupt paragraphs. ```````````````````````````````` example aaa bbb ccc .

aaa bbb ccc

```````````````````````````````` However, the first line may be indented at most three spaces, or an indented code block will be triggered: ```````````````````````````````` example aaa bbb .

aaa bbb

```````````````````````````````` ```````````````````````````````` example aaa bbb .
aaa

bbb

```````````````````````````````` Final spaces are stripped before inline parsing, so a paragraph that ends with two or more spaces will not end with a [hard line break]: ```````````````````````````````` example aaa bbb .

aaa
bbb

```````````````````````````````` ## Blank lines [Blank lines] between block-level elements are ignored, except for the role they play in determining whether a [list] is [tight] or [loose]. Blank lines at the beginning and end of the document are also ignored. ```````````````````````````````` example aaa # aaa .

aaa

aaa

```````````````````````````````` # Container blocks A [container block](#container-blocks) is a block that has other blocks as its contents. There are two basic kinds of container blocks: [block quotes] and [list items]. [Lists] are meta-containers for [list items]. We define the syntax for container blocks recursively. The general form of the definition is: > If X is a sequence of blocks, then the result of > transforming X in such-and-such a way is a container of type Y > with these blocks as its content. So, we explain what counts as a block quote or list item by explaining how these can be *generated* from their contents. This should suffice to define the syntax, although it does not give a recipe for *parsing* these constructions. (A recipe is provided below in the section entitled [A parsing strategy](#appendix-a-parsing-strategy).) ## Block quotes A [block quote marker](@) consists of 0-3 spaces of initial indent, plus (a) the character `>` together with a following space, or (b) a single character `>` not followed by a space. The following rules define [block quotes]: 1. **Basic case.** If a string of lines *Ls* constitute a sequence of blocks *Bs*, then the result of prepending a [block quote marker] to the beginning of each line in *Ls* is a [block quote](#block-quotes) containing *Bs*. 2. **Laziness.** If a string of lines *Ls* constitute a [block quote](#block-quotes) with contents *Bs*, then the result of deleting the initial [block quote marker] from one or more lines in which the next [non-whitespace character] after the [block quote marker] is [paragraph continuation text] is a block quote with *Bs* as its content. [Paragraph continuation text](@) is text that will be parsed as part of the content of a paragraph, but does not occur at the beginning of the paragraph. 3. **Consecutiveness.** A document cannot contain two [block quotes] in a row unless there is a [blank line] between them. Nothing else counts as a [block quote](#block-quotes). Here is a simple example: ```````````````````````````````` example > # Foo > bar > baz .

Foo

bar baz

```````````````````````````````` The spaces after the `>` characters can be omitted: ```````````````````````````````` example ># Foo >bar > baz .

Foo

bar baz

```````````````````````````````` The `>` characters can be indented 1-3 spaces: ```````````````````````````````` example > # Foo > bar > baz .

Foo

bar baz

```````````````````````````````` Four spaces gives us a code block: ```````````````````````````````` example > # Foo > bar > baz .
> # Foo
> bar
> baz
```````````````````````````````` The Laziness clause allows us to omit the `>` before [paragraph continuation text]: ```````````````````````````````` example > # Foo > bar baz .

Foo

bar baz

```````````````````````````````` A block quote can contain some lazy and some non-lazy continuation lines: ```````````````````````````````` example > bar baz > foo .

bar baz foo

```````````````````````````````` Laziness only applies to lines that would have been continuations of paragraphs had they been prepended with [block quote markers]. For example, the `> ` cannot be omitted in the second line of ``` markdown > foo > --- ``` without changing the meaning: ```````````````````````````````` example > foo --- .

foo


```````````````````````````````` Similarly, if we omit the `> ` in the second line of ``` markdown > - foo > - bar ``` then the block quote ends after the first line: ```````````````````````````````` example > - foo - bar .
  • foo
  • bar
```````````````````````````````` For the same reason, we can't omit the `> ` in front of subsequent lines of an indented or fenced code block: ```````````````````````````````` example > foo bar .
foo
bar
```````````````````````````````` ```````````````````````````````` example > ``` foo ``` .

foo

```````````````````````````````` Note that in the following case, we have a [lazy continuation line]: ```````````````````````````````` example > foo - bar .

foo - bar

```````````````````````````````` To see why, note that in ```markdown > foo > - bar ``` the `- bar` is indented too far to start a list, and can't be an indented code block because indented code blocks cannot interrupt paragraphs, so it is [paragraph continuation text]. A block quote can be empty: ```````````````````````````````` example > .
```````````````````````````````` ```````````````````````````````` example > > > .
```````````````````````````````` A block quote can have initial or final blank lines: ```````````````````````````````` example > > foo > .

foo

```````````````````````````````` A blank line always separates block quotes: ```````````````````````````````` example > foo > bar .

foo

bar

```````````````````````````````` (Most current Markdown implementations, including John Gruber's original `Markdown.pl`, will parse this example as a single block quote with two paragraphs. But it seems better to allow the author to decide whether two block quotes or one are wanted.) Consecutiveness means that if we put these block quotes together, we get a single block quote: ```````````````````````````````` example > foo > bar .

foo bar

```````````````````````````````` To get a block quote with two paragraphs, use: ```````````````````````````````` example > foo > > bar .

foo

bar

```````````````````````````````` Block quotes can interrupt paragraphs: ```````````````````````````````` example foo > bar .

foo

bar

```````````````````````````````` In general, blank lines are not needed before or after block quotes: ```````````````````````````````` example > aaa *** > bbb .

aaa


bbb

```````````````````````````````` However, because of laziness, a blank line is needed between a block quote and a following paragraph: ```````````````````````````````` example > bar baz .

bar baz

```````````````````````````````` ```````````````````````````````` example > bar baz .

bar

baz

```````````````````````````````` ```````````````````````````````` example > bar > baz .

bar

baz

```````````````````````````````` It is a consequence of the Laziness rule that any number of initial `>`s may be omitted on a continuation line of a nested block quote: ```````````````````````````````` example > > > foo bar .

foo bar

```````````````````````````````` ```````````````````````````````` example >>> foo > bar >>baz .

foo bar baz

```````````````````````````````` When including an indented code block in a block quote, remember that the [block quote marker] includes both the `>` and a following space. So *five spaces* are needed after the `>`: ```````````````````````````````` example > code > not code .
code

not code

```````````````````````````````` ## List items A [list marker](@) is a [bullet list marker] or an [ordered list marker]. A [bullet list marker](@) is a `-`, `+`, or `*` character. An [ordered list marker](@) is a sequence of 1--9 arabic digits (`0-9`), followed by either a `.` character or a `)` character. (The reason for the length limit is that with 10 digits we start seeing integer overflows in some browsers.) The following rules define [list items]: 1. **Basic case.** If a sequence of lines *Ls* constitute a sequence of blocks *Bs* starting with a [non-whitespace character], and *M* is a list marker of width *W* followed by 1 ≤ *N* ≤ 4 spaces, then the result of prepending *M* and the following spaces to the first line of *Ls*, and indenting subsequent lines of *Ls* by *W + N* spaces, is a list item with *Bs* as its contents. The type of the list item (bullet or ordered) is determined by the type of its list marker. If the list item is ordered, then it is also assigned a start number, based on the ordered list marker. Exceptions: 1. When the first list item in a [list] interrupts a paragraph---that is, when it starts on a line that would otherwise count as [paragraph continuation text]---then (a) the lines *Ls* must not begin with a blank line, and (b) if the list item is ordered, the start number must be 1. 2. If any line is a [thematic break][thematic breaks] then that line is not a list item. For example, let *Ls* be the lines ```````````````````````````````` example A paragraph with two lines. indented code > A block quote. .

A paragraph with two lines.

indented code

A block quote.

```````````````````````````````` And let *M* be the marker `1.`, and *N* = 2. Then rule #1 says that the following is an ordered list item with start number 1, and the same contents as *Ls*: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

```````````````````````````````` The most important thing to notice is that the position of the text after the list marker determines how much indentation is needed in subsequent blocks in the list item. If the list marker takes up two spaces, and there are three spaces between the list marker and the next [non-whitespace character], then blocks must be indented five spaces in order to fall under the list item. Here are some examples showing how far content must be indented to be put under the list item: ```````````````````````````````` example - one two .
  • one

two

```````````````````````````````` ```````````````````````````````` example - one two .
  • one

    two

```````````````````````````````` ```````````````````````````````` example - one two .
  • one
 two
```````````````````````````````` ```````````````````````````````` example - one two .
  • one

    two

```````````````````````````````` It is tempting to think of this in terms of columns: the continuation blocks must be indented at least to the column of the first [non-whitespace character] after the list marker. However, that is not quite right. The spaces after the list marker determine how much relative indentation is needed. Which column this indentation reaches will depend on how the list item is embedded in other constructions, as shown by this example: ```````````````````````````````` example > > 1. one >> >> two .
  1. one

    two

```````````````````````````````` Here `two` occurs in the same column as the list marker `1.`, but is actually contained in the list item, because there is sufficient indentation after the last containing blockquote marker. The converse is also possible. In the following example, the word `two` occurs far to the right of the initial text of the list item, `one`, but it is not considered part of the list item, because it is not indented far enough past the blockquote marker: ```````````````````````````````` example >>- one >> > > two .
  • one

two

```````````````````````````````` Note that at least one space is needed between the list marker and any following content, so these are not list items: ```````````````````````````````` example -one 2.two .

-one

2.two

```````````````````````````````` A list item may contain blocks that are separated by more than one blank line. ```````````````````````````````` example - foo bar .
  • foo

    bar

```````````````````````````````` A list item may contain any kind of block: ```````````````````````````````` example 1. foo ``` bar ``` baz > bam .
  1. foo

    bar
    

    baz

    bam

```````````````````````````````` A list item that contains an indented code block will preserve empty lines within the code block verbatim. ```````````````````````````````` example - Foo bar baz .
  • Foo

    bar
    
    
    baz
    
```````````````````````````````` Note that ordered list start numbers must be nine digits or less: ```````````````````````````````` example 123456789. ok .
  1. ok
```````````````````````````````` ```````````````````````````````` example 1234567890. not ok .

1234567890. not ok

```````````````````````````````` A start number may begin with 0s: ```````````````````````````````` example 0. ok .
  1. ok
```````````````````````````````` ```````````````````````````````` example 003. ok .
  1. ok
```````````````````````````````` A start number may not be negative: ```````````````````````````````` example -1. not ok .

-1. not ok

```````````````````````````````` 2. **Item starting with indented code.** If a sequence of lines *Ls* constitute a sequence of blocks *Bs* starting with an indented code block, and *M* is a list marker of width *W* followed by one space, then the result of prepending *M* and the following space to the first line of *Ls*, and indenting subsequent lines of *Ls* by *W + 1* spaces, is a list item with *Bs* as its contents. If a line is empty, then it need not be indented. The type of the list item (bullet or ordered) is determined by the type of its list marker. If the list item is ordered, then it is also assigned a start number, based on the ordered list marker. An indented code block will have to be indented four spaces beyond the edge of the region where text will be included in the list item. In the following case that is 6 spaces: ```````````````````````````````` example - foo bar .
  • foo

    bar
    
```````````````````````````````` And in this case it is 11 spaces: ```````````````````````````````` example 10. foo bar .
  1. foo

    bar
    
```````````````````````````````` If the *first* block in the list item is an indented code block, then by rule #2, the contents must be indented *one* space after the list marker: ```````````````````````````````` example indented code paragraph more code .
indented code

paragraph

more code
```````````````````````````````` ```````````````````````````````` example 1. indented code paragraph more code .
  1. indented code
    

    paragraph

    more code
    
```````````````````````````````` Note that an additional space indent is interpreted as space inside the code block: ```````````````````````````````` example 1. indented code paragraph more code .
  1.  indented code
    

    paragraph

    more code
    
```````````````````````````````` Note that rules #1 and #2 only apply to two cases: (a) cases in which the lines to be included in a list item begin with a [non-whitespace character], and (b) cases in which they begin with an indented code block. In a case like the following, where the first block begins with a three-space indent, the rules do not allow us to form a list item by indenting the whole thing and prepending a list marker: ```````````````````````````````` example foo bar .

foo

bar

```````````````````````````````` ```````````````````````````````` example - foo bar .
  • foo

bar

```````````````````````````````` This is not a significant restriction, because when a block begins with 1-3 spaces indent, the indentation can always be removed without a change in interpretation, allowing rule #1 to be applied. So, in the above case: ```````````````````````````````` example - foo bar .
  • foo

    bar

```````````````````````````````` 3. **Item starting with a blank line.** If a sequence of lines *Ls* starting with a single [blank line] constitute a (possibly empty) sequence of blocks *Bs*, not separated from each other by more than one blank line, and *M* is a list marker of width *W*, then the result of prepending *M* to the first line of *Ls*, and indenting subsequent lines of *Ls* by *W + 1* spaces, is a list item with *Bs* as its contents. If a line is empty, then it need not be indented. The type of the list item (bullet or ordered) is determined by the type of its list marker. If the list item is ordered, then it is also assigned a start number, based on the ordered list marker. Here are some list items that start with a blank line but are not empty: ```````````````````````````````` example - foo - ``` bar ``` - baz .
  • foo
  • bar
    
  • baz
    
```````````````````````````````` When the list item starts with a blank line, the number of spaces following the list marker doesn't change the required indentation: ```````````````````````````````` example - foo .
  • foo
```````````````````````````````` A list item can begin with at most one blank line. In the following example, `foo` is not part of the list item: ```````````````````````````````` example - foo .

foo

```````````````````````````````` Here is an empty bullet list item: ```````````````````````````````` example - foo - - bar .
  • foo
  • bar
```````````````````````````````` It does not matter whether there are spaces following the [list marker]: ```````````````````````````````` example - foo - - bar .
  • foo
  • bar
```````````````````````````````` Here is an empty ordered list item: ```````````````````````````````` example 1. foo 2. 3. bar .
  1. foo
  2. bar
```````````````````````````````` A list may start or end with an empty list item: ```````````````````````````````` example * .
```````````````````````````````` However, an empty list item cannot interrupt a paragraph: ```````````````````````````````` example foo * foo 1. .

foo *

foo 1.

```````````````````````````````` 4. **Indentation.** If a sequence of lines *Ls* constitutes a list item according to rule #1, #2, or #3, then the result of indenting each line of *Ls* by 1-3 spaces (the same for each line) also constitutes a list item with the same contents and attributes. If a line is empty, then it need not be indented. Indented one space: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

```````````````````````````````` Indented two spaces: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

```````````````````````````````` Indented three spaces: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

```````````````````````````````` Four spaces indent gives a code block: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
1.  A paragraph
    with two lines.

        indented code

    > A block quote.
```````````````````````````````` 5. **Laziness.** If a string of lines *Ls* constitute a [list item](#list-items) with contents *Bs*, then the result of deleting some or all of the indentation from one or more lines in which the next [non-whitespace character] after the indentation is [paragraph continuation text] is a list item with the same contents and attributes. The unindented lines are called [lazy continuation line](@)s. Here is an example with [lazy continuation lines]: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

```````````````````````````````` Indentation can be partially deleted: ```````````````````````````````` example 1. A paragraph with two lines. .
  1. A paragraph with two lines.
```````````````````````````````` These examples show how laziness can work in nested structures: ```````````````````````````````` example > 1. > Blockquote continued here. .
  1. Blockquote continued here.

```````````````````````````````` ```````````````````````````````` example > 1. > Blockquote > continued here. .
  1. Blockquote continued here.

```````````````````````````````` 6. **That's all.** Nothing that is not counted as a list item by rules #1--5 counts as a [list item](#list-items). The rules for sublists follow from the general rules [above][List items]. A sublist must be indented the same number of spaces a paragraph would need to be in order to be included in the list item. So, in this case we need two spaces indent: ```````````````````````````````` example - foo - bar - baz - boo .
  • foo
    • bar
      • baz
        • boo
```````````````````````````````` One is not enough: ```````````````````````````````` example - foo - bar - baz - boo .
  • foo
  • bar
  • baz
  • boo
```````````````````````````````` Here we need four, because the list marker is wider: ```````````````````````````````` example 10) foo - bar .
  1. foo
    • bar
```````````````````````````````` Three is not enough: ```````````````````````````````` example 10) foo - bar .
  1. foo
  • bar
```````````````````````````````` A list may be the first block in a list item: ```````````````````````````````` example - - foo .
    • foo
```````````````````````````````` ```````````````````````````````` example 1. - 2. foo .
      1. foo
```````````````````````````````` A list item can contain a heading: ```````````````````````````````` example - # Foo - Bar --- baz .
  • Foo

  • Bar

    baz
```````````````````````````````` ### Motivation John Gruber's Markdown spec says the following about list items: 1. "List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab." 2. "To make lists look nice, you can wrap items with hanging indents.... But if you don't want to, you don't have to." 3. "List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab." 4. "It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy." 5. "To put a blockquote within a list item, the blockquote's `>` delimiters need to be indented." 6. "To put a code block within a list item, the code block needs to be indented twice — 8 spaces or two tabs." These rules specify that a paragraph under a list item must be indented four spaces (presumably, from the left margin, rather than the start of the list marker, but this is not said), and that code under a list item must be indented eight spaces instead of the usual four. They also say that a block quote must be indented, but not by how much; however, the example given has four spaces indentation. Although nothing is said about other kinds of block-level content, it is certainly reasonable to infer that *all* block elements under a list item, including other lists, must be indented four spaces. This principle has been called the *four-space rule*. The four-space rule is clear and principled, and if the reference implementation `Markdown.pl` had followed it, it probably would have become the standard. However, `Markdown.pl` allowed paragraphs and sublists to start with only two spaces indentation, at least on the outer level. Worse, its behavior was inconsistent: a sublist of an outer-level list needed two spaces indentation, but a sublist of this sublist needed three spaces. It is not surprising, then, that different implementations of Markdown have developed very different rules for determining what comes under a list item. (Pandoc and python-Markdown, for example, stuck with Gruber's syntax description and the four-space rule, while discount, redcarpet, marked, PHP Markdown, and others followed `Markdown.pl`'s behavior more closely.) Unfortunately, given the divergences between implementations, there is no way to give a spec for list items that will be guaranteed not to break any existing documents. However, the spec given here should correctly handle lists formatted with either the four-space rule or the more forgiving `Markdown.pl` behavior, provided they are laid out in a way that is natural for a human to read. The strategy here is to let the width and indentation of the list marker determine the indentation necessary for blocks to fall under the list item, rather than having a fixed and arbitrary number. The writer can think of the body of the list item as a unit which gets indented to the right enough to fit the list marker (and any indentation on the list marker). (The laziness rule, #5, then allows continuation lines to be unindented if needed.) This rule is superior, we claim, to any rule requiring a fixed level of indentation from the margin. The four-space rule is clear but unnatural. It is quite unintuitive that ``` markdown - foo bar - baz ``` should be parsed as two lists with an intervening paragraph, ``` html
  • foo

bar

  • baz
``` as the four-space rule demands, rather than a single list, ``` html
  • foo

    bar

    • baz
``` The choice of four spaces is arbitrary. It can be learned, but it is not likely to be guessed, and it trips up beginners regularly. Would it help to adopt a two-space rule? The problem is that such a rule, together with the rule allowing 1--3 spaces indentation of the initial list marker, allows text that is indented *less than* the original list marker to be included in the list item. For example, `Markdown.pl` parses ``` markdown - one two ``` as a single list item, with `two` a continuation paragraph: ``` html
  • one

    two

``` and similarly ``` markdown > - one > > two ``` as ``` html
  • one

    two

``` This is extremely unintuitive. Rather than requiring a fixed indent from the margin, we could require a fixed indent (say, two spaces, or even one space) from the list marker (which may itself be indented). This proposal would remove the last anomaly discussed. Unlike the spec presented above, it would count the following as a list item with a subparagraph, even though the paragraph `bar` is not indented as far as the first paragraph `foo`: ``` markdown 10. foo bar ``` Arguably this text does read like a list item with `bar` as a subparagraph, which may count in favor of the proposal. However, on this proposal indented code would have to be indented six spaces after the list marker. And this would break a lot of existing Markdown, which has the pattern: ``` markdown 1. foo indented code ``` where the code is indented eight spaces. The spec above, by contrast, will parse this text as expected, since the code block's indentation is measured from the beginning of `foo`. The one case that needs special treatment is a list item that *starts* with indented code. How much indentation is required in that case, since we don't have a "first paragraph" to measure from? Rule #2 simply stipulates that in such cases, we require one space indentation from the list marker (and then the normal four spaces for the indented code). This will match the four-space rule in cases where the list marker plus its initial indentation takes four spaces (a common case), but diverge in other cases. ## Lists A [list](@) is a sequence of one or more list items [of the same type]. The list items may be separated by any number of blank lines. Two list items are [of the same type](@) if they begin with a [list marker] of the same type. Two list markers are of the same type if (a) they are bullet list markers using the same character (`-`, `+`, or `*`) or (b) they are ordered list numbers with the same delimiter (either `.` or `)`). A list is an [ordered list](@) if its constituent list items begin with [ordered list markers], and a [bullet list](@) if its constituent list items begin with [bullet list markers]. The [start number](@) of an [ordered list] is determined by the list number of its initial list item. The numbers of subsequent list items are disregarded. A list is [loose](@) if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is [tight](@). (The difference in HTML output is that paragraphs in a loose list are wrapped in `

` tags, while paragraphs in a tight list are not.) Changing the bullet or ordered list delimiter starts a new list: ```````````````````````````````` example - foo - bar + baz .

  • foo
  • bar
  • baz
```````````````````````````````` ```````````````````````````````` example 1. foo 2. bar 3) baz .
  1. foo
  2. bar
  1. baz
```````````````````````````````` In CommonMark, a list can interrupt a paragraph. That is, no blank line is needed to separate a paragraph from a following list: ```````````````````````````````` example Foo - bar - baz .

Foo

  • bar
  • baz
```````````````````````````````` `Markdown.pl` does not allow this, through fear of triggering a list via a numeral in a hard-wrapped line: ``` markdown The number of windows in my house is 14. The number of doors is 6. ``` Oddly, though, `Markdown.pl` *does* allow a blockquote to interrupt a paragraph, even though the same considerations might apply. In CommonMark, we do allow lists to interrupt paragraphs, for two reasons. First, it is natural and not uncommon for people to start lists without blank lines: ``` markdown I need to buy - new shoes - a coat - a plane ticket ``` Second, we are attracted to a > [principle of uniformity](@): > if a chunk of text has a certain > meaning, it will continue to have the same meaning when put into a > container block (such as a list item or blockquote). (Indeed, the spec for [list items] and [block quotes] presupposes this principle.) This principle implies that if ``` markdown * I need to buy - new shoes - a coat - a plane ticket ``` is a list item containing a paragraph followed by a nested sublist, as all Markdown implementations agree it is (though the paragraph may be rendered without `

` tags, since the list is "tight"), then ``` markdown I need to buy - new shoes - a coat - a plane ticket ``` by itself should be a paragraph followed by a nested sublist. Since it is well established Markdown practice to allow lists to interrupt paragraphs inside list items, the [principle of uniformity] requires us to allow this outside list items as well. ([reStructuredText](http://docutils.sourceforge.net/rst.html) takes a different approach, requiring blank lines before lists even inside other list items.) In order to solve of unwanted lists in paragraphs with hard-wrapped numerals, we allow only lists starting with `1` to interrupt paragraphs. Thus, ```````````````````````````````` example The number of windows in my house is 14. The number of doors is 6. .

The number of windows in my house is 14. The number of doors is 6.

```````````````````````````````` We may still get an unintended result in cases like ```````````````````````````````` example The number of windows in my house is 1. The number of doors is 6. .

The number of windows in my house is

  1. The number of doors is 6.
```````````````````````````````` but this rule should prevent most spurious list captures. There can be any number of blank lines between items: ```````````````````````````````` example - foo - bar - baz .
  • foo

  • bar

  • baz

```````````````````````````````` ```````````````````````````````` example - foo - bar - baz bim .
  • foo
    • bar
      • baz

        bim

```````````````````````````````` To separate consecutive lists of the same type, or to separate a list from an indented code block that would otherwise be parsed as a subparagraph of the final list item, you can insert a blank HTML comment: ```````````````````````````````` example - foo - bar - baz - bim .
  • foo
  • bar
  • baz
  • bim
```````````````````````````````` ```````````````````````````````` example - foo notcode - foo code .
  • foo

    notcode

  • foo

code
```````````````````````````````` List items need not be indented to the same level. The following list items will be treated as items at the same list level, since none is indented enough to belong to the previous list item: ```````````````````````````````` example - a - b - c - d - e - f - g .
  • a
  • b
  • c
  • d
  • e
  • f
  • g
```````````````````````````````` ```````````````````````````````` example 1. a 2. b 3. c .
  1. a

  2. b

  3. c

```````````````````````````````` Note, however, that list items may not be indented more than three spaces. Here `- e` is treated as a paragraph continuation line, because it is indented more than three spaces: ```````````````````````````````` example - a - b - c - d - e .
  • a
  • b
  • c
  • d - e
```````````````````````````````` And here, `3. c` is treated as in indented code block, because it is indented four spaces and preceded by a blank line. ```````````````````````````````` example 1. a 2. b 3. c .
  1. a

  2. b

3. c
```````````````````````````````` This is a loose list, because there is a blank line between two of the list items: ```````````````````````````````` example - a - b - c .
  • a

  • b

  • c

```````````````````````````````` So is this, with a empty second item: ```````````````````````````````` example * a * * c .
  • a

  • c

```````````````````````````````` These are loose lists, even though there is no space between the items, because one of the items directly contains two block-level elements with a blank line between them: ```````````````````````````````` example - a - b c - d .
  • a

  • b

    c

  • d

```````````````````````````````` ```````````````````````````````` example - a - b [ref]: /url - d .
  • a

  • b

  • d

```````````````````````````````` This is a tight list, because the blank lines are in a code block: ```````````````````````````````` example - a - ``` b ``` - c .
  • a
  • b
    
    
    
  • c
```````````````````````````````` This is a tight list, because the blank line is between two paragraphs of a sublist. So the sublist is loose while the outer list is tight: ```````````````````````````````` example - a - b c - d .
  • a
    • b

      c

  • d
```````````````````````````````` This is a tight list, because the blank line is inside the block quote: ```````````````````````````````` example * a > b > * c .
  • a

    b

  • c
```````````````````````````````` This list is tight, because the consecutive block elements are not separated by blank lines: ```````````````````````````````` example - a > b ``` c ``` - d .
  • a

    b

    c
    
  • d
```````````````````````````````` A single-paragraph list is tight: ```````````````````````````````` example - a .
  • a
```````````````````````````````` ```````````````````````````````` example - a - b .
  • a
    • b
```````````````````````````````` This list is loose, because of the blank line between the two block elements in the list item: ```````````````````````````````` example 1. ``` foo ``` bar .
  1. foo
    

    bar

```````````````````````````````` Here the outer list is loose, the inner list tight: ```````````````````````````````` example * foo * bar baz .
  • foo

    • bar

    baz

```````````````````````````````` ```````````````````````````````` example - a - b - c - d - e - f .
  • a

    • b
    • c
  • d

    • e
    • f
```````````````````````````````` # Inlines Inlines are parsed sequentially from the beginning of the character stream to the end (left to right, in left-to-right languages). Thus, for example, in ```````````````````````````````` example `hi`lo` .

hilo`

```````````````````````````````` `hi` is parsed as code, leaving the backtick at the end as a literal backtick. ## Backslash escapes Any ASCII punctuation character may be backslash-escaped: ```````````````````````````````` example \!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~ .

!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

```````````````````````````````` Backslashes before other characters are treated as literal backslashes: ```````````````````````````````` example \→\A\a\ \3\φ\« .

\→\A\a\ \3\φ\«

```````````````````````````````` Escaped characters are treated as regular characters and do not have their usual Markdown meanings: ```````````````````````````````` example \*not emphasized* \
not a tag \[not a link](/foo) \`not code` 1\. not a list \* not a list \# not a heading \[foo]: /url "not a reference" \ö not a character entity .

*not emphasized* <br/> not a tag [not a link](/foo) `not code` 1. not a list * not a list # not a heading [foo]: /url "not a reference" &ouml; not a character entity

```````````````````````````````` If a backslash is itself escaped, the following character is not: ```````````````````````````````` example \\*emphasis* .

\emphasis

```````````````````````````````` A backslash at the end of the line is a [hard line break]: ```````````````````````````````` example foo\ bar .

foo
bar

```````````````````````````````` Backslash escapes do not work in code blocks, code spans, autolinks, or raw HTML: ```````````````````````````````` example `` \[\` `` .

\[\`

```````````````````````````````` ```````````````````````````````` example \[\] .
\[\]
```````````````````````````````` ```````````````````````````````` example ~~~ \[\] ~~~ .
\[\]
```````````````````````````````` ```````````````````````````````` example .

http://example.com?find=\*

```````````````````````````````` ```````````````````````````````` example . ```````````````````````````````` But they work in all other contexts, including URLs and link titles, link references, and [info strings] in [fenced code blocks]: ```````````````````````````````` example [foo](/bar\* "ti\*tle") .

foo

```````````````````````````````` ```````````````````````````````` example [foo] [foo]: /bar\* "ti\*tle" .

foo

```````````````````````````````` ```````````````````````````````` example ``` foo\+bar foo ``` .
foo
```````````````````````````````` ## Entity and numeric character references Valid HTML entity references and numeric character references can be used in place of the corresponding Unicode character, with the following exceptions: - Entity and character references are not recognized in code blocks and code spans. - Entity and character references cannot stand in place of special characters that define structural elements in CommonMark. For example, although `*` can be used in place of a literal `*` character, `*` cannot replace `*` in emphasis delimiters, bullet list markers, or thematic breaks. Conforming CommonMark parsers need not store information about whether a particular character was represented in the source using a Unicode character or an entity reference. [Entity references](@) consist of `&` + any of the valid HTML5 entity names + `;`. The document is used as an authoritative source for the valid entity references and their corresponding code points. ```````````````````````````````` example   & © Æ Ď ¾ ℋ ⅆ ∲ ≧̸ .

  & © Æ Ď ¾ ℋ ⅆ ∲ ≧̸

```````````````````````````````` [Decimal numeric character references](@) consist of `&#` + a string of 1--7 arabic digits + `;`. A numeric character reference is parsed as the corresponding Unicode character. Invalid Unicode code points will be replaced by the REPLACEMENT CHARACTER (`U+FFFD`). For security reasons, the code point `U+0000` will also be replaced by `U+FFFD`. ```````````````````````````````` example # Ӓ Ϡ � .

# Ӓ Ϡ �

```````````````````````````````` [Hexadecimal numeric character references](@) consist of `&#` + either `X` or `x` + a string of 1-6 hexadecimal digits + `;`. They too are parsed as the corresponding Unicode character (this time specified with a hexadecimal numeral instead of decimal). ```````````````````````````````` example " ആ ಫ .

" ആ ಫ

```````````````````````````````` Here are some nonentities: ```````````````````````````````` example   &x; &#; &#x; � &#abcdef0; &ThisIsNotDefined; &hi?; .

&nbsp &x; &#; &#x; &#87654321; &#abcdef0; &ThisIsNotDefined; &hi?;

```````````````````````````````` Although HTML5 does accept some entity references without a trailing semicolon (such as `©`), these are not recognized here, because it makes the grammar too ambiguous: ```````````````````````````````` example © .

&copy

```````````````````````````````` Strings that are not on the list of HTML5 named entities are not recognized as entity references either: ```````````````````````````````` example &MadeUpEntity; .

&MadeUpEntity;

```````````````````````````````` Entity and numeric character references are recognized in any context besides code spans or code blocks, including URLs, [link titles], and [fenced code block][] [info strings]: ```````````````````````````````` example . ```````````````````````````````` ```````````````````````````````` example [foo](/föö "föö") .

foo

```````````````````````````````` ```````````````````````````````` example [foo] [foo]: /föö "föö" .

foo

```````````````````````````````` ```````````````````````````````` example ``` föö foo ``` .
foo
```````````````````````````````` Entity and numeric character references are treated as literal text in code spans and code blocks: ```````````````````````````````` example `föö` .

f&ouml;&ouml;

```````````````````````````````` ```````````````````````````````` example föfö .
f&ouml;f&ouml;
```````````````````````````````` Entity and numeric character references cannot be used in place of symbols indicating structure in CommonMark documents. ```````````````````````````````` example *foo* *foo* .

*foo* foo

```````````````````````````````` ```````````````````````````````` example * foo * foo .

* foo

  • foo
```````````````````````````````` ```````````````````````````````` example foo bar .

foo bar

```````````````````````````````` ```````````````````````````````` example foo .

→foo

```````````````````````````````` ```````````````````````````````` example [a](url "tit") .

[a](url "tit")

```````````````````````````````` ## Code spans A [backtick string](@) is a string of one or more backtick characters (`` ` ``) that is neither preceded nor followed by a backtick. A [code span](@) begins with a backtick string and ends with a backtick string of equal length. The contents of the code span are the characters between the two backtick strings, normalized in the following ways: - First, [line endings] are converted to [spaces]. - If the resulting string both begins *and* ends with a [space] character, but does not consist entirely of [space] characters, a single [space] character is removed from the front and back. This allows you to include code that begins or ends with backtick characters, which must be separated by whitespace from the opening or closing backtick strings. This is a simple code span: ```````````````````````````````` example `foo` .

foo

```````````````````````````````` Here two backticks are used, because the code contains a backtick. This example also illustrates stripping of a single leading and trailing space: ```````````````````````````````` example `` foo ` bar `` .

foo ` bar

```````````````````````````````` This example shows the motivation for stripping leading and trailing spaces: ```````````````````````````````` example ` `` ` .

``

```````````````````````````````` Note that only *one* space is stripped: ```````````````````````````````` example ` `` ` .

``

```````````````````````````````` The stripping only happens if the space is on both sides of the string: ```````````````````````````````` example ` a` .

a

```````````````````````````````` Only [spaces], and not [unicode whitespace] in general, are stripped in this way: ```````````````````````````````` example ` b ` .

 b 

```````````````````````````````` No stripping occurs if the code span contains only spaces: ```````````````````````````````` example ` ` ` ` .

 

```````````````````````````````` [Line endings] are treated like spaces: ```````````````````````````````` example `` foo bar baz `` .

foo bar baz

```````````````````````````````` ```````````````````````````````` example `` foo `` .

foo

```````````````````````````````` Interior spaces are not collapsed: ```````````````````````````````` example `foo bar baz` .

foo bar baz

```````````````````````````````` Note that browsers will typically collapse consecutive spaces when rendering `` elements, so it is recommended that the following CSS be used: code{white-space: pre-wrap;} Note that backslash escapes do not work in code spans. All backslashes are treated literally: ```````````````````````````````` example `foo\`bar` .

foo\bar`

```````````````````````````````` Backslash escapes are never needed, because one can always choose a string of *n* backtick characters as delimiters, where the code does not contain any strings of exactly *n* backtick characters. ```````````````````````````````` example ``foo`bar`` .

foo`bar

```````````````````````````````` ```````````````````````````````` example ` foo `` bar ` .

foo `` bar

```````````````````````````````` Code span backticks have higher precedence than any other inline constructs except HTML tags and autolinks. Thus, for example, this is not parsed as emphasized text, since the second `*` is part of a code span: ```````````````````````````````` example *foo`*` .

*foo*

```````````````````````````````` And this is not parsed as a link: ```````````````````````````````` example [not a `link](/foo`) .

[not a link](/foo)

```````````````````````````````` Code spans, HTML tags, and autolinks have the same precedence. Thus, this is code: ```````````````````````````````` example `` .

<a href="">`

```````````````````````````````` But this is an HTML tag: ```````````````````````````````` example
` .

`

```````````````````````````````` And this is code: ```````````````````````````````` example `` .

<http://foo.bar.baz>`

```````````````````````````````` But this is an autolink: ```````````````````````````````` example ` .

http://foo.bar.`baz`

```````````````````````````````` When a backtick string is not closed by a matching backtick string, we just have literal backticks: ```````````````````````````````` example ```foo`` .

```foo``

```````````````````````````````` ```````````````````````````````` example `foo .

`foo

```````````````````````````````` The following case also illustrates the need for opening and closing backtick strings to be equal in length: ```````````````````````````````` example `foo``bar`` .

`foobar

```````````````````````````````` ## Emphasis and strong emphasis John Gruber's original [Markdown syntax description](http://daringfireball.net/projects/markdown/syntax#em) says: > Markdown treats asterisks (`*`) and underscores (`_`) as indicators of > emphasis. Text wrapped with one `*` or `_` will be wrapped with an HTML > `` tag; double `*`'s or `_`'s will be wrapped with an HTML `` > tag. This is enough for most users, but these rules leave much undecided, especially when it comes to nested emphasis. The original `Markdown.pl` test suite makes it clear that triple `***` and `___` delimiters can be used for strong emphasis, and most implementations have also allowed the following patterns: ``` markdown ***strong emph*** ***strong** in emph* ***emph* in strong** **in strong *emph*** *in emph **strong*** ``` The following patterns are less widely supported, but the intent is clear and they are useful (especially in contexts like bibliography entries): ``` markdown *emph *with emph* in it* **strong **with strong** in it** ``` Many implementations have also restricted intraword emphasis to the `*` forms, to avoid unwanted emphasis in words containing internal underscores. (It is best practice to put these in code spans, but users often do not.) ``` markdown internal emphasis: foo*bar*baz no emphasis: foo_bar_baz ``` The rules given below capture all of these patterns, while allowing for efficient parsing strategies that do not backtrack. First, some definitions. A [delimiter run](@) is either a sequence of one or more `*` characters that is not preceded or followed by a non-backslash-escaped `*` character, or a sequence of one or more `_` characters that is not preceded or followed by a non-backslash-escaped `_` character. A [left-flanking delimiter run](@) is a [delimiter run] that is (1) not followed by [Unicode whitespace], and either (2a) not followed by a [punctuation character], or (2b) followed by a [punctuation character] and preceded by [Unicode whitespace] or a [punctuation character]. For purposes of this definition, the beginning and the end of the line count as Unicode whitespace. A [right-flanking delimiter run](@) is a [delimiter run] that is (1) not preceded by [Unicode whitespace], and either (2a) not preceded by a [punctuation character], or (2b) preceded by a [punctuation character] and followed by [Unicode whitespace] or a [punctuation character]. For purposes of this definition, the beginning and the end of the line count as Unicode whitespace. Here are some examples of delimiter runs. - left-flanking but not right-flanking: ``` ***abc _abc **"abc" _"abc" ``` - right-flanking but not left-flanking: ``` abc*** abc_ "abc"** "abc"_ ``` - Both left and right-flanking: ``` abc***def "abc"_"def" ``` - Neither left nor right-flanking: ``` abc *** def a _ b ``` (The idea of distinguishing left-flanking and right-flanking delimiter runs based on the character before and the character after comes from Roopesh Chander's [vfmd](http://www.vfmd.org/vfmd-spec/specification/#procedure-for-identifying-emphasis-tags). vfmd uses the terminology "emphasis indicator string" instead of "delimiter run," and its rules for distinguishing left- and right-flanking runs are a bit more complex than the ones given here.) The following rules define emphasis and strong emphasis: 1. A single `*` character [can open emphasis](@) iff (if and only if) it is part of a [left-flanking delimiter run]. 2. A single `_` character [can open emphasis] iff it is part of a [left-flanking delimiter run] and either (a) not part of a [right-flanking delimiter run] or (b) part of a [right-flanking delimiter run] preceded by punctuation. 3. A single `*` character [can close emphasis](@) iff it is part of a [right-flanking delimiter run]. 4. A single `_` character [can close emphasis] iff it is part of a [right-flanking delimiter run] and either (a) not part of a [left-flanking delimiter run] or (b) part of a [left-flanking delimiter run] followed by punctuation. 5. A double `**` [can open strong emphasis](@) iff it is part of a [left-flanking delimiter run]. 6. A double `__` [can open strong emphasis] iff it is part of a [left-flanking delimiter run] and either (a) not part of a [right-flanking delimiter run] or (b) part of a [right-flanking delimiter run] preceded by punctuation. 7. A double `**` [can close strong emphasis](@) iff it is part of a [right-flanking delimiter run]. 8. A double `__` [can close strong emphasis] iff it is part of a [right-flanking delimiter run] and either (a) not part of a [left-flanking delimiter run] or (b) part of a [left-flanking delimiter run] followed by punctuation. 9. Emphasis begins with a delimiter that [can open emphasis] and ends with a delimiter that [can close emphasis], and that uses the same character (`_` or `*`) as the opening delimiter. The opening and closing delimiters must belong to separate [delimiter runs]. If one of the delimiters can both open and close emphasis, then the sum of the lengths of the delimiter runs containing the opening and closing delimiters must not be a multiple of 3 unless both lengths are multiples of 3. 10. Strong emphasis begins with a delimiter that [can open strong emphasis] and ends with a delimiter that [can close strong emphasis], and that uses the same character (`_` or `*`) as the opening delimiter. The opening and closing delimiters must belong to separate [delimiter runs]. If one of the delimiters can both open and close strong emphasis, then the sum of the lengths of the delimiter runs containing the opening and closing delimiters must not be a multiple of 3 unless both lengths are multiples of 3. 11. A literal `*` character cannot occur at the beginning or end of `*`-delimited emphasis or `**`-delimited strong emphasis, unless it is backslash-escaped. 12. A literal `_` character cannot occur at the beginning or end of `_`-delimited emphasis or `__`-delimited strong emphasis, unless it is backslash-escaped. Where rules 1--12 above are compatible with multiple parsings, the following principles resolve ambiguity: 13. The number of nestings should be minimized. Thus, for example, an interpretation `...` is always preferred to `...`. 14. An interpretation `...` is always preferred to `...`. 15. When two potential emphasis or strong emphasis spans overlap, so that the second begins before the first ends and ends after the first ends, the first takes precedence. Thus, for example, `*foo _bar* baz_` is parsed as `foo _bar baz_` rather than `*foo bar* baz`. 16. When there are two potential emphasis or strong emphasis spans with the same closing delimiter, the shorter one (the one that opens later) takes precedence. Thus, for example, `**foo **bar baz**` is parsed as `**foo bar baz` rather than `foo **bar baz`. 17. Inline code spans, links, images, and HTML tags group more tightly than emphasis. So, when there is a choice between an interpretation that contains one of these elements and one that does not, the former always wins. Thus, for example, `*[foo*](bar)` is parsed as `*foo*` rather than as `[foo](bar)`. These rules can be illustrated through a series of examples. Rule 1: ```````````````````````````````` example *foo bar* .

foo bar

```````````````````````````````` This is not emphasis, because the opening `*` is followed by whitespace, and hence not part of a [left-flanking delimiter run]: ```````````````````````````````` example a * foo bar* .

a * foo bar*

```````````````````````````````` This is not emphasis, because the opening `*` is preceded by an alphanumeric and followed by punctuation, and hence not part of a [left-flanking delimiter run]: ```````````````````````````````` example a*"foo"* .

a*"foo"*

```````````````````````````````` Unicode nonbreaking spaces count as whitespace, too: ```````````````````````````````` example * a * .

* a *

```````````````````````````````` Intraword emphasis with `*` is permitted: ```````````````````````````````` example foo*bar* .

foobar

```````````````````````````````` ```````````````````````````````` example 5*6*78 .

5678

```````````````````````````````` Rule 2: ```````````````````````````````` example _foo bar_ .

foo bar

```````````````````````````````` This is not emphasis, because the opening `_` is followed by whitespace: ```````````````````````````````` example _ foo bar_ .

_ foo bar_

```````````````````````````````` This is not emphasis, because the opening `_` is preceded by an alphanumeric and followed by punctuation: ```````````````````````````````` example a_"foo"_ .

a_"foo"_

```````````````````````````````` Emphasis with `_` is not allowed inside words: ```````````````````````````````` example foo_bar_ .

foo_bar_

```````````````````````````````` ```````````````````````````````` example 5_6_78 .

5_6_78

```````````````````````````````` ```````````````````````````````` example пристаням_стремятся_ .

пристаням_стремятся_

```````````````````````````````` Here `_` does not generate emphasis, because the first delimiter run is right-flanking and the second left-flanking: ```````````````````````````````` example aa_"bb"_cc .

aa_"bb"_cc

```````````````````````````````` This is emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation: ```````````````````````````````` example foo-_(bar)_ .

foo-(bar)

```````````````````````````````` Rule 3: This is not emphasis, because the closing delimiter does not match the opening delimiter: ```````````````````````````````` example _foo* .

_foo*

```````````````````````````````` This is not emphasis, because the closing `*` is preceded by whitespace: ```````````````````````````````` example *foo bar * .

*foo bar *

```````````````````````````````` A newline also counts as whitespace: ```````````````````````````````` example *foo bar * .

*foo bar *

```````````````````````````````` This is not emphasis, because the second `*` is preceded by punctuation and followed by an alphanumeric (hence it is not part of a [right-flanking delimiter run]: ```````````````````````````````` example *(*foo) .

*(*foo)

```````````````````````````````` The point of this restriction is more easily appreciated with this example: ```````````````````````````````` example *(*foo*)* .

(foo)

```````````````````````````````` Intraword emphasis with `*` is allowed: ```````````````````````````````` example *foo*bar .

foobar

```````````````````````````````` Rule 4: This is not emphasis, because the closing `_` is preceded by whitespace: ```````````````````````````````` example _foo bar _ .

_foo bar _

```````````````````````````````` This is not emphasis, because the second `_` is preceded by punctuation and followed by an alphanumeric: ```````````````````````````````` example _(_foo) .

_(_foo)

```````````````````````````````` This is emphasis within emphasis: ```````````````````````````````` example _(_foo_)_ .

(foo)

```````````````````````````````` Intraword emphasis is disallowed for `_`: ```````````````````````````````` example _foo_bar .

_foo_bar

```````````````````````````````` ```````````````````````````````` example _пристаням_стремятся .

_пристаням_стремятся

```````````````````````````````` ```````````````````````````````` example _foo_bar_baz_ .

foo_bar_baz

```````````````````````````````` This is emphasis, even though the closing delimiter is both left- and right-flanking, because it is followed by punctuation: ```````````````````````````````` example _(bar)_. .

(bar).

```````````````````````````````` Rule 5: ```````````````````````````````` example **foo bar** .

foo bar

```````````````````````````````` This is not strong emphasis, because the opening delimiter is followed by whitespace: ```````````````````````````````` example ** foo bar** .

** foo bar**

```````````````````````````````` This is not strong emphasis, because the opening `**` is preceded by an alphanumeric and followed by punctuation, and hence not part of a [left-flanking delimiter run]: ```````````````````````````````` example a**"foo"** .

a**"foo"**

```````````````````````````````` Intraword strong emphasis with `**` is permitted: ```````````````````````````````` example foo**bar** .

foobar

```````````````````````````````` Rule 6: ```````````````````````````````` example __foo bar__ .

foo bar

```````````````````````````````` This is not strong emphasis, because the opening delimiter is followed by whitespace: ```````````````````````````````` example __ foo bar__ .

__ foo bar__

```````````````````````````````` A newline counts as whitespace: ```````````````````````````````` example __ foo bar__ .

__ foo bar__

```````````````````````````````` This is not strong emphasis, because the opening `__` is preceded by an alphanumeric and followed by punctuation: ```````````````````````````````` example a__"foo"__ .

a__"foo"__

```````````````````````````````` Intraword strong emphasis is forbidden with `__`: ```````````````````````````````` example foo__bar__ .

foo__bar__

```````````````````````````````` ```````````````````````````````` example 5__6__78 .

5__6__78

```````````````````````````````` ```````````````````````````````` example пристаням__стремятся__ .

пристаням__стремятся__

```````````````````````````````` ```````````````````````````````` example __foo, __bar__, baz__ .

foo, bar, baz

```````````````````````````````` This is strong emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation: ```````````````````````````````` example foo-__(bar)__ .

foo-(bar)

```````````````````````````````` Rule 7: This is not strong emphasis, because the closing delimiter is preceded by whitespace: ```````````````````````````````` example **foo bar ** .

**foo bar **

```````````````````````````````` (Nor can it be interpreted as an emphasized `*foo bar *`, because of Rule 11.) This is not strong emphasis, because the second `**` is preceded by punctuation and followed by an alphanumeric: ```````````````````````````````` example **(**foo) .

**(**foo)

```````````````````````````````` The point of this restriction is more easily appreciated with these examples: ```````````````````````````````` example *(**foo**)* .

(foo)

```````````````````````````````` ```````````````````````````````` example **Gomphocarpus (*Gomphocarpus physocarpus*, syn. *Asclepias physocarpa*)** .

Gomphocarpus (Gomphocarpus physocarpus, syn. Asclepias physocarpa)

```````````````````````````````` ```````````````````````````````` example **foo "*bar*" foo** .

foo "bar" foo

```````````````````````````````` Intraword emphasis: ```````````````````````````````` example **foo**bar .

foobar

```````````````````````````````` Rule 8: This is not strong emphasis, because the closing delimiter is preceded by whitespace: ```````````````````````````````` example __foo bar __ .

__foo bar __

```````````````````````````````` This is not strong emphasis, because the second `__` is preceded by punctuation and followed by an alphanumeric: ```````````````````````````````` example __(__foo) .

__(__foo)

```````````````````````````````` The point of this restriction is more easily appreciated with this example: ```````````````````````````````` example _(__foo__)_ .

(foo)

```````````````````````````````` Intraword strong emphasis is forbidden with `__`: ```````````````````````````````` example __foo__bar .

__foo__bar

```````````````````````````````` ```````````````````````````````` example __пристаням__стремятся .

__пристаням__стремятся

```````````````````````````````` ```````````````````````````````` example __foo__bar__baz__ .

foo__bar__baz

```````````````````````````````` This is strong emphasis, even though the closing delimiter is both left- and right-flanking, because it is followed by punctuation: ```````````````````````````````` example __(bar)__. .

(bar).

```````````````````````````````` Rule 9: Any nonempty sequence of inline elements can be the contents of an emphasized span. ```````````````````````````````` example *foo [bar](/url)* .

foo bar

```````````````````````````````` ```````````````````````````````` example *foo bar* .

foo bar

```````````````````````````````` In particular, emphasis and strong emphasis can be nested inside emphasis: ```````````````````````````````` example _foo __bar__ baz_ .

foo bar baz

```````````````````````````````` ```````````````````````````````` example _foo _bar_ baz_ .

foo bar baz

```````````````````````````````` ```````````````````````````````` example __foo_ bar_ .

foo bar

```````````````````````````````` ```````````````````````````````` example *foo *bar** .

foo bar

```````````````````````````````` ```````````````````````````````` example *foo **bar** baz* .

foo bar baz

```````````````````````````````` ```````````````````````````````` example *foo**bar**baz* .

foobarbaz

```````````````````````````````` Note that in the preceding case, the interpretation ``` markdown

foobarbaz

``` is precluded by the condition that a delimiter that can both open and close (like the `*` after `foo`) cannot form emphasis if the sum of the lengths of the delimiter runs containing the opening and closing delimiters is a multiple of 3 unless both lengths are multiples of 3. For the same reason, we don't get two consecutive emphasis sections in this example: ```````````````````````````````` example *foo**bar* .

foo**bar

```````````````````````````````` The same condition ensures that the following cases are all strong emphasis nested inside emphasis, even when the interior spaces are omitted: ```````````````````````````````` example ***foo** bar* .

foo bar

```````````````````````````````` ```````````````````````````````` example *foo **bar*** .

foo bar

```````````````````````````````` ```````````````````````````````` example *foo**bar*** .

foobar

```````````````````````````````` When the lengths of the interior closing and opening delimiter runs are *both* multiples of 3, though, they can match to create emphasis: ```````````````````````````````` example foo***bar***baz .

foobarbaz

```````````````````````````````` ```````````````````````````````` example foo******bar*********baz .

foobar***baz

```````````````````````````````` Indefinite levels of nesting are possible: ```````````````````````````````` example *foo **bar *baz* bim** bop* .

foo bar baz bim bop

```````````````````````````````` ```````````````````````````````` example *foo [*bar*](/url)* .

foo bar

```````````````````````````````` There can be no empty emphasis or strong emphasis: ```````````````````````````````` example ** is not an empty emphasis .

** is not an empty emphasis

```````````````````````````````` ```````````````````````````````` example **** is not an empty strong emphasis .

**** is not an empty strong emphasis

```````````````````````````````` Rule 10: Any nonempty sequence of inline elements can be the contents of an strongly emphasized span. ```````````````````````````````` example **foo [bar](/url)** .

foo bar

```````````````````````````````` ```````````````````````````````` example **foo bar** .

foo bar

```````````````````````````````` In particular, emphasis and strong emphasis can be nested inside strong emphasis: ```````````````````````````````` example __foo _bar_ baz__ .

foo bar baz

```````````````````````````````` ```````````````````````````````` example __foo __bar__ baz__ .

foo bar baz

```````````````````````````````` ```````````````````````````````` example ____foo__ bar__ .

foo bar

```````````````````````````````` ```````````````````````````````` example **foo **bar**** .

foo bar

```````````````````````````````` ```````````````````````````````` example **foo *bar* baz** .

foo bar baz

```````````````````````````````` ```````````````````````````````` example **foo*bar*baz** .

foobarbaz

```````````````````````````````` ```````````````````````````````` example ***foo* bar** .

foo bar

```````````````````````````````` ```````````````````````````````` example **foo *bar*** .

foo bar

```````````````````````````````` Indefinite levels of nesting are possible: ```````````````````````````````` example **foo *bar **baz** bim* bop** .

foo bar baz bim bop

```````````````````````````````` ```````````````````````````````` example **foo [*bar*](/url)** .

foo bar

```````````````````````````````` There can be no empty emphasis or strong emphasis: ```````````````````````````````` example __ is not an empty emphasis .

__ is not an empty emphasis

```````````````````````````````` ```````````````````````````````` example ____ is not an empty strong emphasis .

____ is not an empty strong emphasis

```````````````````````````````` Rule 11: ```````````````````````````````` example foo *** .

foo ***

```````````````````````````````` ```````````````````````````````` example foo *\** .

foo *

```````````````````````````````` ```````````````````````````````` example foo *_* .

foo _

```````````````````````````````` ```````````````````````````````` example foo ***** .

foo *****

```````````````````````````````` ```````````````````````````````` example foo **\*** .

foo *

```````````````````````````````` ```````````````````````````````` example foo **_** .

foo _

```````````````````````````````` Note that when delimiters do not match evenly, Rule 11 determines that the excess literal `*` characters will appear outside of the emphasis, rather than inside it: ```````````````````````````````` example **foo* .

*foo

```````````````````````````````` ```````````````````````````````` example *foo** .

foo*

```````````````````````````````` ```````````````````````````````` example ***foo** .

*foo

```````````````````````````````` ```````````````````````````````` example ****foo* .

***foo

```````````````````````````````` ```````````````````````````````` example **foo*** .

foo*

```````````````````````````````` ```````````````````````````````` example *foo**** .

foo***

```````````````````````````````` Rule 12: ```````````````````````````````` example foo ___ .

foo ___

```````````````````````````````` ```````````````````````````````` example foo _\__ .

foo _

```````````````````````````````` ```````````````````````````````` example foo _*_ .

foo *

```````````````````````````````` ```````````````````````````````` example foo _____ .

foo _____

```````````````````````````````` ```````````````````````````````` example foo __\___ .

foo _

```````````````````````````````` ```````````````````````````````` example foo __*__ .

foo *

```````````````````````````````` ```````````````````````````````` example __foo_ .

_foo

```````````````````````````````` Note that when delimiters do not match evenly, Rule 12 determines that the excess literal `_` characters will appear outside of the emphasis, rather than inside it: ```````````````````````````````` example _foo__ .

foo_

```````````````````````````````` ```````````````````````````````` example ___foo__ .

_foo

```````````````````````````````` ```````````````````````````````` example ____foo_ .

___foo

```````````````````````````````` ```````````````````````````````` example __foo___ .

foo_

```````````````````````````````` ```````````````````````````````` example _foo____ .

foo___

```````````````````````````````` Rule 13 implies that if you want emphasis nested directly inside emphasis, you must use different delimiters: ```````````````````````````````` example **foo** .

foo

```````````````````````````````` ```````````````````````````````` example *_foo_* .

foo

```````````````````````````````` ```````````````````````````````` example __foo__ .

foo

```````````````````````````````` ```````````````````````````````` example _*foo*_ .

foo

```````````````````````````````` However, strong emphasis within strong emphasis is possible without switching delimiters: ```````````````````````````````` example ****foo**** .

foo

```````````````````````````````` ```````````````````````````````` example ____foo____ .

foo

```````````````````````````````` Rule 13 can be applied to arbitrarily long sequences of delimiters: ```````````````````````````````` example ******foo****** .

foo

```````````````````````````````` Rule 14: ```````````````````````````````` example ***foo*** .

foo

```````````````````````````````` ```````````````````````````````` example _____foo_____ .

foo

```````````````````````````````` Rule 15: ```````````````````````````````` example *foo _bar* baz_ .

foo _bar baz_

```````````````````````````````` ```````````````````````````````` example *foo __bar *baz bim__ bam* .

foo bar *baz bim bam

```````````````````````````````` Rule 16: ```````````````````````````````` example **foo **bar baz** .

**foo bar baz

```````````````````````````````` ```````````````````````````````` example *foo *bar baz* .

*foo bar baz

```````````````````````````````` Rule 17: ```````````````````````````````` example *[bar*](/url) .

*bar*

```````````````````````````````` ```````````````````````````````` example _foo [bar_](/url) .

_foo bar_

```````````````````````````````` ```````````````````````````````` example * .

*

```````````````````````````````` ```````````````````````````````` example ** .

**

```````````````````````````````` ```````````````````````````````` example __ .

__

```````````````````````````````` ```````````````````````````````` example *a `*`* .

a *

```````````````````````````````` ```````````````````````````````` example _a `_`_ .

a _

```````````````````````````````` ```````````````````````````````` example **a .

**ahttp://foo.bar/?q=**

```````````````````````````````` ```````````````````````````````` example __a .

__ahttp://foo.bar/?q=__

```````````````````````````````` ## Links A link contains [link text] (the visible text), a [link destination] (the URI that is the link destination), and optionally a [link title]. There are two basic kinds of links in Markdown. In [inline links] the destination and title are given immediately after the link text. In [reference links] the destination and title are defined elsewhere in the document. A [link text](@) consists of a sequence of zero or more inline elements enclosed by square brackets (`[` and `]`). The following rules apply: - Links may not contain other links, at any level of nesting. If multiple otherwise valid link definitions appear nested inside each other, the inner-most definition is used. - Brackets are allowed in the [link text] only if (a) they are backslash-escaped or (b) they appear as a matched pair of brackets, with an open bracket `[`, a sequence of zero or more inlines, and a close bracket `]`. - Backtick [code spans], [autolinks], and raw [HTML tags] bind more tightly than the brackets in link text. Thus, for example, `` [foo`]` `` could not be a link text, since the second `]` is part of a code span. - The brackets in link text bind more tightly than markers for [emphasis and strong emphasis]. Thus, for example, `*[foo*](url)` is a link. A [link destination](@) consists of either - a sequence of zero or more characters between an opening `<` and a closing `>` that contains no line breaks or unescaped `<` or `>` characters, or - a nonempty sequence of characters that does not start with `<`, does not include ASCII space or control characters, and includes parentheses only if (a) they are backslash-escaped or (b) they are part of a balanced pair of unescaped parentheses. (Implementations may impose limits on parentheses nesting to avoid performance issues, but at least three levels of nesting should be supported.) A [link title](@) consists of either - a sequence of zero or more characters between straight double-quote characters (`"`), including a `"` character only if it is backslash-escaped, or - a sequence of zero or more characters between straight single-quote characters (`'`), including a `'` character only if it is backslash-escaped, or - a sequence of zero or more characters between matching parentheses (`(...)`), including a `(` or `)` character only if it is backslash-escaped. Although [link titles] may span multiple lines, they may not contain a [blank line]. An [inline link](@) consists of a [link text] followed immediately by a left parenthesis `(`, optional [whitespace], an optional [link destination], an optional [link title] separated from the link destination by [whitespace], optional [whitespace], and a right parenthesis `)`. The link's text consists of the inlines contained in the [link text] (excluding the enclosing square brackets). The link's URI consists of the link destination, excluding enclosing `<...>` if present, with backslash-escapes in effect as described above. The link's title consists of the link title, excluding its enclosing delimiters, with backslash-escapes in effect as described above. Here is a simple inline link: ```````````````````````````````` example [link](/uri "title") .

link

```````````````````````````````` The title may be omitted: ```````````````````````````````` example [link](/uri) .

link

```````````````````````````````` Both the title and the destination may be omitted: ```````````````````````````````` example [link]() .

link

```````````````````````````````` ```````````````````````````````` example [link](<>) .

link

```````````````````````````````` The destination can only contain spaces if it is enclosed in pointy brackets: ```````````````````````````````` example [link](/my uri) .

[link](/my uri)

```````````````````````````````` ```````````````````````````````` example [link](
) .

link

```````````````````````````````` The destination cannot contain line breaks, even if enclosed in pointy brackets: ```````````````````````````````` example [link](foo bar) .

[link](foo bar)

```````````````````````````````` ```````````````````````````````` example [link]() .

[link]()

```````````````````````````````` The destination can contain `)` if it is enclosed in pointy brackets: ```````````````````````````````` example [a]() .

a

```````````````````````````````` Pointy brackets that enclose links must be unescaped: ```````````````````````````````` example [link]() .

[link](<foo>)

```````````````````````````````` These are not links, because the opening pointy bracket is not matched properly: ```````````````````````````````` example [a]( [a](c) .

[a](<b)c [a](<b)c> [a](c)

```````````````````````````````` Parentheses inside the link destination may be escaped: ```````````````````````````````` example [link](\(foo\)) .

link

```````````````````````````````` Any number of parentheses are allowed without escaping, as long as they are balanced: ```````````````````````````````` example [link](foo(and(bar))) .

link

```````````````````````````````` However, if you have unbalanced parentheses, you need to escape or use the `<...>` form: ```````````````````````````````` example [link](foo\(and\(bar\)) .

link

```````````````````````````````` ```````````````````````````````` example [link]() .

link

```````````````````````````````` Parentheses and other symbols can also be escaped, as usual in Markdown: ```````````````````````````````` example [link](foo\)\:) .

link

```````````````````````````````` A link can contain fragment identifiers and queries: ```````````````````````````````` example [link](#fragment) [link](http://example.com#fragment) [link](http://example.com?foo=3#frag) .

link

link

link

```````````````````````````````` Note that a backslash before a non-escapable character is just a backslash: ```````````````````````````````` example [link](foo\bar) .

link

```````````````````````````````` URL-escaping should be left alone inside the destination, as all URL-escaped characters are also valid URL characters. Entity and numerical character references in the destination will be parsed into the corresponding Unicode code points, as usual. These may be optionally URL-escaped when written as HTML, but this spec does not enforce any particular policy for rendering URLs in HTML or other formats. Renderers may make different decisions about how to escape or normalize URLs in the output. ```````````````````````````````` example [link](foo%20bä) .

link

```````````````````````````````` Note that, because titles can often be parsed as destinations, if you try to omit the destination and keep the title, you'll get unexpected results: ```````````````````````````````` example [link]("title") .

link

```````````````````````````````` Titles may be in single quotes, double quotes, or parentheses: ```````````````````````````````` example [link](/url "title") [link](/url 'title') [link](/url (title)) .

link link link

```````````````````````````````` Backslash escapes and entity and numeric character references may be used in titles: ```````````````````````````````` example [link](/url "title \""") .

link

```````````````````````````````` Titles must be separated from the link using a [whitespace]. Other [Unicode whitespace] like non-breaking space doesn't work. ```````````````````````````````` example [link](/url "title") .

link

```````````````````````````````` Nested balanced quotes are not allowed without escaping: ```````````````````````````````` example [link](/url "title "and" title") .

[link](/url "title "and" title")

```````````````````````````````` But it is easy to work around this by using a different quote type: ```````````````````````````````` example [link](/url 'title "and" title') .

link

```````````````````````````````` (Note: `Markdown.pl` did allow double quotes inside a double-quoted title, and its test suite included a test demonstrating this. But it is hard to see a good rationale for the extra complexity this brings, since there are already many ways---backslash escaping, entity and numeric character references, or using a different quote type for the enclosing title---to write titles containing double quotes. `Markdown.pl`'s handling of titles has a number of other strange features. For example, it allows single-quoted titles in inline links, but not reference links. And, in reference links but not inline links, it allows a title to begin with `"` and end with `)`. `Markdown.pl` 1.0.1 even allows titles with no closing quotation mark, though 1.0.2b8 does not. It seems preferable to adopt a simple, rational rule that works the same way in inline links and link reference definitions.) [Whitespace] is allowed around the destination and title: ```````````````````````````````` example [link]( /uri "title" ) .

link

```````````````````````````````` But it is not allowed between the link text and the following parenthesis: ```````````````````````````````` example [link] (/uri) .

[link] (/uri)

```````````````````````````````` The link text may contain balanced brackets, but not unbalanced ones, unless they are escaped: ```````````````````````````````` example [link [foo [bar]]](/uri) .

link [foo [bar]]

```````````````````````````````` ```````````````````````````````` example [link] bar](/uri) .

[link] bar](/uri)

```````````````````````````````` ```````````````````````````````` example [link [bar](/uri) .

[link bar

```````````````````````````````` ```````````````````````````````` example [link \[bar](/uri) .

link [bar

```````````````````````````````` The link text may contain inline content: ```````````````````````````````` example [link *foo **bar** `#`*](/uri) .

link foo bar #

```````````````````````````````` ```````````````````````````````` example [![moon](moon.jpg)](/uri) .

moon

```````````````````````````````` However, links may not contain other links, at any level of nesting. ```````````````````````````````` example [foo [bar](/uri)](/uri) .

[foo bar](/uri)

```````````````````````````````` ```````````````````````````````` example [foo *[bar [baz](/uri)](/uri)*](/uri) .

[foo [bar baz](/uri)](/uri)

```````````````````````````````` ```````````````````````````````` example ![[[foo](uri1)](uri2)](uri3) .

[foo](uri2)

```````````````````````````````` These cases illustrate the precedence of link text grouping over emphasis grouping: ```````````````````````````````` example *[foo*](/uri) .

*foo*

```````````````````````````````` ```````````````````````````````` example [foo *bar](baz*) .

foo *bar

```````````````````````````````` Note that brackets that *aren't* part of links do not take precedence: ```````````````````````````````` example *foo [bar* baz] .

foo [bar baz]

```````````````````````````````` These cases illustrate the precedence of HTML tags, code spans, and autolinks over link grouping: ```````````````````````````````` example [foo .

[foo

```````````````````````````````` ```````````````````````````````` example [foo`](/uri)` .

[foo](/uri)

```````````````````````````````` ```````````````````````````````` example [foo .

[foohttp://example.com/?search=](uri)

```````````````````````````````` There are three kinds of [reference link](@)s: [full](#full-reference-link), [collapsed](#collapsed-reference-link), and [shortcut](#shortcut-reference-link). A [full reference link](@) consists of a [link text] immediately followed by a [link label] that [matches] a [link reference definition] elsewhere in the document. A [link label](@) begins with a left bracket (`[`) and ends with the first right bracket (`]`) that is not backslash-escaped. Between these brackets there must be at least one [non-whitespace character]. Unescaped square bracket characters are not allowed inside the opening and closing square brackets of [link labels]. A link label can have at most 999 characters inside the square brackets. One label [matches](@) another just in case their normalized forms are equal. To normalize a label, strip off the opening and closing brackets, perform the *Unicode case fold*, strip leading and trailing [whitespace] and collapse consecutive internal [whitespace] to a single space. If there are multiple matching reference link definitions, the one that comes first in the document is used. (It is desirable in such cases to emit a warning.) The contents of the first link label are parsed as inlines, which are used as the link's text. The link's URI and title are provided by the matching [link reference definition]. Here is a simple example: ```````````````````````````````` example [foo][bar] [bar]: /url "title" .

foo

```````````````````````````````` The rules for the [link text] are the same as with [inline links]. Thus: The link text may contain balanced brackets, but not unbalanced ones, unless they are escaped: ```````````````````````````````` example [link [foo [bar]]][ref] [ref]: /uri .

link [foo [bar]]

```````````````````````````````` ```````````````````````````````` example [link \[bar][ref] [ref]: /uri .

link [bar

```````````````````````````````` The link text may contain inline content: ```````````````````````````````` example [link *foo **bar** `#`*][ref] [ref]: /uri .

link foo bar #

```````````````````````````````` ```````````````````````````````` example [![moon](moon.jpg)][ref] [ref]: /uri .

moon

```````````````````````````````` However, links may not contain other links, at any level of nesting. ```````````````````````````````` example [foo [bar](/uri)][ref] [ref]: /uri .

[foo bar]ref

```````````````````````````````` ```````````````````````````````` example [foo *bar [baz][ref]*][ref] [ref]: /uri .

[foo bar baz]ref

```````````````````````````````` (In the examples above, we have two [shortcut reference links] instead of one [full reference link].) The following cases illustrate the precedence of link text grouping over emphasis grouping: ```````````````````````````````` example *[foo*][ref] [ref]: /uri .

*foo*

```````````````````````````````` ```````````````````````````````` example [foo *bar][ref] [ref]: /uri .

foo *bar

```````````````````````````````` These cases illustrate the precedence of HTML tags, code spans, and autolinks over link grouping: ```````````````````````````````` example [foo [ref]: /uri .

[foo

```````````````````````````````` ```````````````````````````````` example [foo`][ref]` [ref]: /uri .

[foo][ref]

```````````````````````````````` ```````````````````````````````` example [foo [ref]: /uri .

[foohttp://example.com/?search=][ref]

```````````````````````````````` Matching is case-insensitive: ```````````````````````````````` example [foo][BaR] [bar]: /url "title" .

foo

```````````````````````````````` Unicode case fold is used: ```````````````````````````````` example [Толпой][Толпой] is a Russian word. [ТОЛПОЙ]: /url .

Толпой is a Russian word.

```````````````````````````````` Consecutive internal [whitespace] is treated as one space for purposes of determining matching: ```````````````````````````````` example [Foo bar]: /url [Baz][Foo bar] .

Baz

```````````````````````````````` No [whitespace] is allowed between the [link text] and the [link label]: ```````````````````````````````` example [foo] [bar] [bar]: /url "title" .

[foo] bar

```````````````````````````````` ```````````````````````````````` example [foo] [bar] [bar]: /url "title" .

[foo] bar

```````````````````````````````` This is a departure from John Gruber's original Markdown syntax description, which explicitly allows whitespace between the link text and the link label. It brings reference links in line with [inline links], which (according to both original Markdown and this spec) cannot have whitespace after the link text. More importantly, it prevents inadvertent capture of consecutive [shortcut reference links]. If whitespace is allowed between the link text and the link label, then in the following we will have a single reference link, not two shortcut reference links, as intended: ``` markdown [foo] [bar] [foo]: /url1 [bar]: /url2 ``` (Note that [shortcut reference links] were introduced by Gruber himself in a beta version of `Markdown.pl`, but never included in the official syntax description. Without shortcut reference links, it is harmless to allow space between the link text and link label; but once shortcut references are introduced, it is too dangerous to allow this, as it frequently leads to unintended results.) When there are multiple matching [link reference definitions], the first is used: ```````````````````````````````` example [foo]: /url1 [foo]: /url2 [bar][foo] .

bar

```````````````````````````````` Note that matching is performed on normalized strings, not parsed inline content. So the following does not match, even though the labels define equivalent inline content: ```````````````````````````````` example [bar][foo\!] [foo!]: /url .

[bar][foo!]

```````````````````````````````` [Link labels] cannot contain brackets, unless they are backslash-escaped: ```````````````````````````````` example [foo][ref[] [ref[]: /uri .

[foo][ref[]

[ref[]: /uri

```````````````````````````````` ```````````````````````````````` example [foo][ref[bar]] [ref[bar]]: /uri .

[foo][ref[bar]]

[ref[bar]]: /uri

```````````````````````````````` ```````````````````````````````` example [[[foo]]] [[[foo]]]: /url .

[[[foo]]]

[[[foo]]]: /url

```````````````````````````````` ```````````````````````````````` example [foo][ref\[] [ref\[]: /uri .

foo

```````````````````````````````` Note that in this example `]` is not backslash-escaped: ```````````````````````````````` example [bar\\]: /uri [bar\\] .

bar\

```````````````````````````````` A [link label] must contain at least one [non-whitespace character]: ```````````````````````````````` example [] []: /uri .

[]

[]: /uri

```````````````````````````````` ```````````````````````````````` example [ ] [ ]: /uri .

[ ]

[ ]: /uri

```````````````````````````````` A [collapsed reference link](@) consists of a [link label] that [matches] a [link reference definition] elsewhere in the document, followed by the string `[]`. The contents of the first link label are parsed as inlines, which are used as the link's text. The link's URI and title are provided by the matching reference link definition. Thus, `[foo][]` is equivalent to `[foo][foo]`. ```````````````````````````````` example [foo][] [foo]: /url "title" .

foo

```````````````````````````````` ```````````````````````````````` example [*foo* bar][] [*foo* bar]: /url "title" .

foo bar

```````````````````````````````` The link labels are case-insensitive: ```````````````````````````````` example [Foo][] [foo]: /url "title" .

Foo

```````````````````````````````` As with full reference links, [whitespace] is not allowed between the two sets of brackets: ```````````````````````````````` example [foo] [] [foo]: /url "title" .

foo []

```````````````````````````````` A [shortcut reference link](@) consists of a [link label] that [matches] a [link reference definition] elsewhere in the document and is not followed by `[]` or a link label. The contents of the first link label are parsed as inlines, which are used as the link's text. The link's URI and title are provided by the matching link reference definition. Thus, `[foo]` is equivalent to `[foo][]`. ```````````````````````````````` example [foo] [foo]: /url "title" .

foo

```````````````````````````````` ```````````````````````````````` example [*foo* bar] [*foo* bar]: /url "title" .

foo bar

```````````````````````````````` ```````````````````````````````` example [[*foo* bar]] [*foo* bar]: /url "title" .

[foo bar]

```````````````````````````````` ```````````````````````````````` example [[bar [foo] [foo]: /url .

[[bar foo

```````````````````````````````` The link labels are case-insensitive: ```````````````````````````````` example [Foo] [foo]: /url "title" .

Foo

```````````````````````````````` A space after the link text should be preserved: ```````````````````````````````` example [foo] bar [foo]: /url .

foo bar

```````````````````````````````` If you just want bracketed text, you can backslash-escape the opening bracket to avoid links: ```````````````````````````````` example \[foo] [foo]: /url "title" .

[foo]

```````````````````````````````` Note that this is a link, because a link label ends with the first following closing bracket: ```````````````````````````````` example [foo*]: /url *[foo*] .

*foo*

```````````````````````````````` Full and compact references take precedence over shortcut references: ```````````````````````````````` example [foo][bar] [foo]: /url1 [bar]: /url2 .

foo

```````````````````````````````` ```````````````````````````````` example [foo][] [foo]: /url1 .

foo

```````````````````````````````` Inline links also take precedence: ```````````````````````````````` example [foo]() [foo]: /url1 .

foo

```````````````````````````````` ```````````````````````````````` example [foo](not a link) [foo]: /url1 .

foo(not a link)

```````````````````````````````` In the following case `[bar][baz]` is parsed as a reference, `[foo]` as normal text: ```````````````````````````````` example [foo][bar][baz] [baz]: /url .

[foo]bar

```````````````````````````````` Here, though, `[foo][bar]` is parsed as a reference, since `[bar]` is defined: ```````````````````````````````` example [foo][bar][baz] [baz]: /url1 [bar]: /url2 .

foobaz

```````````````````````````````` Here `[foo]` is not parsed as a shortcut reference, because it is followed by a link label (even though `[bar]` is not defined): ```````````````````````````````` example [foo][bar][baz] [baz]: /url1 [foo]: /url2 .

[foo]bar

```````````````````````````````` ## Images Syntax for images is like the syntax for links, with one difference. Instead of [link text], we have an [image description](@). The rules for this are the same as for [link text], except that (a) an image description starts with `![` rather than `[`, and (b) an image description may contain links. An image description has inline elements as its contents. When an image is rendered to HTML, this is standardly used as the image's `alt` attribute. ```````````````````````````````` example ![foo](/url "title") .

foo

```````````````````````````````` ```````````````````````````````` example ![foo *bar*] [foo *bar*]: train.jpg "train & tracks" .

foo bar

```````````````````````````````` ```````````````````````````````` example ![foo ![bar](/url)](/url2) .

foo bar

```````````````````````````````` ```````````````````````````````` example ![foo [bar](/url)](/url2) .

foo bar

```````````````````````````````` Though this spec is concerned with parsing, not rendering, it is recommended that in rendering to HTML, only the plain string content of the [image description] be used. Note that in the above example, the alt attribute's value is `foo bar`, not `foo [bar](/url)` or `foo bar`. Only the plain string content is rendered, without formatting. ```````````````````````````````` example ![foo *bar*][] [foo *bar*]: train.jpg "train & tracks" .

foo bar

```````````````````````````````` ```````````````````````````````` example ![foo *bar*][foobar] [FOOBAR]: train.jpg "train & tracks" .

foo bar

```````````````````````````````` ```````````````````````````````` example ![foo](train.jpg) .

foo

```````````````````````````````` ```````````````````````````````` example My ![foo bar](/path/to/train.jpg "title" ) .

My foo bar

```````````````````````````````` ```````````````````````````````` example ![foo]() .

foo

```````````````````````````````` ```````````````````````````````` example ![](/url) .

```````````````````````````````` Reference-style: ```````````````````````````````` example ![foo][bar] [bar]: /url .

foo

```````````````````````````````` ```````````````````````````````` example ![foo][bar] [BAR]: /url .

foo

```````````````````````````````` Collapsed: ```````````````````````````````` example ![foo][] [foo]: /url "title" .

foo

```````````````````````````````` ```````````````````````````````` example ![*foo* bar][] [*foo* bar]: /url "title" .

foo bar

```````````````````````````````` The labels are case-insensitive: ```````````````````````````````` example ![Foo][] [foo]: /url "title" .

Foo

```````````````````````````````` As with reference links, [whitespace] is not allowed between the two sets of brackets: ```````````````````````````````` example ![foo] [] [foo]: /url "title" .

foo []

```````````````````````````````` Shortcut: ```````````````````````````````` example ![foo] [foo]: /url "title" .

foo

```````````````````````````````` ```````````````````````````````` example ![*foo* bar] [*foo* bar]: /url "title" .

foo bar

```````````````````````````````` Note that link labels cannot contain unescaped brackets: ```````````````````````````````` example ![[foo]] [[foo]]: /url "title" .

![[foo]]

[[foo]]: /url "title"

```````````````````````````````` The link labels are case-insensitive: ```````````````````````````````` example ![Foo] [foo]: /url "title" .

Foo

```````````````````````````````` If you just want a literal `!` followed by bracketed text, you can backslash-escape the opening `[`: ```````````````````````````````` example !\[foo] [foo]: /url "title" .

![foo]

```````````````````````````````` If you want a link after a literal `!`, backslash-escape the `!`: ```````````````````````````````` example \![foo] [foo]: /url "title" .

!foo

```````````````````````````````` ## Autolinks [Autolink](@)s are absolute URIs and email addresses inside `<` and `>`. They are parsed as links, with the URL or email address as the link label. A [URI autolink](@) consists of `<`, followed by an [absolute URI] followed by `>`. It is parsed as a link to the URI, with the URI as the link's label. An [absolute URI](@), for these purposes, consists of a [scheme] followed by a colon (`:`) followed by zero or more characters other than ASCII [whitespace] and control characters, `<`, and `>`. If the URI includes these characters, they must be percent-encoded (e.g. `%20` for a space). For purposes of this spec, a [scheme](@) is any sequence of 2--32 characters beginning with an ASCII letter and followed by any combination of ASCII letters, digits, or the symbols plus ("+"), period ("."), or hyphen ("-"). Here are some valid autolinks: ```````````````````````````````` example .

http://foo.bar.baz

```````````````````````````````` ```````````````````````````````` example .

http://foo.bar.baz/test?q=hello&id=22&boolean

```````````````````````````````` ```````````````````````````````` example .

irc://foo.bar:2233/baz

```````````````````````````````` Uppercase is also fine: ```````````````````````````````` example .

MAILTO:FOO@BAR.BAZ

```````````````````````````````` Note that many strings that count as [absolute URIs] for purposes of this spec are not valid URIs, because their schemes are not registered or because of other problems with their syntax: ```````````````````````````````` example .

a+b+c:d

```````````````````````````````` ```````````````````````````````` example .

made-up-scheme://foo,bar

```````````````````````````````` ```````````````````````````````` example .

http://../

```````````````````````````````` ```````````````````````````````` example .

localhost:5001/foo

```````````````````````````````` Spaces are not allowed in autolinks: ```````````````````````````````` example .

<http://foo.bar/baz bim>

```````````````````````````````` Backslash-escapes do not work inside autolinks: ```````````````````````````````` example .

http://example.com/\[\

```````````````````````````````` An [email autolink](@) consists of `<`, followed by an [email address], followed by `>`. The link's label is the email address, and the URL is `mailto:` followed by the email address. An [email address](@), for these purposes, is anything that matches the [non-normative regex from the HTML5 spec](https://html.spec.whatwg.org/multipage/forms.html#e-mail-state-(type=email)): /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])? (?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/ Examples of email autolinks: ```````````````````````````````` example .

foo@bar.example.com

```````````````````````````````` ```````````````````````````````` example .

foo+special@Bar.baz-bar0.com

```````````````````````````````` Backslash-escapes do not work inside email autolinks: ```````````````````````````````` example .

<foo+@bar.example.com>

```````````````````````````````` These are not autolinks: ```````````````````````````````` example <> .

<>

```````````````````````````````` ```````````````````````````````` example < http://foo.bar > .

< http://foo.bar >

```````````````````````````````` ```````````````````````````````` example .

<m:abc>

```````````````````````````````` ```````````````````````````````` example .

<foo.bar.baz>

```````````````````````````````` ```````````````````````````````` example http://example.com .

http://example.com

```````````````````````````````` ```````````````````````````````` example foo@bar.example.com .

foo@bar.example.com

```````````````````````````````` ## Raw HTML Text between `<` and `>` that looks like an HTML tag is parsed as a raw HTML tag and will be rendered in HTML without escaping. Tag and attribute names are not limited to current HTML tags, so custom tags (and even, say, DocBook tags) may be used. Here is the grammar for tags: A [tag name](@) consists of an ASCII letter followed by zero or more ASCII letters, digits, or hyphens (`-`). An [attribute](@) consists of [whitespace], an [attribute name], and an optional [attribute value specification]. An [attribute name](@) consists of an ASCII letter, `_`, or `:`, followed by zero or more ASCII letters, digits, `_`, `.`, `:`, or `-`. (Note: This is the XML specification restricted to ASCII. HTML5 is laxer.) An [attribute value specification](@) consists of optional [whitespace], a `=` character, optional [whitespace], and an [attribute value]. An [attribute value](@) consists of an [unquoted attribute value], a [single-quoted attribute value], or a [double-quoted attribute value]. An [unquoted attribute value](@) is a nonempty string of characters not including [whitespace], `"`, `'`, `=`, `<`, `>`, or `` ` ``. A [single-quoted attribute value](@) consists of `'`, zero or more characters not including `'`, and a final `'`. A [double-quoted attribute value](@) consists of `"`, zero or more characters not including `"`, and a final `"`. An [open tag](@) consists of a `<` character, a [tag name], zero or more [attributes], optional [whitespace], an optional `/` character, and a `>` character. A [closing tag](@) consists of the string ``. An [HTML comment](@) consists of ``, where *text* does not start with `>` or `->`, does not end with `-`, and does not contain `--`. (See the [HTML5 spec](http://www.w3.org/TR/html5/syntax.html#comments).) A [processing instruction](@) consists of the string ``, and the string `?>`. A [declaration](@) consists of the string ``, and the character `>`. A [CDATA section](@) consists of the string ``, and the string `]]>`. An [HTML tag](@) consists of an [open tag], a [closing tag], an [HTML comment], a [processing instruction], a [declaration], or a [CDATA section]. Here are some simple open tags: ```````````````````````````````` example .

```````````````````````````````` Empty elements: ```````````````````````````````` example .

```````````````````````````````` [Whitespace] is allowed: ```````````````````````````````` example .

```````````````````````````````` With attributes: ```````````````````````````````` example .

```````````````````````````````` Custom tag names can be used: ```````````````````````````````` example Foo .

Foo

```````````````````````````````` Illegal tag names, not parsed as HTML: ```````````````````````````````` example <33> <__> .

<33> <__>

```````````````````````````````` Illegal attribute names: ```````````````````````````````` example
.

<a h*#ref="hi">

```````````````````````````````` Illegal attribute values: ```````````````````````````````` example
.

</a href="foo">

```````````````````````````````` Comments: ```````````````````````````````` example foo .

foo

```````````````````````````````` ```````````````````````````````` example foo .

foo <!-- not a comment -- two hyphens -->

```````````````````````````````` Not comments: ```````````````````````````````` example foo foo --> foo .

foo <!--> foo -->

foo <!-- foo--->

```````````````````````````````` Processing instructions: ```````````````````````````````` example foo .

foo

```````````````````````````````` Declarations: ```````````````````````````````` example foo .

foo

```````````````````````````````` CDATA sections: ```````````````````````````````` example foo &<]]> .

foo &<]]>

```````````````````````````````` Entity and numeric character references are preserved in HTML attributes: ```````````````````````````````` example foo
.

foo

```````````````````````````````` Backslash escapes do not work in HTML attributes: ```````````````````````````````` example foo .

foo

```````````````````````````````` ```````````````````````````````` example .

<a href=""">

```````````````````````````````` ## Hard line breaks A line break (not in a code span or HTML tag) that is preceded by two or more spaces and does not occur at the end of a block is parsed as a [hard line break](@) (rendered in HTML as a `
` tag): ```````````````````````````````` example foo baz .

foo
baz

```````````````````````````````` For a more visible alternative, a backslash before the [line ending] may be used instead of two spaces: ```````````````````````````````` example foo\ baz .

foo
baz

```````````````````````````````` More than two spaces can be used: ```````````````````````````````` example foo baz .

foo
baz

```````````````````````````````` Leading spaces at the beginning of the next line are ignored: ```````````````````````````````` example foo bar .

foo
bar

```````````````````````````````` ```````````````````````````````` example foo\ bar .

foo
bar

```````````````````````````````` Line breaks can occur inside emphasis, links, and other constructs that allow inline content: ```````````````````````````````` example *foo bar* .

foo
bar

```````````````````````````````` ```````````````````````````````` example *foo\ bar* .

foo
bar

```````````````````````````````` Line breaks do not occur inside code spans ```````````````````````````````` example `code span` .

code span

```````````````````````````````` ```````````````````````````````` example `code\ span` .

code\ span

```````````````````````````````` or HTML tags: ```````````````````````````````` example
.

```````````````````````````````` ```````````````````````````````` example .

```````````````````````````````` Hard line breaks are for separating inline content within a block. Neither syntax for hard line breaks works at the end of a paragraph or other block element: ```````````````````````````````` example foo\ .

foo\

```````````````````````````````` ```````````````````````````````` example foo .

foo

```````````````````````````````` ```````````````````````````````` example ### foo\ .

foo\

```````````````````````````````` ```````````````````````````````` example ### foo .

foo

```````````````````````````````` ## Soft line breaks A regular line break (not in a code span or HTML tag) that is not preceded by two or more spaces or a backslash is parsed as a [softbreak](@). (A softbreak may be rendered in HTML either as a [line ending] or as a space. The result will be the same in browsers. In the examples here, a [line ending] will be used.) ```````````````````````````````` example foo baz .

foo baz

```````````````````````````````` Spaces at the end of the line and beginning of the next line are removed: ```````````````````````````````` example foo baz .

foo baz

```````````````````````````````` A conforming parser may render a soft line break in HTML either as a line break or as a space. A renderer may also provide an option to render soft line breaks as hard line breaks. ## Textual content Any characters not given an interpretation by the above rules will be parsed as plain textual content. ```````````````````````````````` example hello $.;'there .

hello $.;'there

```````````````````````````````` ```````````````````````````````` example Foo χρῆν .

Foo χρῆν

```````````````````````````````` Internal spaces are preserved verbatim: ```````````````````````````````` example Multiple spaces .

Multiple spaces

```````````````````````````````` # Appendix: A parsing strategy In this appendix we describe some features of the parsing strategy used in the CommonMark reference implementations. ## Overview Parsing has two phases: 1. In the first phase, lines of input are consumed and the block structure of the document---its division into paragraphs, block quotes, list items, and so on---is constructed. Text is assigned to these blocks but not parsed. Link reference definitions are parsed and a map of links is constructed. 2. In the second phase, the raw text contents of paragraphs and headings are parsed into sequences of Markdown inline elements (strings, code spans, links, emphasis, and so on), using the map of link references constructed in phase 1. At each point in processing, the document is represented as a tree of **blocks**. The root of the tree is a `document` block. The `document` may have any number of other blocks as **children**. These children may, in turn, have other blocks as children. The last child of a block is normally considered **open**, meaning that subsequent lines of input can alter its contents. (Blocks that are not open are **closed**.) Here, for example, is a possible document tree, with the open blocks marked by arrows: ``` tree -> document -> block_quote paragraph "Lorem ipsum dolor\nsit amet." -> list (type=bullet tight=true bullet_char=-) list_item paragraph "Qui *quodsi iracundia*" -> list_item -> paragraph "aliquando id" ``` ## Phase 1: block structure Each line that is processed has an effect on this tree. The line is analyzed and, depending on its contents, the document may be altered in one or more of the following ways: 1. One or more open blocks may be closed. 2. One or more new blocks may be created as children of the last open block. 3. Text may be added to the last (deepest) open block remaining on the tree. Once a line has been incorporated into the tree in this way, it can be discarded, so input can be read in a stream. For each line, we follow this procedure: 1. First we iterate through the open blocks, starting with the root document, and descending through last children down to the last open block. Each block imposes a condition that the line must satisfy if the block is to remain open. For example, a block quote requires a `>` character. A paragraph requires a non-blank line. In this phase we may match all or just some of the open blocks. But we cannot close unmatched blocks yet, because we may have a [lazy continuation line]. 2. Next, after consuming the continuation markers for existing blocks, we look for new block starts (e.g. `>` for a block quote). If we encounter a new block start, we close any blocks unmatched in step 1 before creating the new block as a child of the last matched block. 3. Finally, we look at the remainder of the line (after block markers like `>`, list markers, and indentation have been consumed). This is text that can be incorporated into the last open block (a paragraph, code block, heading, or raw HTML). Setext headings are formed when we see a line of a paragraph that is a [setext heading underline]. Reference link definitions are detected when a paragraph is closed; the accumulated text lines are parsed to see if they begin with one or more reference link definitions. Any remainder becomes a normal paragraph. We can see how this works by considering how the tree above is generated by four lines of Markdown: ``` markdown > Lorem ipsum dolor sit amet. > - Qui *quodsi iracundia* > - aliquando id ``` At the outset, our document model is just ``` tree -> document ``` The first line of our text, ``` markdown > Lorem ipsum dolor ``` causes a `block_quote` block to be created as a child of our open `document` block, and a `paragraph` block as a child of the `block_quote`. Then the text is added to the last open block, the `paragraph`: ``` tree -> document -> block_quote -> paragraph "Lorem ipsum dolor" ``` The next line, ``` markdown sit amet. ``` is a "lazy continuation" of the open `paragraph`, so it gets added to the paragraph's text: ``` tree -> document -> block_quote -> paragraph "Lorem ipsum dolor\nsit amet." ``` The third line, ``` markdown > - Qui *quodsi iracundia* ``` causes the `paragraph` block to be closed, and a new `list` block opened as a child of the `block_quote`. A `list_item` is also added as a child of the `list`, and a `paragraph` as a child of the `list_item`. The text is then added to the new `paragraph`: ``` tree -> document -> block_quote paragraph "Lorem ipsum dolor\nsit amet." -> list (type=bullet tight=true bullet_char=-) -> list_item -> paragraph "Qui *quodsi iracundia*" ``` The fourth line, ``` markdown > - aliquando id ``` causes the `list_item` (and its child the `paragraph`) to be closed, and a new `list_item` opened up as child of the `list`. A `paragraph` is added as a child of the new `list_item`, to contain the text. We thus obtain the final tree: ``` tree -> document -> block_quote paragraph "Lorem ipsum dolor\nsit amet." -> list (type=bullet tight=true bullet_char=-) list_item paragraph "Qui *quodsi iracundia*" -> list_item -> paragraph "aliquando id" ``` ## Phase 2: inline structure Once all of the input has been parsed, all open blocks are closed. We then "walk the tree," visiting every node, and parse raw string contents of paragraphs and headings as inlines. At this point we have seen all the link reference definitions, so we can resolve reference links as we go. ``` tree document block_quote paragraph str "Lorem ipsum dolor" softbreak str "sit amet." list (type=bullet tight=true bullet_char=-) list_item paragraph str "Qui " emph str "quodsi iracundia" list_item paragraph str "aliquando id" ``` Notice how the [line ending] in the first paragraph has been parsed as a `softbreak`, and the asterisks in the first list item have become an `emph`. ### An algorithm for parsing nested emphasis and links By far the trickiest part of inline parsing is handling emphasis, strong emphasis, links, and images. This is done using the following algorithm. When we're parsing inlines and we hit either - a run of `*` or `_` characters, or - a `[` or `![` we insert a text node with these symbols as its literal content, and we add a pointer to this text node to the [delimiter stack](@). The [delimiter stack] is a doubly linked list. Each element contains a pointer to a text node, plus information about - the type of delimiter (`[`, `![`, `*`, `_`) - the number of delimiters, - whether the delimiter is "active" (all are active to start), and - whether the delimiter is a potential opener, a potential closer, or both (which depends on what sort of characters precede and follow the delimiters). When we hit a `]` character, we call the *look for link or image* procedure (see below). When we hit the end of the input, we call the *process emphasis* procedure (see below), with `stack_bottom` = NULL. #### *look for link or image* Starting at the top of the delimiter stack, we look backwards through the stack for an opening `[` or `![` delimiter. - If we don't find one, we return a literal text node `]`. - If we do find one, but it's not *active*, we remove the inactive delimiter from the stack, and return a literal text node `]`. - If we find one and it's active, then we parse ahead to see if we have an inline link/image, reference link/image, compact reference link/image, or shortcut reference link/image. + If we don't, then we remove the opening delimiter from the delimiter stack and return a literal text node `]`. + If we do, then * We return a link or image node whose children are the inlines after the text node pointed to by the opening delimiter. * We run *process emphasis* on these inlines, with the `[` opener as `stack_bottom`. * We remove the opening delimiter. * If we have a link (and not an image), we also set all `[` delimiters before the opening delimiter to *inactive*. (This will prevent us from getting links within links.) #### *process emphasis* Parameter `stack_bottom` sets a lower bound to how far we descend in the [delimiter stack]. If it is NULL, we can go all the way to the bottom. Otherwise, we stop before visiting `stack_bottom`. Let `current_position` point to the element on the [delimiter stack] just above `stack_bottom` (or the first element if `stack_bottom` is NULL). We keep track of the `openers_bottom` for each delimiter type (`*`, `_`) and each length of the closing delimiter run (modulo 3). Initialize this to `stack_bottom`. Then we repeat the following until we run out of potential closers: - Move `current_position` forward in the delimiter stack (if needed) until we find the first potential closer with delimiter `*` or `_`. (This will be the potential closer closest to the beginning of the input -- the first one in parse order.) - Now, look back in the stack (staying above `stack_bottom` and the `openers_bottom` for this delimiter type) for the first matching potential opener ("matching" means same delimiter). - If one is found: + Figure out whether we have emphasis or strong emphasis: if both closer and opener spans have length >= 2, we have strong, otherwise regular. + Insert an emph or strong emph node accordingly, after the text node corresponding to the opener. + Remove any delimiters between the opener and closer from the delimiter stack. + Remove 1 (for regular emph) or 2 (for strong emph) delimiters from the opening and closing text nodes. If they become empty as a result, remove them and remove the corresponding element of the delimiter stack. If the closing node is removed, reset `current_position` to the next element in the stack. - If none is found: + Set `openers_bottom` to the element before `current_position`. (We know that there are no openers for this kind of closer up to and including this point, so this puts a lower bound on future searches.) + If the closer at `current_position` is not a potential opener, remove it from the delimiter stack (since we know it can't be a closer either). + Advance `current_position` to the next element in the stack. After we're done, we remove all delimiters above `stack_bottom` from the delimiter stack. goldmark-1.7.4/_benchmark/cmark/cmark_benchmark.c000066400000000000000000000035671463655211100220030ustar00rootroot00000000000000#include #include #ifdef WIN32 # include #else # include # include #endif #include "cmark.h" #ifdef WIN32 double get_time() { LARGE_INTEGER t, f; QueryPerformanceCounter(&t); QueryPerformanceFrequency(&f); return (double)t.QuadPart/(double)f.QuadPart; } #else double get_time() { struct timeval t; struct timezone tzp; gettimeofday(&t, &tzp); return t.tv_sec + t.tv_usec*1e-6; } #endif int main(int argc, char **argv) { char *markdown_file; FILE *fp; size_t size; char *buf; char *html; double start, sum; int i, n; n = argc > 1 ? atoi(argv[1]) : 50; markdown_file = argc > 2 ? argv[2] : "_data.md"; fp = fopen(markdown_file,"r"); if(fp == NULL){ fprintf(stderr, "can not open %s", markdown_file); exit(1); } if(fseek(fp, 0, SEEK_END) != 0) { fprintf(stderr, "can not seek %s", markdown_file); exit(1); } if((size = ftell(fp)) < 0) { fprintf(stderr, "can not get size of %s", markdown_file); exit(1); } if(fseek(fp, 0, SEEK_SET) != 0) { fprintf(stderr, "can not seek %s", markdown_file); exit(1); } buf = malloc(sizeof(char) * size); if(buf == NULL) { fprintf(stderr, "can not allocate memory for %s", markdown_file); exit(1); } if(fread(buf, 1, size, fp) < size) { fprintf(stderr, "failed to read for %s", markdown_file); exit(1); } fclose(fp); for(i = 0; i < n; i++) { start = get_time(); html = cmark_markdown_to_html(buf, size, CMARK_OPT_UNSAFE); free(html); sum += get_time() - start; } printf("----------- cmark -----------\n"); printf("file: %s\n", markdown_file); printf("iteration: %d\n", n); printf("average: %.10f sec\n", sum / (double)n); free(buf); return 0; } goldmark-1.7.4/_benchmark/cmark/goldmark_benchmark.go000066400000000000000000000016121463655211100226560ustar00rootroot00000000000000package main import ( "bytes" "fmt" "io/ioutil" "os" "strconv" "time" "github.com/yuin/goldmark" "github.com/yuin/goldmark/renderer/html" ) func main() { n := 50 file := "_data.md" if len(os.Args) > 1 { n, _ = strconv.Atoi(os.Args[1]) } if len(os.Args) > 2 { file = os.Args[2] } source, err := ioutil.ReadFile(file) if err != nil { panic(err) } markdown := goldmark.New(goldmark.WithRendererOptions(html.WithXHTML(), html.WithUnsafe())) var out bytes.Buffer markdown.Convert([]byte(""), &out) sum := time.Duration(0) for i := 0; i < n; i++ { start := time.Now() out.Reset() if err := markdown.Convert(source, &out); err != nil { panic(err) } sum += time.Since(start) } fmt.Printf("------- goldmark -------\n") fmt.Printf("file: %s\n", file) fmt.Printf("iteration: %d\n", n) fmt.Printf("average: %.10f sec\n", float64((int64(sum)/int64(n)))/1000000000.0) } goldmark-1.7.4/_benchmark/go/000077500000000000000000000000001463655211100160255ustar00rootroot00000000000000goldmark-1.7.4/_benchmark/go/_data.md000066400000000000000000006136461463655211100174370ustar00rootroot00000000000000# Introduction ## What is Markdown? Markdown is a plain text format for writing structured documents, based on conventions for indicating formatting in email and usenet posts. It was developed by John Gruber (with help from Aaron Swartz) and released in 2004 in the form of a [syntax description](http://daringfireball.net/projects/markdown/syntax) and a Perl script (`Markdown.pl`) for converting Markdown to HTML. In the next decade, dozens of implementations were developed in many languages. Some extended the original Markdown syntax with conventions for footnotes, tables, and other document elements. Some allowed Markdown documents to be rendered in formats other than HTML. Websites like Reddit, StackOverflow, and GitHub had millions of people using Markdown. And Markdown started to be used beyond the web, to author books, articles, slide shows, letters, and lecture notes. What distinguishes Markdown from many other lightweight markup syntaxes, which are often easier to write, is its readability. As Gruber writes: > The overriding design goal for Markdown's formatting syntax is > to make it as readable as possible. The idea is that a > Markdown-formatted document should be publishable as-is, as > plain text, without looking like it's been marked up with tags > or formatting instructions. > () The point can be illustrated by comparing a sample of [AsciiDoc](http://www.methods.co.nz/asciidoc/) with an equivalent sample of Markdown. Here is a sample of AsciiDoc from the AsciiDoc manual: ``` 1. List item one. + List item one continued with a second paragraph followed by an Indented block. + ................. $ ls *.sh $ mv *.sh ~/tmp ................. + List item continued with a third paragraph. 2. List item two continued with an open block. + -- This paragraph is part of the preceding list item. a. This list is nested and does not require explicit item continuation. + This paragraph is part of the preceding list item. b. List item b. This paragraph belongs to item two of the outer list. -- ``` And here is the equivalent in Markdown: ``` 1. List item one. List item one continued with a second paragraph followed by an Indented block. $ ls *.sh $ mv *.sh ~/tmp List item continued with a third paragraph. 2. List item two continued with an open block. This paragraph is part of the preceding list item. 1. This list is nested and does not require explicit item continuation. This paragraph is part of the preceding list item. 2. List item b. This paragraph belongs to item two of the outer list. ``` The AsciiDoc version is, arguably, easier to write. You don't need to worry about indentation. But the Markdown version is much easier to read. The nesting of list items is apparent to the eye in the source, not just in the processed document. ## Why is a spec needed? John Gruber's [canonical description of Markdown's syntax](http://daringfireball.net/projects/markdown/syntax) does not specify the syntax unambiguously. Here are some examples of questions it does not answer: 1. How much indentation is needed for a sublist? The spec says that continuation paragraphs need to be indented four spaces, but is not fully explicit about sublists. It is natural to think that they, too, must be indented four spaces, but `Markdown.pl` does not require that. This is hardly a "corner case," and divergences between implementations on this issue often lead to surprises for users in real documents. (See [this comment by John Gruber](http://article.gmane.org/gmane.text.markdown.general/1997).) 2. Is a blank line needed before a block quote or heading? Most implementations do not require the blank line. However, this can lead to unexpected results in hard-wrapped text, and also to ambiguities in parsing (note that some implementations put the heading inside the blockquote, while others do not). (John Gruber has also spoken [in favor of requiring the blank lines](http://article.gmane.org/gmane.text.markdown.general/2146).) 3. Is a blank line needed before an indented code block? (`Markdown.pl` requires it, but this is not mentioned in the documentation, and some implementations do not require it.) ``` markdown paragraph code? ``` 4. What is the exact rule for determining when list items get wrapped in `

` tags? Can a list be partially "loose" and partially "tight"? What should we do with a list like this? ``` markdown 1. one 2. two 3. three ``` Or this? ``` markdown 1. one - a - b 2. two ``` (There are some relevant comments by John Gruber [here](http://article.gmane.org/gmane.text.markdown.general/2554).) 5. Can list markers be indented? Can ordered list markers be right-aligned? ``` markdown 8. item 1 9. item 2 10. item 2a ``` 6. Is this one list with a thematic break in its second item, or two lists separated by a thematic break? ``` markdown * a * * * * * * b ``` 7. When list markers change from numbers to bullets, do we have two lists or one? (The Markdown syntax description suggests two, but the perl scripts and many other implementations produce one.) ``` markdown 1. fee 2. fie - foe - fum ``` 8. What are the precedence rules for the markers of inline structure? For example, is the following a valid link, or does the code span take precedence ? ``` markdown [a backtick (`)](/url) and [another backtick (`)](/url). ``` 9. What are the precedence rules for markers of emphasis and strong emphasis? For example, how should the following be parsed? ``` markdown *foo *bar* baz* ``` 10. What are the precedence rules between block-level and inline-level structure? For example, how should the following be parsed? ``` markdown - `a long code span can contain a hyphen like this - and it can screw things up` ``` 11. Can list items include section headings? (`Markdown.pl` does not allow this, but does allow blockquotes to include headings.) ``` markdown - # Heading ``` 12. Can list items be empty? ``` markdown * a * * b ``` 13. Can link references be defined inside block quotes or list items? ``` markdown > Blockquote [foo]. > > [foo]: /url ``` 14. If there are multiple definitions for the same reference, which takes precedence? ``` markdown [foo]: /url1 [foo]: /url2 [foo][] ``` In the absence of a spec, early implementers consulted `Markdown.pl` to resolve these ambiguities. But `Markdown.pl` was quite buggy, and gave manifestly bad results in many cases, so it was not a satisfactory replacement for a spec. Because there is no unambiguous spec, implementations have diverged considerably. As a result, users are often surprised to find that a document that renders one way on one system (say, a GitHub wiki) renders differently on another (say, converting to docbook using pandoc). To make matters worse, because nothing in Markdown counts as a "syntax error," the divergence often isn't discovered right away. ## About this document This document attempts to specify Markdown syntax unambiguously. It contains many examples with side-by-side Markdown and HTML. These are intended to double as conformance tests. An accompanying script `spec_tests.py` can be used to run the tests against any Markdown program: python test/spec_tests.py --spec spec.txt --program PROGRAM Since this document describes how Markdown is to be parsed into an abstract syntax tree, it would have made sense to use an abstract representation of the syntax tree instead of HTML. But HTML is capable of representing the structural distinctions we need to make, and the choice of HTML for the tests makes it possible to run the tests against an implementation without writing an abstract syntax tree renderer. This document is generated from a text file, `spec.txt`, written in Markdown with a small extension for the side-by-side tests. The script `tools/makespec.py` can be used to convert `spec.txt` into HTML or CommonMark (which can then be converted into other formats). In the examples, the `→` character is used to represent tabs. # Preliminaries ## Characters and lines Any sequence of [characters] is a valid CommonMark document. A [character](@) is a Unicode code point. Although some code points (for example, combining accents) do not correspond to characters in an intuitive sense, all code points count as characters for purposes of this spec. This spec does not specify an encoding; it thinks of lines as composed of [characters] rather than bytes. A conforming parser may be limited to a certain encoding. A [line](@) is a sequence of zero or more [characters] other than newline (`U+000A`) or carriage return (`U+000D`), followed by a [line ending] or by the end of file. A [line ending](@) is a newline (`U+000A`), a carriage return (`U+000D`) not followed by a newline, or a carriage return and a following newline. A line containing no characters, or a line containing only spaces (`U+0020`) or tabs (`U+0009`), is called a [blank line](@). The following definitions of character classes will be used in this spec: A [whitespace character](@) is a space (`U+0020`), tab (`U+0009`), newline (`U+000A`), line tabulation (`U+000B`), form feed (`U+000C`), or carriage return (`U+000D`). [Whitespace](@) is a sequence of one or more [whitespace characters]. A [Unicode whitespace character](@) is any code point in the Unicode `Zs` general category, or a tab (`U+0009`), carriage return (`U+000D`), newline (`U+000A`), or form feed (`U+000C`). [Unicode whitespace](@) is a sequence of one or more [Unicode whitespace characters]. A [space](@) is `U+0020`. A [non-whitespace character](@) is any character that is not a [whitespace character]. An [ASCII punctuation character](@) is `!`, `"`, `#`, `$`, `%`, `&`, `'`, `(`, `)`, `*`, `+`, `,`, `-`, `.`, `/` (U+0021–2F), `:`, `;`, `<`, `=`, `>`, `?`, `@` (U+003A–0040), `[`, `\`, `]`, `^`, `_`, `` ` `` (U+005B–0060), `{`, `|`, `}`, or `~` (U+007B–007E). A [punctuation character](@) is an [ASCII punctuation character] or anything in the general Unicode categories `Pc`, `Pd`, `Pe`, `Pf`, `Pi`, `Po`, or `Ps`. ## Tabs Tabs in lines are not expanded to [spaces]. However, in contexts where whitespace helps to define block structure, tabs behave as if they were replaced by spaces with a tab stop of 4 characters. Thus, for example, a tab can be used instead of four spaces in an indented code block. (Note, however, that internal tabs are passed through as literal tabs, not expanded to spaces.) ```````````````````````````````` example →foo→baz→→bim .

foo→baz→→bim
```````````````````````````````` ```````````````````````````````` example →foo→baz→→bim .
foo→baz→→bim
```````````````````````````````` ```````````````````````````````` example a→a ὐ→a .
a→a
ὐ→a
```````````````````````````````` In the following example, a continuation paragraph of a list item is indented with a tab; this has exactly the same effect as indentation with four spaces would: ```````````````````````````````` example - foo →bar .
  • foo

    bar

```````````````````````````````` ```````````````````````````````` example - foo →→bar .
  • foo

      bar
    
```````````````````````````````` Normally the `>` that begins a block quote may be followed optionally by a space, which is not considered part of the content. In the following case `>` is followed by a tab, which is treated as if it were expanded into three spaces. Since one of these spaces is considered part of the delimiter, `foo` is considered to be indented six spaces inside the block quote context, so we get an indented code block starting with two spaces. ```````````````````````````````` example >→→foo .
  foo
```````````````````````````````` ```````````````````````````````` example -→→foo .
  •   foo
    
```````````````````````````````` ```````````````````````````````` example foo →bar .
foo
bar
```````````````````````````````` ```````````````````````````````` example - foo - bar → - baz .
  • foo
    • bar
      • baz
```````````````````````````````` ```````````````````````````````` example #→Foo .

Foo

```````````````````````````````` ```````````````````````````````` example *→*→*→ .
```````````````````````````````` ## Insecure characters For security reasons, the Unicode character `U+0000` must be replaced with the REPLACEMENT CHARACTER (`U+FFFD`). # Blocks and inlines We can think of a document as a sequence of [blocks](@)---structural elements like paragraphs, block quotations, lists, headings, rules, and code blocks. Some blocks (like block quotes and list items) contain other blocks; others (like headings and paragraphs) contain [inline](@) content---text, links, emphasized text, images, code spans, and so on. ## Precedence Indicators of block structure always take precedence over indicators of inline structure. So, for example, the following is a list with two items, not a list with one item containing a code span: ```````````````````````````````` example - `one - two` .
  • `one
  • two`
```````````````````````````````` This means that parsing can proceed in two steps: first, the block structure of the document can be discerned; second, text lines inside paragraphs, headings, and other block constructs can be parsed for inline structure. The second step requires information about link reference definitions that will be available only at the end of the first step. Note that the first step requires processing lines in sequence, but the second can be parallelized, since the inline parsing of one block element does not affect the inline parsing of any other. ## Container blocks and leaf blocks We can divide blocks into two types: [container blocks](@), which can contain other blocks, and [leaf blocks](@), which cannot. # Leaf blocks This section describes the different kinds of leaf block that make up a Markdown document. ## Thematic breaks A line consisting of 0-3 spaces of indentation, followed by a sequence of three or more matching `-`, `_`, or `*` characters, each followed optionally by any number of spaces or tabs, forms a [thematic break](@). ```````````````````````````````` example *** --- ___ .


```````````````````````````````` Wrong characters: ```````````````````````````````` example +++ .

+++

```````````````````````````````` ```````````````````````````````` example === .

===

```````````````````````````````` Not enough characters: ```````````````````````````````` example -- ** __ .

-- ** __

```````````````````````````````` One to three spaces indent are allowed: ```````````````````````````````` example *** *** *** .


```````````````````````````````` Four spaces is too many: ```````````````````````````````` example *** .
***
```````````````````````````````` ```````````````````````````````` example Foo *** .

Foo ***

```````````````````````````````` More than three characters may be used: ```````````````````````````````` example _____________________________________ .
```````````````````````````````` Spaces are allowed between the characters: ```````````````````````````````` example - - - .
```````````````````````````````` ```````````````````````````````` example ** * ** * ** * ** .
```````````````````````````````` ```````````````````````````````` example - - - - .
```````````````````````````````` Spaces are allowed at the end: ```````````````````````````````` example - - - - .
```````````````````````````````` However, no other characters may occur in the line: ```````````````````````````````` example _ _ _ _ a a------ ---a--- .

_ _ _ _ a

a------

---a---

```````````````````````````````` It is required that all of the [non-whitespace characters] be the same. So, this is not a thematic break: ```````````````````````````````` example *-* .

-

```````````````````````````````` Thematic breaks do not need blank lines before or after: ```````````````````````````````` example - foo *** - bar .
  • foo

  • bar
```````````````````````````````` Thematic breaks can interrupt a paragraph: ```````````````````````````````` example Foo *** bar .

Foo


bar

```````````````````````````````` If a line of dashes that meets the above conditions for being a thematic break could also be interpreted as the underline of a [setext heading], the interpretation as a [setext heading] takes precedence. Thus, for example, this is a setext heading, not a paragraph followed by a thematic break: ```````````````````````````````` example Foo --- bar .

Foo

bar

```````````````````````````````` When both a thematic break and a list item are possible interpretations of a line, the thematic break takes precedence: ```````````````````````````````` example * Foo * * * * Bar .
  • Foo

  • Bar
```````````````````````````````` If you want a thematic break in a list item, use a different bullet: ```````````````````````````````` example - Foo - * * * .
  • Foo

```````````````````````````````` ## ATX headings An [ATX heading](@) consists of a string of characters, parsed as inline content, between an opening sequence of 1--6 unescaped `#` characters and an optional closing sequence of any number of unescaped `#` characters. The opening sequence of `#` characters must be followed by a [space] or by the end of line. The optional closing sequence of `#`s must be preceded by a [space] and may be followed by spaces only. The opening `#` character may be indented 0-3 spaces. The raw contents of the heading are stripped of leading and trailing spaces before being parsed as inline content. The heading level is equal to the number of `#` characters in the opening sequence. Simple headings: ```````````````````````````````` example # foo ## foo ### foo #### foo ##### foo ###### foo .

foo

foo

foo

foo

foo
foo
```````````````````````````````` More than six `#` characters is not a heading: ```````````````````````````````` example ####### foo .

####### foo

```````````````````````````````` At least one space is required between the `#` characters and the heading's contents, unless the heading is empty. Note that many implementations currently do not require the space. However, the space was required by the [original ATX implementation](http://www.aaronsw.com/2002/atx/atx.py), and it helps prevent things like the following from being parsed as headings: ```````````````````````````````` example #5 bolt #hashtag .

#5 bolt

#hashtag

```````````````````````````````` This is not a heading, because the first `#` is escaped: ```````````````````````````````` example \## foo .

## foo

```````````````````````````````` Contents are parsed as inlines: ```````````````````````````````` example # foo *bar* \*baz\* .

foo bar *baz*

```````````````````````````````` Leading and trailing [whitespace] is ignored in parsing inline content: ```````````````````````````````` example # foo .

foo

```````````````````````````````` One to three spaces indentation are allowed: ```````````````````````````````` example ### foo ## foo # foo .

foo

foo

foo

```````````````````````````````` Four spaces are too much: ```````````````````````````````` example # foo .
# foo
```````````````````````````````` ```````````````````````````````` example foo # bar .

foo # bar

```````````````````````````````` A closing sequence of `#` characters is optional: ```````````````````````````````` example ## foo ## ### bar ### .

foo

bar

```````````````````````````````` It need not be the same length as the opening sequence: ```````````````````````````````` example # foo ################################## ##### foo ## .

foo

foo
```````````````````````````````` Spaces are allowed after the closing sequence: ```````````````````````````````` example ### foo ### .

foo

```````````````````````````````` A sequence of `#` characters with anything but [spaces] following it is not a closing sequence, but counts as part of the contents of the heading: ```````````````````````````````` example ### foo ### b .

foo ### b

```````````````````````````````` The closing sequence must be preceded by a space: ```````````````````````````````` example # foo# .

foo#

```````````````````````````````` Backslash-escaped `#` characters do not count as part of the closing sequence: ```````````````````````````````` example ### foo \### ## foo #\## # foo \# .

foo ###

foo ###

foo #

```````````````````````````````` ATX headings need not be separated from surrounding content by blank lines, and they can interrupt paragraphs: ```````````````````````````````` example **** ## foo **** .

foo


```````````````````````````````` ```````````````````````````````` example Foo bar # baz Bar foo .

Foo bar

baz

Bar foo

```````````````````````````````` ATX headings can be empty: ```````````````````````````````` example ## # ### ### .

```````````````````````````````` ## Setext headings A [setext heading](@) consists of one or more lines of text, each containing at least one [non-whitespace character], with no more than 3 spaces indentation, followed by a [setext heading underline]. The lines of text must be such that, were they not followed by the setext heading underline, they would be interpreted as a paragraph: they cannot be interpretable as a [code fence], [ATX heading][ATX headings], [block quote][block quotes], [thematic break][thematic breaks], [list item][list items], or [HTML block][HTML blocks]. A [setext heading underline](@) is a sequence of `=` characters or a sequence of `-` characters, with no more than 3 spaces indentation and any number of trailing spaces. If a line containing a single `-` can be interpreted as an empty [list items], it should be interpreted this way and not as a [setext heading underline]. The heading is a level 1 heading if `=` characters are used in the [setext heading underline], and a level 2 heading if `-` characters are used. The contents of the heading are the result of parsing the preceding lines of text as CommonMark inline content. In general, a setext heading need not be preceded or followed by a blank line. However, it cannot interrupt a paragraph, so when a setext heading comes after a paragraph, a blank line is needed between them. Simple examples: ```````````````````````````````` example Foo *bar* ========= Foo *bar* --------- .

Foo bar

Foo bar

```````````````````````````````` The content of the header may span more than one line: ```````````````````````````````` example Foo *bar baz* ==== .

Foo bar baz

```````````````````````````````` The contents are the result of parsing the headings's raw content as inlines. The heading's raw content is formed by concatenating the lines and removing initial and final [whitespace]. ```````````````````````````````` example Foo *bar baz*→ ==== .

Foo bar baz

```````````````````````````````` The underlining can be any length: ```````````````````````````````` example Foo ------------------------- Foo = .

Foo

Foo

```````````````````````````````` The heading content can be indented up to three spaces, and need not line up with the underlining: ```````````````````````````````` example Foo --- Foo ----- Foo === .

Foo

Foo

Foo

```````````````````````````````` Four spaces indent is too much: ```````````````````````````````` example Foo --- Foo --- .
Foo
---

Foo

```````````````````````````````` The setext heading underline can be indented up to three spaces, and may have trailing spaces: ```````````````````````````````` example Foo ---- .

Foo

```````````````````````````````` Four spaces is too much: ```````````````````````````````` example Foo --- .

Foo ---

```````````````````````````````` The setext heading underline cannot contain internal spaces: ```````````````````````````````` example Foo = = Foo --- - .

Foo = =

Foo


```````````````````````````````` Trailing spaces in the content line do not cause a line break: ```````````````````````````````` example Foo ----- .

Foo

```````````````````````````````` Nor does a backslash at the end: ```````````````````````````````` example Foo\ ---- .

Foo\

```````````````````````````````` Since indicators of block structure take precedence over indicators of inline structure, the following are setext headings: ```````````````````````````````` example `Foo ---- `
.

`Foo

`

<a title="a lot

of dashes"/>

```````````````````````````````` The setext heading underline cannot be a [lazy continuation line] in a list item or block quote: ```````````````````````````````` example > Foo --- .

Foo


```````````````````````````````` ```````````````````````````````` example > foo bar === .

foo bar ===

```````````````````````````````` ```````````````````````````````` example - Foo --- .
  • Foo

```````````````````````````````` A blank line is needed between a paragraph and a following setext heading, since otherwise the paragraph becomes part of the heading's content: ```````````````````````````````` example Foo Bar --- .

Foo Bar

```````````````````````````````` But in general a blank line is not required before or after setext headings: ```````````````````````````````` example --- Foo --- Bar --- Baz .

Foo

Bar

Baz

```````````````````````````````` Setext headings cannot be empty: ```````````````````````````````` example ==== .

====

```````````````````````````````` Setext heading text lines must not be interpretable as block constructs other than paragraphs. So, the line of dashes in these examples gets interpreted as a thematic break: ```````````````````````````````` example --- --- .

```````````````````````````````` ```````````````````````````````` example - foo ----- .
  • foo

```````````````````````````````` ```````````````````````````````` example foo --- .
foo

```````````````````````````````` ```````````````````````````````` example > foo ----- .

foo


```````````````````````````````` If you want a heading with `> foo` as its literal text, you can use backslash escapes: ```````````````````````````````` example \> foo ------ .

> foo

```````````````````````````````` **Compatibility note:** Most existing Markdown implementations do not allow the text of setext headings to span multiple lines. But there is no consensus about how to interpret ``` markdown Foo bar --- baz ``` One can find four different interpretations: 1. paragraph "Foo", heading "bar", paragraph "baz" 2. paragraph "Foo bar", thematic break, paragraph "baz" 3. paragraph "Foo bar --- baz" 4. heading "Foo bar", paragraph "baz" We find interpretation 4 most natural, and interpretation 4 increases the expressive power of CommonMark, by allowing multiline headings. Authors who want interpretation 1 can put a blank line after the first paragraph: ```````````````````````````````` example Foo bar --- baz .

Foo

bar

baz

```````````````````````````````` Authors who want interpretation 2 can put blank lines around the thematic break, ```````````````````````````````` example Foo bar --- baz .

Foo bar


baz

```````````````````````````````` or use a thematic break that cannot count as a [setext heading underline], such as ```````````````````````````````` example Foo bar * * * baz .

Foo bar


baz

```````````````````````````````` Authors who want interpretation 3 can use backslash escapes: ```````````````````````````````` example Foo bar \--- baz .

Foo bar --- baz

```````````````````````````````` ## Indented code blocks An [indented code block](@) is composed of one or more [indented chunks] separated by blank lines. An [indented chunk](@) is a sequence of non-blank lines, each indented four or more spaces. The contents of the code block are the literal contents of the lines, including trailing [line endings], minus four spaces of indentation. An indented code block has no [info string]. An indented code block cannot interrupt a paragraph, so there must be a blank line between a paragraph and a following indented code block. (A blank line is not needed, however, between a code block and a following paragraph.) ```````````````````````````````` example a simple indented code block .
a simple
  indented code block
```````````````````````````````` If there is any ambiguity between an interpretation of indentation as a code block and as indicating that material belongs to a [list item][list items], the list item interpretation takes precedence: ```````````````````````````````` example - foo bar .
  • foo

    bar

```````````````````````````````` ```````````````````````````````` example 1. foo - bar .
  1. foo

    • bar
```````````````````````````````` The contents of a code block are literal text, and do not get parsed as Markdown: ```````````````````````````````` example
*hi* - one .
<a/>
*hi*

- one
```````````````````````````````` Here we have three chunks separated by blank lines: ```````````````````````````````` example chunk1 chunk2 chunk3 .
chunk1

chunk2



chunk3
```````````````````````````````` Any initial spaces beyond four will be included in the content, even in interior blank lines: ```````````````````````````````` example chunk1 chunk2 .
chunk1
  
  chunk2
```````````````````````````````` An indented code block cannot interrupt a paragraph. (This allows hanging indents and the like.) ```````````````````````````````` example Foo bar .

Foo bar

```````````````````````````````` However, any non-blank line with fewer than four leading spaces ends the code block immediately. So a paragraph may occur immediately after indented code: ```````````````````````````````` example foo bar .
foo

bar

```````````````````````````````` And indented code can occur immediately before and after other kinds of blocks: ```````````````````````````````` example # Heading foo Heading ------ foo ---- .

Heading

foo

Heading

foo

```````````````````````````````` The first line can be indented more than four spaces: ```````````````````````````````` example foo bar .
    foo
bar
```````````````````````````````` Blank lines preceding or following an indented code block are not included in it: ```````````````````````````````` example foo .
foo
```````````````````````````````` Trailing spaces are included in the code block's content: ```````````````````````````````` example foo .
foo  
```````````````````````````````` ## Fenced code blocks A [code fence](@) is a sequence of at least three consecutive backtick characters (`` ` ``) or tildes (`~`). (Tildes and backticks cannot be mixed.) A [fenced code block](@) begins with a code fence, indented no more than three spaces. The line with the opening code fence may optionally contain some text following the code fence; this is trimmed of leading and trailing whitespace and called the [info string](@). If the [info string] comes after a backtick fence, it may not contain any backtick characters. (The reason for this restriction is that otherwise some inline code would be incorrectly interpreted as the beginning of a fenced code block.) The content of the code block consists of all subsequent lines, until a closing [code fence] of the same type as the code block began with (backticks or tildes), and with at least as many backticks or tildes as the opening code fence. If the leading code fence is indented N spaces, then up to N spaces of indentation are removed from each line of the content (if present). (If a content line is not indented, it is preserved unchanged. If it is indented less than N spaces, all of the indentation is removed.) The closing code fence may be indented up to three spaces, and may be followed only by spaces, which are ignored. If the end of the containing block (or document) is reached and no closing code fence has been found, the code block contains all of the lines after the opening code fence until the end of the containing block (or document). (An alternative spec would require backtracking in the event that a closing code fence is not found. But this makes parsing much less efficient, and there seems to be no real down side to the behavior described here.) A fenced code block may interrupt a paragraph, and does not require a blank line either before or after. The content of a code fence is treated as literal text, not parsed as inlines. The first word of the [info string] is typically used to specify the language of the code sample, and rendered in the `class` attribute of the `code` tag. However, this spec does not mandate any particular treatment of the [info string]. Here is a simple example with backticks: ```````````````````````````````` example ``` < > ``` .
<
 >
```````````````````````````````` With tildes: ```````````````````````````````` example ~~~ < > ~~~ .
<
 >
```````````````````````````````` Fewer than three backticks is not enough: ```````````````````````````````` example `` foo `` .

foo

```````````````````````````````` The closing code fence must use the same character as the opening fence: ```````````````````````````````` example ``` aaa ~~~ ``` .
aaa
~~~
```````````````````````````````` ```````````````````````````````` example ~~~ aaa ``` ~~~ .
aaa
```
```````````````````````````````` The closing code fence must be at least as long as the opening fence: ```````````````````````````````` example ```` aaa ``` `````` .
aaa
```
```````````````````````````````` ```````````````````````````````` example ~~~~ aaa ~~~ ~~~~ .
aaa
~~~
```````````````````````````````` Unclosed code blocks are closed by the end of the document (or the enclosing [block quote][block quotes] or [list item][list items]): ```````````````````````````````` example ``` .
```````````````````````````````` ```````````````````````````````` example ````` ``` aaa .

```
aaa
```````````````````````````````` ```````````````````````````````` example > ``` > aaa bbb .
aaa

bbb

```````````````````````````````` A code block can have all empty lines as its content: ```````````````````````````````` example ``` ``` .

  
```````````````````````````````` A code block can be empty: ```````````````````````````````` example ``` ``` .
```````````````````````````````` Fences can be indented. If the opening fence is indented, content lines will have equivalent opening indentation removed, if present: ```````````````````````````````` example ``` aaa aaa ``` .
aaa
aaa
```````````````````````````````` ```````````````````````````````` example ``` aaa aaa aaa ``` .
aaa
aaa
aaa
```````````````````````````````` ```````````````````````````````` example ``` aaa aaa aaa ``` .
aaa
 aaa
aaa
```````````````````````````````` Four spaces indentation produces an indented code block: ```````````````````````````````` example ``` aaa ``` .
```
aaa
```
```````````````````````````````` Closing fences may be indented by 0-3 spaces, and their indentation need not match that of the opening fence: ```````````````````````````````` example ``` aaa ``` .
aaa
```````````````````````````````` ```````````````````````````````` example ``` aaa ``` .
aaa
```````````````````````````````` This is not a closing fence, because it is indented 4 spaces: ```````````````````````````````` example ``` aaa ``` .
aaa
    ```
```````````````````````````````` Code fences (opening and closing) cannot contain internal spaces: ```````````````````````````````` example ``` ``` aaa .

aaa

```````````````````````````````` ```````````````````````````````` example ~~~~~~ aaa ~~~ ~~ .
aaa
~~~ ~~
```````````````````````````````` Fenced code blocks can interrupt paragraphs, and can be followed directly by paragraphs, without a blank line between: ```````````````````````````````` example foo ``` bar ``` baz .

foo

bar

baz

```````````````````````````````` Other blocks can also occur before and after fenced code blocks without an intervening blank line: ```````````````````````````````` example foo --- ~~~ bar ~~~ # baz .

foo

bar

baz

```````````````````````````````` An [info string] can be provided after the opening code fence. Although this spec doesn't mandate any particular treatment of the info string, the first word is typically used to specify the language of the code block. In HTML output, the language is normally indicated by adding a class to the `code` element consisting of `language-` followed by the language name. ```````````````````````````````` example ```ruby def foo(x) return 3 end ``` .
def foo(x)
  return 3
end
```````````````````````````````` ```````````````````````````````` example ~~~~ ruby startline=3 $%@#$ def foo(x) return 3 end ~~~~~~~ .
def foo(x)
  return 3
end
```````````````````````````````` ```````````````````````````````` example ````; ```` .
```````````````````````````````` [Info strings] for backtick code blocks cannot contain backticks: ```````````````````````````````` example ``` aa ``` foo .

aa foo

```````````````````````````````` [Info strings] for tilde code blocks can contain backticks and tildes: ```````````````````````````````` example ~~~ aa ``` ~~~ foo ~~~ .
foo
```````````````````````````````` Closing code fences cannot have [info strings]: ```````````````````````````````` example ``` ``` aaa ``` .
``` aaa
```````````````````````````````` ## HTML blocks An [HTML block](@) is a group of lines that is treated as raw HTML (and will not be escaped in HTML output). There are seven kinds of [HTML block], which can be defined by their start and end conditions. The block begins with a line that meets a [start condition](@) (after up to three spaces optional indentation). It ends with the first subsequent line that meets a matching [end condition](@), or the last line of the document, or the last line of the [container block](#container-blocks) containing the current HTML block, if no line is encountered that meets the [end condition]. If the first line meets both the [start condition] and the [end condition], the block will contain just that line. 1. **Start condition:** line begins with the string ``, or the end of the line.\ **End condition:** line contains an end tag ``, `
`, or `` (case-insensitive; it need not match the start tag). 2. **Start condition:** line begins with the string ``. 3. **Start condition:** line begins with the string ``. 4. **Start condition:** line begins with the string ``. 5. **Start condition:** line begins with the string ``. 6. **Start condition:** line begins the string `<` or ``, or the string `/>`.\ **End condition:** line is followed by a [blank line]. 7. **Start condition:** line begins with a complete [open tag] (with any [tag name] other than `script`, `style`, or `pre`) or a complete [closing tag], followed only by [whitespace] or the end of the line.\ **End condition:** line is followed by a [blank line]. HTML blocks continue until they are closed by their appropriate [end condition], or the last line of the document or other [container block](#container-blocks). This means any HTML **within an HTML block** that might otherwise be recognised as a start condition will be ignored by the parser and passed through as-is, without changing the parser's state. For instance, `
` within a HTML block started by `` will not affect
the parser state; as the HTML block was started in by start condition 6, it
will end at any blank line. This can be surprising:

```````````````````````````````` example
**Hello**,

_world_.
.
**Hello**,

world.

```````````````````````````````` In this case, the HTML block is terminated by the newline — the `**Hello**` text remains verbatim — and regular parsing resumes, with a paragraph, emphasised `world` and inline and block HTML following. All types of [HTML blocks] except type 7 may interrupt a paragraph. Blocks of type 7 may not interrupt a paragraph. (This restriction is intended to prevent unwanted interpretation of long tags inside a wrapped paragraph as starting HTML blocks.) Some simple examples follow. Here are some basic HTML blocks of type 6: ```````````````````````````````` example
hi
okay. .
hi

okay.

```````````````````````````````` ```````````````````````````````` example
*foo* ```````````````````````````````` Here we have two HTML blocks with a Markdown paragraph between them: ```````````````````````````````` example
*Markdown*
.

Markdown

```````````````````````````````` The tag on the first line can be partial, as long as it is split where there would be whitespace: ```````````````````````````````` example
.
```````````````````````````````` ```````````````````````````````` example
.
```````````````````````````````` An open tag need not be closed: ```````````````````````````````` example
*foo* *bar* .
*foo*

bar

```````````````````````````````` A partial tag need not even be completed (garbage in, garbage out): ```````````````````````````````` example
. ```````````````````````````````` ```````````````````````````````` example
foo
.
foo
```````````````````````````````` Everything until the next blank line or end of document gets included in the HTML block. So, in the following example, what looks like a Markdown code block is actually part of the HTML block, which continues until a blank line or the end of the document is reached: ```````````````````````````````` example
``` c int x = 33; ``` .
``` c int x = 33; ``` ```````````````````````````````` To start an [HTML block] with a tag that is *not* in the list of block-level tags in (6), you must put the tag by itself on the first line (and it must be complete): ```````````````````````````````` example *bar* . *bar* ```````````````````````````````` In type 7 blocks, the [tag name] can be anything: ```````````````````````````````` example *bar* . *bar* ```````````````````````````````` ```````````````````````````````` example *bar* . *bar* ```````````````````````````````` ```````````````````````````````` example *bar* . *bar* ```````````````````````````````` These rules are designed to allow us to work with tags that can function as either block-level or inline-level tags. The `` tag is a nice example. We can surround content with `` tags in three different ways. In this case, we get a raw HTML block, because the `` tag is on a line by itself: ```````````````````````````````` example *foo* . *foo* ```````````````````````````````` In this case, we get a raw HTML block that just includes the `` tag (because it ends with the following blank line). So the contents get interpreted as CommonMark: ```````````````````````````````` example *foo* .

foo

```````````````````````````````` Finally, in this case, the `` tags are interpreted as [raw HTML] *inside* the CommonMark paragraph. (Because the tag is not on a line by itself, we get inline HTML rather than an [HTML block].) ```````````````````````````````` example *foo* .

foo

```````````````````````````````` HTML tags designed to contain literal content (`script`, `style`, `pre`), comments, processing instructions, and declarations are treated somewhat differently. Instead of ending at the first blank line, these blocks end at the first line containing a corresponding end tag. As a result, these blocks can contain blank lines: A pre tag (type 1): ```````````````````````````````` example

import Text.HTML.TagSoup

main :: IO ()
main = print $ parseTags tags
okay .

import Text.HTML.TagSoup

main :: IO ()
main = print $ parseTags tags

okay

```````````````````````````````` A script tag (type 1): ```````````````````````````````` example okay .

okay

```````````````````````````````` A style tag (type 1): ```````````````````````````````` example okay .

okay

```````````````````````````````` If there is no matching end tag, the block will end at the end of the document (or the enclosing [block quote][block quotes] or [list item][list items]): ```````````````````````````````` example *foo* .

foo

```````````````````````````````` ```````````````````````````````` example *bar* *baz* . *bar*

baz

```````````````````````````````` Note that anything on the last line after the end tag will be included in the [HTML block]: ```````````````````````````````` example 1. *bar* . 1. *bar* ```````````````````````````````` A comment (type 2): ```````````````````````````````` example okay .

okay

```````````````````````````````` A processing instruction (type 3): ```````````````````````````````` example '; ?> okay . '; ?>

okay

```````````````````````````````` A declaration (type 4): ```````````````````````````````` example . ```````````````````````````````` CDATA (type 5): ```````````````````````````````` example okay .

okay

```````````````````````````````` The opening tag can be indented 1-3 spaces, but not 4: ```````````````````````````````` example .
<!-- foo -->
```````````````````````````````` ```````````````````````````````` example
.
<div>
```````````````````````````````` An HTML block of types 1--6 can interrupt a paragraph, and need not be preceded by a blank line. ```````````````````````````````` example Foo
bar
.

Foo

bar
```````````````````````````````` However, a following blank line is needed, except at the end of a document, and except for blocks of types 1--5, [above][HTML block]: ```````````````````````````````` example
bar
*foo* .
bar
*foo* ```````````````````````````````` HTML blocks of type 7 cannot interrupt a paragraph: ```````````````````````````````` example Foo baz .

Foo baz

```````````````````````````````` This rule differs from John Gruber's original Markdown syntax specification, which says: > The only restrictions are that block-level HTML elements — > e.g. `
`, ``, `
`, `

`, etc. — must be separated from > surrounding content by blank lines, and the start and end tags of the > block should not be indented with tabs or spaces. In some ways Gruber's rule is more restrictive than the one given here: - It requires that an HTML block be preceded by a blank line. - It does not allow the start tag to be indented. - It requires a matching end tag, which it also does not allow to be indented. Most Markdown implementations (including some of Gruber's own) do not respect all of these restrictions. There is one respect, however, in which Gruber's rule is more liberal than the one given here, since it allows blank lines to occur inside an HTML block. There are two reasons for disallowing them here. First, it removes the need to parse balanced tags, which is expensive and can require backtracking from the end of the document if no matching end tag is found. Second, it provides a very simple and flexible way of including Markdown content inside HTML tags: simply separate the Markdown from the HTML using blank lines: Compare: ```````````````````````````````` example

*Emphasized* text.
.

Emphasized text.

```````````````````````````````` ```````````````````````````````` example
*Emphasized* text.
.
*Emphasized* text.
```````````````````````````````` Some Markdown implementations have adopted a convention of interpreting content inside tags as text if the open tag has the attribute `markdown=1`. The rule given above seems a simpler and more elegant way of achieving the same expressive power, which is also much simpler to parse. The main potential drawback is that one can no longer paste HTML blocks into Markdown documents with 100% reliability. However, *in most cases* this will work fine, because the blank lines in HTML are usually followed by HTML block tags. For example: ```````````````````````````````` example
Hi
.
Hi
```````````````````````````````` There are problems, however, if the inner tags are indented *and* separated by spaces, as then they will be interpreted as an indented code block: ```````````````````````````````` example
Hi
.
<td>
  Hi
</td>
```````````````````````````````` Fortunately, blank lines are usually not necessary and can be deleted. The exception is inside `
` tags, but as described
[above][HTML blocks], raw HTML blocks starting with `
`
*can* contain blank lines.

## Link reference definitions

A [link reference definition](@)
consists of a [link label], indented up to three spaces, followed
by a colon (`:`), optional [whitespace] (including up to one
[line ending]), a [link destination],
optional [whitespace] (including up to one
[line ending]), and an optional [link
title], which if it is present must be separated
from the [link destination] by [whitespace].
No further [non-whitespace characters] may occur on the line.

A [link reference definition]
does not correspond to a structural element of a document.  Instead, it
defines a label which can be used in [reference links]
and reference-style [images] elsewhere in the document.  [Link
reference definitions] can come either before or after the links that use
them.

```````````````````````````````` example
[foo]: /url "title"

[foo]
.

foo

```````````````````````````````` ```````````````````````````````` example [foo]: /url 'the title' [foo] .

foo

```````````````````````````````` ```````````````````````````````` example [Foo*bar\]]:my_(url) 'title (with parens)' [Foo*bar\]] .

Foo*bar]

```````````````````````````````` ```````````````````````````````` example [Foo bar]: 'title' [Foo bar] .

Foo bar

```````````````````````````````` The title may extend over multiple lines: ```````````````````````````````` example [foo]: /url ' title line1 line2 ' [foo] .

foo

```````````````````````````````` However, it may not contain a [blank line]: ```````````````````````````````` example [foo]: /url 'title with blank line' [foo] .

[foo]: /url 'title

with blank line'

[foo]

```````````````````````````````` The title may be omitted: ```````````````````````````````` example [foo]: /url [foo] .

foo

```````````````````````````````` The link destination may not be omitted: ```````````````````````````````` example [foo]: [foo] .

[foo]:

[foo]

```````````````````````````````` However, an empty link destination may be specified using angle brackets: ```````````````````````````````` example [foo]: <> [foo] .

foo

```````````````````````````````` The title must be separated from the link destination by whitespace: ```````````````````````````````` example [foo]: (baz) [foo] .

[foo]: (baz)

[foo]

```````````````````````````````` Both title and destination can contain backslash escapes and literal backslashes: ```````````````````````````````` example [foo]: /url\bar\*baz "foo\"bar\baz" [foo] .

foo

```````````````````````````````` A link can come before its corresponding definition: ```````````````````````````````` example [foo] [foo]: url .

foo

```````````````````````````````` If there are several matching definitions, the first one takes precedence: ```````````````````````````````` example [foo] [foo]: first [foo]: second .

foo

```````````````````````````````` As noted in the section on [Links], matching of labels is case-insensitive (see [matches]). ```````````````````````````````` example [FOO]: /url [Foo] .

Foo

```````````````````````````````` ```````````````````````````````` example [ΑΓΩ]: /φου [αγω] .

αγω

```````````````````````````````` Here is a link reference definition with no corresponding link. It contributes nothing to the document. ```````````````````````````````` example [foo]: /url . ```````````````````````````````` Here is another one: ```````````````````````````````` example [ foo ]: /url bar .

bar

```````````````````````````````` This is not a link reference definition, because there are [non-whitespace characters] after the title: ```````````````````````````````` example [foo]: /url "title" ok .

[foo]: /url "title" ok

```````````````````````````````` This is a link reference definition, but it has no title: ```````````````````````````````` example [foo]: /url "title" ok .

"title" ok

```````````````````````````````` This is not a link reference definition, because it is indented four spaces: ```````````````````````````````` example [foo]: /url "title" [foo] .
[foo]: /url "title"

[foo]

```````````````````````````````` This is not a link reference definition, because it occurs inside a code block: ```````````````````````````````` example ``` [foo]: /url ``` [foo] .
[foo]: /url

[foo]

```````````````````````````````` A [link reference definition] cannot interrupt a paragraph. ```````````````````````````````` example Foo [bar]: /baz [bar] .

Foo [bar]: /baz

[bar]

```````````````````````````````` However, it can directly follow other block elements, such as headings and thematic breaks, and it need not be followed by a blank line. ```````````````````````````````` example # [Foo] [foo]: /url > bar .

Foo

bar

```````````````````````````````` ```````````````````````````````` example [foo]: /url bar === [foo] .

bar

foo

```````````````````````````````` ```````````````````````````````` example [foo]: /url === [foo] .

=== foo

```````````````````````````````` Several [link reference definitions] can occur one after another, without intervening blank lines. ```````````````````````````````` example [foo]: /foo-url "foo" [bar]: /bar-url "bar" [baz]: /baz-url [foo], [bar], [baz] .

foo, bar, baz

```````````````````````````````` [Link reference definitions] can occur inside block containers, like lists and block quotations. They affect the entire document, not just the container in which they are defined: ```````````````````````````````` example [foo] > [foo]: /url .

foo

```````````````````````````````` Whether something is a [link reference definition] is independent of whether the link reference it defines is used in the document. Thus, for example, the following document contains just a link reference definition, and no visible content: ```````````````````````````````` example [foo]: /url . ```````````````````````````````` ## Paragraphs A sequence of non-blank lines that cannot be interpreted as other kinds of blocks forms a [paragraph](@). The contents of the paragraph are the result of parsing the paragraph's raw content as inlines. The paragraph's raw content is formed by concatenating the lines and removing initial and final [whitespace]. A simple example with two paragraphs: ```````````````````````````````` example aaa bbb .

aaa

bbb

```````````````````````````````` Paragraphs can contain multiple lines, but no blank lines: ```````````````````````````````` example aaa bbb ccc ddd .

aaa bbb

ccc ddd

```````````````````````````````` Multiple blank lines between paragraph have no effect: ```````````````````````````````` example aaa bbb .

aaa

bbb

```````````````````````````````` Leading spaces are skipped: ```````````````````````````````` example aaa bbb .

aaa bbb

```````````````````````````````` Lines after the first may be indented any amount, since indented code blocks cannot interrupt paragraphs. ```````````````````````````````` example aaa bbb ccc .

aaa bbb ccc

```````````````````````````````` However, the first line may be indented at most three spaces, or an indented code block will be triggered: ```````````````````````````````` example aaa bbb .

aaa bbb

```````````````````````````````` ```````````````````````````````` example aaa bbb .
aaa

bbb

```````````````````````````````` Final spaces are stripped before inline parsing, so a paragraph that ends with two or more spaces will not end with a [hard line break]: ```````````````````````````````` example aaa bbb .

aaa
bbb

```````````````````````````````` ## Blank lines [Blank lines] between block-level elements are ignored, except for the role they play in determining whether a [list] is [tight] or [loose]. Blank lines at the beginning and end of the document are also ignored. ```````````````````````````````` example aaa # aaa .

aaa

aaa

```````````````````````````````` # Container blocks A [container block](#container-blocks) is a block that has other blocks as its contents. There are two basic kinds of container blocks: [block quotes] and [list items]. [Lists] are meta-containers for [list items]. We define the syntax for container blocks recursively. The general form of the definition is: > If X is a sequence of blocks, then the result of > transforming X in such-and-such a way is a container of type Y > with these blocks as its content. So, we explain what counts as a block quote or list item by explaining how these can be *generated* from their contents. This should suffice to define the syntax, although it does not give a recipe for *parsing* these constructions. (A recipe is provided below in the section entitled [A parsing strategy](#appendix-a-parsing-strategy).) ## Block quotes A [block quote marker](@) consists of 0-3 spaces of initial indent, plus (a) the character `>` together with a following space, or (b) a single character `>` not followed by a space. The following rules define [block quotes]: 1. **Basic case.** If a string of lines *Ls* constitute a sequence of blocks *Bs*, then the result of prepending a [block quote marker] to the beginning of each line in *Ls* is a [block quote](#block-quotes) containing *Bs*. 2. **Laziness.** If a string of lines *Ls* constitute a [block quote](#block-quotes) with contents *Bs*, then the result of deleting the initial [block quote marker] from one or more lines in which the next [non-whitespace character] after the [block quote marker] is [paragraph continuation text] is a block quote with *Bs* as its content. [Paragraph continuation text](@) is text that will be parsed as part of the content of a paragraph, but does not occur at the beginning of the paragraph. 3. **Consecutiveness.** A document cannot contain two [block quotes] in a row unless there is a [blank line] between them. Nothing else counts as a [block quote](#block-quotes). Here is a simple example: ```````````````````````````````` example > # Foo > bar > baz .

Foo

bar baz

```````````````````````````````` The spaces after the `>` characters can be omitted: ```````````````````````````````` example ># Foo >bar > baz .

Foo

bar baz

```````````````````````````````` The `>` characters can be indented 1-3 spaces: ```````````````````````````````` example > # Foo > bar > baz .

Foo

bar baz

```````````````````````````````` Four spaces gives us a code block: ```````````````````````````````` example > # Foo > bar > baz .
> # Foo
> bar
> baz
```````````````````````````````` The Laziness clause allows us to omit the `>` before [paragraph continuation text]: ```````````````````````````````` example > # Foo > bar baz .

Foo

bar baz

```````````````````````````````` A block quote can contain some lazy and some non-lazy continuation lines: ```````````````````````````````` example > bar baz > foo .

bar baz foo

```````````````````````````````` Laziness only applies to lines that would have been continuations of paragraphs had they been prepended with [block quote markers]. For example, the `> ` cannot be omitted in the second line of ``` markdown > foo > --- ``` without changing the meaning: ```````````````````````````````` example > foo --- .

foo


```````````````````````````````` Similarly, if we omit the `> ` in the second line of ``` markdown > - foo > - bar ``` then the block quote ends after the first line: ```````````````````````````````` example > - foo - bar .
  • foo
  • bar
```````````````````````````````` For the same reason, we can't omit the `> ` in front of subsequent lines of an indented or fenced code block: ```````````````````````````````` example > foo bar .
foo
bar
```````````````````````````````` ```````````````````````````````` example > ``` foo ``` .

foo

```````````````````````````````` Note that in the following case, we have a [lazy continuation line]: ```````````````````````````````` example > foo - bar .

foo - bar

```````````````````````````````` To see why, note that in ```markdown > foo > - bar ``` the `- bar` is indented too far to start a list, and can't be an indented code block because indented code blocks cannot interrupt paragraphs, so it is [paragraph continuation text]. A block quote can be empty: ```````````````````````````````` example > .
```````````````````````````````` ```````````````````````````````` example > > > .
```````````````````````````````` A block quote can have initial or final blank lines: ```````````````````````````````` example > > foo > .

foo

```````````````````````````````` A blank line always separates block quotes: ```````````````````````````````` example > foo > bar .

foo

bar

```````````````````````````````` (Most current Markdown implementations, including John Gruber's original `Markdown.pl`, will parse this example as a single block quote with two paragraphs. But it seems better to allow the author to decide whether two block quotes or one are wanted.) Consecutiveness means that if we put these block quotes together, we get a single block quote: ```````````````````````````````` example > foo > bar .

foo bar

```````````````````````````````` To get a block quote with two paragraphs, use: ```````````````````````````````` example > foo > > bar .

foo

bar

```````````````````````````````` Block quotes can interrupt paragraphs: ```````````````````````````````` example foo > bar .

foo

bar

```````````````````````````````` In general, blank lines are not needed before or after block quotes: ```````````````````````````````` example > aaa *** > bbb .

aaa


bbb

```````````````````````````````` However, because of laziness, a blank line is needed between a block quote and a following paragraph: ```````````````````````````````` example > bar baz .

bar baz

```````````````````````````````` ```````````````````````````````` example > bar baz .

bar

baz

```````````````````````````````` ```````````````````````````````` example > bar > baz .

bar

baz

```````````````````````````````` It is a consequence of the Laziness rule that any number of initial `>`s may be omitted on a continuation line of a nested block quote: ```````````````````````````````` example > > > foo bar .

foo bar

```````````````````````````````` ```````````````````````````````` example >>> foo > bar >>baz .

foo bar baz

```````````````````````````````` When including an indented code block in a block quote, remember that the [block quote marker] includes both the `>` and a following space. So *five spaces* are needed after the `>`: ```````````````````````````````` example > code > not code .
code

not code

```````````````````````````````` ## List items A [list marker](@) is a [bullet list marker] or an [ordered list marker]. A [bullet list marker](@) is a `-`, `+`, or `*` character. An [ordered list marker](@) is a sequence of 1--9 arabic digits (`0-9`), followed by either a `.` character or a `)` character. (The reason for the length limit is that with 10 digits we start seeing integer overflows in some browsers.) The following rules define [list items]: 1. **Basic case.** If a sequence of lines *Ls* constitute a sequence of blocks *Bs* starting with a [non-whitespace character], and *M* is a list marker of width *W* followed by 1 ≤ *N* ≤ 4 spaces, then the result of prepending *M* and the following spaces to the first line of *Ls*, and indenting subsequent lines of *Ls* by *W + N* spaces, is a list item with *Bs* as its contents. The type of the list item (bullet or ordered) is determined by the type of its list marker. If the list item is ordered, then it is also assigned a start number, based on the ordered list marker. Exceptions: 1. When the first list item in a [list] interrupts a paragraph---that is, when it starts on a line that would otherwise count as [paragraph continuation text]---then (a) the lines *Ls* must not begin with a blank line, and (b) if the list item is ordered, the start number must be 1. 2. If any line is a [thematic break][thematic breaks] then that line is not a list item. For example, let *Ls* be the lines ```````````````````````````````` example A paragraph with two lines. indented code > A block quote. .

A paragraph with two lines.

indented code

A block quote.

```````````````````````````````` And let *M* be the marker `1.`, and *N* = 2. Then rule #1 says that the following is an ordered list item with start number 1, and the same contents as *Ls*: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

```````````````````````````````` The most important thing to notice is that the position of the text after the list marker determines how much indentation is needed in subsequent blocks in the list item. If the list marker takes up two spaces, and there are three spaces between the list marker and the next [non-whitespace character], then blocks must be indented five spaces in order to fall under the list item. Here are some examples showing how far content must be indented to be put under the list item: ```````````````````````````````` example - one two .
  • one

two

```````````````````````````````` ```````````````````````````````` example - one two .
  • one

    two

```````````````````````````````` ```````````````````````````````` example - one two .
  • one
 two
```````````````````````````````` ```````````````````````````````` example - one two .
  • one

    two

```````````````````````````````` It is tempting to think of this in terms of columns: the continuation blocks must be indented at least to the column of the first [non-whitespace character] after the list marker. However, that is not quite right. The spaces after the list marker determine how much relative indentation is needed. Which column this indentation reaches will depend on how the list item is embedded in other constructions, as shown by this example: ```````````````````````````````` example > > 1. one >> >> two .
  1. one

    two

```````````````````````````````` Here `two` occurs in the same column as the list marker `1.`, but is actually contained in the list item, because there is sufficient indentation after the last containing blockquote marker. The converse is also possible. In the following example, the word `two` occurs far to the right of the initial text of the list item, `one`, but it is not considered part of the list item, because it is not indented far enough past the blockquote marker: ```````````````````````````````` example >>- one >> > > two .
  • one

two

```````````````````````````````` Note that at least one space is needed between the list marker and any following content, so these are not list items: ```````````````````````````````` example -one 2.two .

-one

2.two

```````````````````````````````` A list item may contain blocks that are separated by more than one blank line. ```````````````````````````````` example - foo bar .
  • foo

    bar

```````````````````````````````` A list item may contain any kind of block: ```````````````````````````````` example 1. foo ``` bar ``` baz > bam .
  1. foo

    bar
    

    baz

    bam

```````````````````````````````` A list item that contains an indented code block will preserve empty lines within the code block verbatim. ```````````````````````````````` example - Foo bar baz .
  • Foo

    bar
    
    
    baz
    
```````````````````````````````` Note that ordered list start numbers must be nine digits or less: ```````````````````````````````` example 123456789. ok .
  1. ok
```````````````````````````````` ```````````````````````````````` example 1234567890. not ok .

1234567890. not ok

```````````````````````````````` A start number may begin with 0s: ```````````````````````````````` example 0. ok .
  1. ok
```````````````````````````````` ```````````````````````````````` example 003. ok .
  1. ok
```````````````````````````````` A start number may not be negative: ```````````````````````````````` example -1. not ok .

-1. not ok

```````````````````````````````` 2. **Item starting with indented code.** If a sequence of lines *Ls* constitute a sequence of blocks *Bs* starting with an indented code block, and *M* is a list marker of width *W* followed by one space, then the result of prepending *M* and the following space to the first line of *Ls*, and indenting subsequent lines of *Ls* by *W + 1* spaces, is a list item with *Bs* as its contents. If a line is empty, then it need not be indented. The type of the list item (bullet or ordered) is determined by the type of its list marker. If the list item is ordered, then it is also assigned a start number, based on the ordered list marker. An indented code block will have to be indented four spaces beyond the edge of the region where text will be included in the list item. In the following case that is 6 spaces: ```````````````````````````````` example - foo bar .
  • foo

    bar
    
```````````````````````````````` And in this case it is 11 spaces: ```````````````````````````````` example 10. foo bar .
  1. foo

    bar
    
```````````````````````````````` If the *first* block in the list item is an indented code block, then by rule #2, the contents must be indented *one* space after the list marker: ```````````````````````````````` example indented code paragraph more code .
indented code

paragraph

more code
```````````````````````````````` ```````````````````````````````` example 1. indented code paragraph more code .
  1. indented code
    

    paragraph

    more code
    
```````````````````````````````` Note that an additional space indent is interpreted as space inside the code block: ```````````````````````````````` example 1. indented code paragraph more code .
  1.  indented code
    

    paragraph

    more code
    
```````````````````````````````` Note that rules #1 and #2 only apply to two cases: (a) cases in which the lines to be included in a list item begin with a [non-whitespace character], and (b) cases in which they begin with an indented code block. In a case like the following, where the first block begins with a three-space indent, the rules do not allow us to form a list item by indenting the whole thing and prepending a list marker: ```````````````````````````````` example foo bar .

foo

bar

```````````````````````````````` ```````````````````````````````` example - foo bar .
  • foo

bar

```````````````````````````````` This is not a significant restriction, because when a block begins with 1-3 spaces indent, the indentation can always be removed without a change in interpretation, allowing rule #1 to be applied. So, in the above case: ```````````````````````````````` example - foo bar .
  • foo

    bar

```````````````````````````````` 3. **Item starting with a blank line.** If a sequence of lines *Ls* starting with a single [blank line] constitute a (possibly empty) sequence of blocks *Bs*, not separated from each other by more than one blank line, and *M* is a list marker of width *W*, then the result of prepending *M* to the first line of *Ls*, and indenting subsequent lines of *Ls* by *W + 1* spaces, is a list item with *Bs* as its contents. If a line is empty, then it need not be indented. The type of the list item (bullet or ordered) is determined by the type of its list marker. If the list item is ordered, then it is also assigned a start number, based on the ordered list marker. Here are some list items that start with a blank line but are not empty: ```````````````````````````````` example - foo - ``` bar ``` - baz .
  • foo
  • bar
    
  • baz
    
```````````````````````````````` When the list item starts with a blank line, the number of spaces following the list marker doesn't change the required indentation: ```````````````````````````````` example - foo .
  • foo
```````````````````````````````` A list item can begin with at most one blank line. In the following example, `foo` is not part of the list item: ```````````````````````````````` example - foo .

foo

```````````````````````````````` Here is an empty bullet list item: ```````````````````````````````` example - foo - - bar .
  • foo
  • bar
```````````````````````````````` It does not matter whether there are spaces following the [list marker]: ```````````````````````````````` example - foo - - bar .
  • foo
  • bar
```````````````````````````````` Here is an empty ordered list item: ```````````````````````````````` example 1. foo 2. 3. bar .
  1. foo
  2. bar
```````````````````````````````` A list may start or end with an empty list item: ```````````````````````````````` example * .
```````````````````````````````` However, an empty list item cannot interrupt a paragraph: ```````````````````````````````` example foo * foo 1. .

foo *

foo 1.

```````````````````````````````` 4. **Indentation.** If a sequence of lines *Ls* constitutes a list item according to rule #1, #2, or #3, then the result of indenting each line of *Ls* by 1-3 spaces (the same for each line) also constitutes a list item with the same contents and attributes. If a line is empty, then it need not be indented. Indented one space: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

```````````````````````````````` Indented two spaces: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

```````````````````````````````` Indented three spaces: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

```````````````````````````````` Four spaces indent gives a code block: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
1.  A paragraph
    with two lines.

        indented code

    > A block quote.
```````````````````````````````` 5. **Laziness.** If a string of lines *Ls* constitute a [list item](#list-items) with contents *Bs*, then the result of deleting some or all of the indentation from one or more lines in which the next [non-whitespace character] after the indentation is [paragraph continuation text] is a list item with the same contents and attributes. The unindented lines are called [lazy continuation line](@)s. Here is an example with [lazy continuation lines]: ```````````````````````````````` example 1. A paragraph with two lines. indented code > A block quote. .
  1. A paragraph with two lines.

    indented code
    

    A block quote.

```````````````````````````````` Indentation can be partially deleted: ```````````````````````````````` example 1. A paragraph with two lines. .
  1. A paragraph with two lines.
```````````````````````````````` These examples show how laziness can work in nested structures: ```````````````````````````````` example > 1. > Blockquote continued here. .
  1. Blockquote continued here.

```````````````````````````````` ```````````````````````````````` example > 1. > Blockquote > continued here. .
  1. Blockquote continued here.

```````````````````````````````` 6. **That's all.** Nothing that is not counted as a list item by rules #1--5 counts as a [list item](#list-items). The rules for sublists follow from the general rules [above][List items]. A sublist must be indented the same number of spaces a paragraph would need to be in order to be included in the list item. So, in this case we need two spaces indent: ```````````````````````````````` example - foo - bar - baz - boo .
  • foo
    • bar
      • baz
        • boo
```````````````````````````````` One is not enough: ```````````````````````````````` example - foo - bar - baz - boo .
  • foo
  • bar
  • baz
  • boo
```````````````````````````````` Here we need four, because the list marker is wider: ```````````````````````````````` example 10) foo - bar .
  1. foo
    • bar
```````````````````````````````` Three is not enough: ```````````````````````````````` example 10) foo - bar .
  1. foo
  • bar
```````````````````````````````` A list may be the first block in a list item: ```````````````````````````````` example - - foo .
    • foo
```````````````````````````````` ```````````````````````````````` example 1. - 2. foo .
      1. foo
```````````````````````````````` A list item can contain a heading: ```````````````````````````````` example - # Foo - Bar --- baz .
  • Foo

  • Bar

    baz
```````````````````````````````` ### Motivation John Gruber's Markdown spec says the following about list items: 1. "List markers typically start at the left margin, but may be indented by up to three spaces. List markers must be followed by one or more spaces or a tab." 2. "To make lists look nice, you can wrap items with hanging indents.... But if you don't want to, you don't have to." 3. "List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab." 4. "It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy." 5. "To put a blockquote within a list item, the blockquote's `>` delimiters need to be indented." 6. "To put a code block within a list item, the code block needs to be indented twice — 8 spaces or two tabs." These rules specify that a paragraph under a list item must be indented four spaces (presumably, from the left margin, rather than the start of the list marker, but this is not said), and that code under a list item must be indented eight spaces instead of the usual four. They also say that a block quote must be indented, but not by how much; however, the example given has four spaces indentation. Although nothing is said about other kinds of block-level content, it is certainly reasonable to infer that *all* block elements under a list item, including other lists, must be indented four spaces. This principle has been called the *four-space rule*. The four-space rule is clear and principled, and if the reference implementation `Markdown.pl` had followed it, it probably would have become the standard. However, `Markdown.pl` allowed paragraphs and sublists to start with only two spaces indentation, at least on the outer level. Worse, its behavior was inconsistent: a sublist of an outer-level list needed two spaces indentation, but a sublist of this sublist needed three spaces. It is not surprising, then, that different implementations of Markdown have developed very different rules for determining what comes under a list item. (Pandoc and python-Markdown, for example, stuck with Gruber's syntax description and the four-space rule, while discount, redcarpet, marked, PHP Markdown, and others followed `Markdown.pl`'s behavior more closely.) Unfortunately, given the divergences between implementations, there is no way to give a spec for list items that will be guaranteed not to break any existing documents. However, the spec given here should correctly handle lists formatted with either the four-space rule or the more forgiving `Markdown.pl` behavior, provided they are laid out in a way that is natural for a human to read. The strategy here is to let the width and indentation of the list marker determine the indentation necessary for blocks to fall under the list item, rather than having a fixed and arbitrary number. The writer can think of the body of the list item as a unit which gets indented to the right enough to fit the list marker (and any indentation on the list marker). (The laziness rule, #5, then allows continuation lines to be unindented if needed.) This rule is superior, we claim, to any rule requiring a fixed level of indentation from the margin. The four-space rule is clear but unnatural. It is quite unintuitive that ``` markdown - foo bar - baz ``` should be parsed as two lists with an intervening paragraph, ``` html
  • foo

bar

  • baz
``` as the four-space rule demands, rather than a single list, ``` html
  • foo

    bar

    • baz
``` The choice of four spaces is arbitrary. It can be learned, but it is not likely to be guessed, and it trips up beginners regularly. Would it help to adopt a two-space rule? The problem is that such a rule, together with the rule allowing 1--3 spaces indentation of the initial list marker, allows text that is indented *less than* the original list marker to be included in the list item. For example, `Markdown.pl` parses ``` markdown - one two ``` as a single list item, with `two` a continuation paragraph: ``` html
  • one

    two

``` and similarly ``` markdown > - one > > two ``` as ``` html
  • one

    two

``` This is extremely unintuitive. Rather than requiring a fixed indent from the margin, we could require a fixed indent (say, two spaces, or even one space) from the list marker (which may itself be indented). This proposal would remove the last anomaly discussed. Unlike the spec presented above, it would count the following as a list item with a subparagraph, even though the paragraph `bar` is not indented as far as the first paragraph `foo`: ``` markdown 10. foo bar ``` Arguably this text does read like a list item with `bar` as a subparagraph, which may count in favor of the proposal. However, on this proposal indented code would have to be indented six spaces after the list marker. And this would break a lot of existing Markdown, which has the pattern: ``` markdown 1. foo indented code ``` where the code is indented eight spaces. The spec above, by contrast, will parse this text as expected, since the code block's indentation is measured from the beginning of `foo`. The one case that needs special treatment is a list item that *starts* with indented code. How much indentation is required in that case, since we don't have a "first paragraph" to measure from? Rule #2 simply stipulates that in such cases, we require one space indentation from the list marker (and then the normal four spaces for the indented code). This will match the four-space rule in cases where the list marker plus its initial indentation takes four spaces (a common case), but diverge in other cases. ## Lists A [list](@) is a sequence of one or more list items [of the same type]. The list items may be separated by any number of blank lines. Two list items are [of the same type](@) if they begin with a [list marker] of the same type. Two list markers are of the same type if (a) they are bullet list markers using the same character (`-`, `+`, or `*`) or (b) they are ordered list numbers with the same delimiter (either `.` or `)`). A list is an [ordered list](@) if its constituent list items begin with [ordered list markers], and a [bullet list](@) if its constituent list items begin with [bullet list markers]. The [start number](@) of an [ordered list] is determined by the list number of its initial list item. The numbers of subsequent list items are disregarded. A list is [loose](@) if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is [tight](@). (The difference in HTML output is that paragraphs in a loose list are wrapped in `

` tags, while paragraphs in a tight list are not.) Changing the bullet or ordered list delimiter starts a new list: ```````````````````````````````` example - foo - bar + baz .

  • foo
  • bar
  • baz
```````````````````````````````` ```````````````````````````````` example 1. foo 2. bar 3) baz .
  1. foo
  2. bar
  1. baz
```````````````````````````````` In CommonMark, a list can interrupt a paragraph. That is, no blank line is needed to separate a paragraph from a following list: ```````````````````````````````` example Foo - bar - baz .

Foo

  • bar
  • baz
```````````````````````````````` `Markdown.pl` does not allow this, through fear of triggering a list via a numeral in a hard-wrapped line: ``` markdown The number of windows in my house is 14. The number of doors is 6. ``` Oddly, though, `Markdown.pl` *does* allow a blockquote to interrupt a paragraph, even though the same considerations might apply. In CommonMark, we do allow lists to interrupt paragraphs, for two reasons. First, it is natural and not uncommon for people to start lists without blank lines: ``` markdown I need to buy - new shoes - a coat - a plane ticket ``` Second, we are attracted to a > [principle of uniformity](@): > if a chunk of text has a certain > meaning, it will continue to have the same meaning when put into a > container block (such as a list item or blockquote). (Indeed, the spec for [list items] and [block quotes] presupposes this principle.) This principle implies that if ``` markdown * I need to buy - new shoes - a coat - a plane ticket ``` is a list item containing a paragraph followed by a nested sublist, as all Markdown implementations agree it is (though the paragraph may be rendered without `

` tags, since the list is "tight"), then ``` markdown I need to buy - new shoes - a coat - a plane ticket ``` by itself should be a paragraph followed by a nested sublist. Since it is well established Markdown practice to allow lists to interrupt paragraphs inside list items, the [principle of uniformity] requires us to allow this outside list items as well. ([reStructuredText](http://docutils.sourceforge.net/rst.html) takes a different approach, requiring blank lines before lists even inside other list items.) In order to solve of unwanted lists in paragraphs with hard-wrapped numerals, we allow only lists starting with `1` to interrupt paragraphs. Thus, ```````````````````````````````` example The number of windows in my house is 14. The number of doors is 6. .

The number of windows in my house is 14. The number of doors is 6.

```````````````````````````````` We may still get an unintended result in cases like ```````````````````````````````` example The number of windows in my house is 1. The number of doors is 6. .

The number of windows in my house is

  1. The number of doors is 6.
```````````````````````````````` but this rule should prevent most spurious list captures. There can be any number of blank lines between items: ```````````````````````````````` example - foo - bar - baz .
  • foo

  • bar

  • baz

```````````````````````````````` ```````````````````````````````` example - foo - bar - baz bim .
  • foo
    • bar
      • baz

        bim

```````````````````````````````` To separate consecutive lists of the same type, or to separate a list from an indented code block that would otherwise be parsed as a subparagraph of the final list item, you can insert a blank HTML comment: ```````````````````````````````` example - foo - bar - baz - bim .
  • foo
  • bar
  • baz
  • bim
```````````````````````````````` ```````````````````````````````` example - foo notcode - foo code .
  • foo

    notcode

  • foo

code
```````````````````````````````` List items need not be indented to the same level. The following list items will be treated as items at the same list level, since none is indented enough to belong to the previous list item: ```````````````````````````````` example - a - b - c - d - e - f - g .
  • a
  • b
  • c
  • d
  • e
  • f
  • g
```````````````````````````````` ```````````````````````````````` example 1. a 2. b 3. c .
  1. a

  2. b

  3. c

```````````````````````````````` Note, however, that list items may not be indented more than three spaces. Here `- e` is treated as a paragraph continuation line, because it is indented more than three spaces: ```````````````````````````````` example - a - b - c - d - e .
  • a
  • b
  • c
  • d - e
```````````````````````````````` And here, `3. c` is treated as in indented code block, because it is indented four spaces and preceded by a blank line. ```````````````````````````````` example 1. a 2. b 3. c .
  1. a

  2. b

3. c
```````````````````````````````` This is a loose list, because there is a blank line between two of the list items: ```````````````````````````````` example - a - b - c .
  • a

  • b

  • c

```````````````````````````````` So is this, with a empty second item: ```````````````````````````````` example * a * * c .
  • a

  • c

```````````````````````````````` These are loose lists, even though there is no space between the items, because one of the items directly contains two block-level elements with a blank line between them: ```````````````````````````````` example - a - b c - d .
  • a

  • b

    c

  • d

```````````````````````````````` ```````````````````````````````` example - a - b [ref]: /url - d .
  • a

  • b

  • d

```````````````````````````````` This is a tight list, because the blank lines are in a code block: ```````````````````````````````` example - a - ``` b ``` - c .
  • a
  • b
    
    
    
  • c
```````````````````````````````` This is a tight list, because the blank line is between two paragraphs of a sublist. So the sublist is loose while the outer list is tight: ```````````````````````````````` example - a - b c - d .
  • a
    • b

      c

  • d
```````````````````````````````` This is a tight list, because the blank line is inside the block quote: ```````````````````````````````` example * a > b > * c .
  • a

    b

  • c
```````````````````````````````` This list is tight, because the consecutive block elements are not separated by blank lines: ```````````````````````````````` example - a > b ``` c ``` - d .
  • a

    b

    c
    
  • d
```````````````````````````````` A single-paragraph list is tight: ```````````````````````````````` example - a .
  • a
```````````````````````````````` ```````````````````````````````` example - a - b .
  • a
    • b
```````````````````````````````` This list is loose, because of the blank line between the two block elements in the list item: ```````````````````````````````` example 1. ``` foo ``` bar .
  1. foo
    

    bar

```````````````````````````````` Here the outer list is loose, the inner list tight: ```````````````````````````````` example * foo * bar baz .
  • foo

    • bar

    baz

```````````````````````````````` ```````````````````````````````` example - a - b - c - d - e - f .
  • a

    • b
    • c
  • d

    • e
    • f
```````````````````````````````` # Inlines Inlines are parsed sequentially from the beginning of the character stream to the end (left to right, in left-to-right languages). Thus, for example, in ```````````````````````````````` example `hi`lo` .

hilo`

```````````````````````````````` `hi` is parsed as code, leaving the backtick at the end as a literal backtick. ## Backslash escapes Any ASCII punctuation character may be backslash-escaped: ```````````````````````````````` example \!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~ .

!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

```````````````````````````````` Backslashes before other characters are treated as literal backslashes: ```````````````````````````````` example \→\A\a\ \3\φ\« .

\→\A\a\ \3\φ\«

```````````````````````````````` Escaped characters are treated as regular characters and do not have their usual Markdown meanings: ```````````````````````````````` example \*not emphasized* \
not a tag \[not a link](/foo) \`not code` 1\. not a list \* not a list \# not a heading \[foo]: /url "not a reference" \ö not a character entity .

*not emphasized* <br/> not a tag [not a link](/foo) `not code` 1. not a list * not a list # not a heading [foo]: /url "not a reference" &ouml; not a character entity

```````````````````````````````` If a backslash is itself escaped, the following character is not: ```````````````````````````````` example \\*emphasis* .

\emphasis

```````````````````````````````` A backslash at the end of the line is a [hard line break]: ```````````````````````````````` example foo\ bar .

foo
bar

```````````````````````````````` Backslash escapes do not work in code blocks, code spans, autolinks, or raw HTML: ```````````````````````````````` example `` \[\` `` .

\[\`

```````````````````````````````` ```````````````````````````````` example \[\] .
\[\]
```````````````````````````````` ```````````````````````````````` example ~~~ \[\] ~~~ .
\[\]
```````````````````````````````` ```````````````````````````````` example .

http://example.com?find=\*

```````````````````````````````` ```````````````````````````````` example . ```````````````````````````````` But they work in all other contexts, including URLs and link titles, link references, and [info strings] in [fenced code blocks]: ```````````````````````````````` example [foo](/bar\* "ti\*tle") .

foo

```````````````````````````````` ```````````````````````````````` example [foo] [foo]: /bar\* "ti\*tle" .

foo

```````````````````````````````` ```````````````````````````````` example ``` foo\+bar foo ``` .
foo
```````````````````````````````` ## Entity and numeric character references Valid HTML entity references and numeric character references can be used in place of the corresponding Unicode character, with the following exceptions: - Entity and character references are not recognized in code blocks and code spans. - Entity and character references cannot stand in place of special characters that define structural elements in CommonMark. For example, although `*` can be used in place of a literal `*` character, `*` cannot replace `*` in emphasis delimiters, bullet list markers, or thematic breaks. Conforming CommonMark parsers need not store information about whether a particular character was represented in the source using a Unicode character or an entity reference. [Entity references](@) consist of `&` + any of the valid HTML5 entity names + `;`. The document is used as an authoritative source for the valid entity references and their corresponding code points. ```````````````````````````````` example   & © Æ Ď ¾ ℋ ⅆ ∲ ≧̸ .

  & © Æ Ď ¾ ℋ ⅆ ∲ ≧̸

```````````````````````````````` [Decimal numeric character references](@) consist of `&#` + a string of 1--7 arabic digits + `;`. A numeric character reference is parsed as the corresponding Unicode character. Invalid Unicode code points will be replaced by the REPLACEMENT CHARACTER (`U+FFFD`). For security reasons, the code point `U+0000` will also be replaced by `U+FFFD`. ```````````````````````````````` example # Ӓ Ϡ � .

# Ӓ Ϡ �

```````````````````````````````` [Hexadecimal numeric character references](@) consist of `&#` + either `X` or `x` + a string of 1-6 hexadecimal digits + `;`. They too are parsed as the corresponding Unicode character (this time specified with a hexadecimal numeral instead of decimal). ```````````````````````````````` example " ആ ಫ .

" ആ ಫ

```````````````````````````````` Here are some nonentities: ```````````````````````````````` example   &x; &#; &#x; � &#abcdef0; &ThisIsNotDefined; &hi?; .

&nbsp &x; &#; &#x; &#87654321; &#abcdef0; &ThisIsNotDefined; &hi?;

```````````````````````````````` Although HTML5 does accept some entity references without a trailing semicolon (such as `©`), these are not recognized here, because it makes the grammar too ambiguous: ```````````````````````````````` example © .

&copy

```````````````````````````````` Strings that are not on the list of HTML5 named entities are not recognized as entity references either: ```````````````````````````````` example &MadeUpEntity; .

&MadeUpEntity;

```````````````````````````````` Entity and numeric character references are recognized in any context besides code spans or code blocks, including URLs, [link titles], and [fenced code block][] [info strings]: ```````````````````````````````` example . ```````````````````````````````` ```````````````````````````````` example [foo](/föö "föö") .

foo

```````````````````````````````` ```````````````````````````````` example [foo] [foo]: /föö "föö" .

foo

```````````````````````````````` ```````````````````````````````` example ``` föö foo ``` .
foo
```````````````````````````````` Entity and numeric character references are treated as literal text in code spans and code blocks: ```````````````````````````````` example `föö` .

f&ouml;&ouml;

```````````````````````````````` ```````````````````````````````` example föfö .
f&ouml;f&ouml;
```````````````````````````````` Entity and numeric character references cannot be used in place of symbols indicating structure in CommonMark documents. ```````````````````````````````` example *foo* *foo* .

*foo* foo

```````````````````````````````` ```````````````````````````````` example * foo * foo .

* foo

  • foo
```````````````````````````````` ```````````````````````````````` example foo bar .

foo bar

```````````````````````````````` ```````````````````````````````` example foo .

→foo

```````````````````````````````` ```````````````````````````````` example [a](url "tit") .

[a](url "tit")

```````````````````````````````` ## Code spans A [backtick string](@) is a string of one or more backtick characters (`` ` ``) that is neither preceded nor followed by a backtick. A [code span](@) begins with a backtick string and ends with a backtick string of equal length. The contents of the code span are the characters between the two backtick strings, normalized in the following ways: - First, [line endings] are converted to [spaces]. - If the resulting string both begins *and* ends with a [space] character, but does not consist entirely of [space] characters, a single [space] character is removed from the front and back. This allows you to include code that begins or ends with backtick characters, which must be separated by whitespace from the opening or closing backtick strings. This is a simple code span: ```````````````````````````````` example `foo` .

foo

```````````````````````````````` Here two backticks are used, because the code contains a backtick. This example also illustrates stripping of a single leading and trailing space: ```````````````````````````````` example `` foo ` bar `` .

foo ` bar

```````````````````````````````` This example shows the motivation for stripping leading and trailing spaces: ```````````````````````````````` example ` `` ` .

``

```````````````````````````````` Note that only *one* space is stripped: ```````````````````````````````` example ` `` ` .

``

```````````````````````````````` The stripping only happens if the space is on both sides of the string: ```````````````````````````````` example ` a` .

a

```````````````````````````````` Only [spaces], and not [unicode whitespace] in general, are stripped in this way: ```````````````````````````````` example ` b ` .

 b 

```````````````````````````````` No stripping occurs if the code span contains only spaces: ```````````````````````````````` example ` ` ` ` .

 

```````````````````````````````` [Line endings] are treated like spaces: ```````````````````````````````` example `` foo bar baz `` .

foo bar baz

```````````````````````````````` ```````````````````````````````` example `` foo `` .

foo

```````````````````````````````` Interior spaces are not collapsed: ```````````````````````````````` example `foo bar baz` .

foo bar baz

```````````````````````````````` Note that browsers will typically collapse consecutive spaces when rendering `` elements, so it is recommended that the following CSS be used: code{white-space: pre-wrap;} Note that backslash escapes do not work in code spans. All backslashes are treated literally: ```````````````````````````````` example `foo\`bar` .

foo\bar`

```````````````````````````````` Backslash escapes are never needed, because one can always choose a string of *n* backtick characters as delimiters, where the code does not contain any strings of exactly *n* backtick characters. ```````````````````````````````` example ``foo`bar`` .

foo`bar

```````````````````````````````` ```````````````````````````````` example ` foo `` bar ` .

foo `` bar

```````````````````````````````` Code span backticks have higher precedence than any other inline constructs except HTML tags and autolinks. Thus, for example, this is not parsed as emphasized text, since the second `*` is part of a code span: ```````````````````````````````` example *foo`*` .

*foo*

```````````````````````````````` And this is not parsed as a link: ```````````````````````````````` example [not a `link](/foo`) .

[not a link](/foo)

```````````````````````````````` Code spans, HTML tags, and autolinks have the same precedence. Thus, this is code: ```````````````````````````````` example `` .

<a href="">`

```````````````````````````````` But this is an HTML tag: ```````````````````````````````` example
` .

`

```````````````````````````````` And this is code: ```````````````````````````````` example `` .

<http://foo.bar.baz>`

```````````````````````````````` But this is an autolink: ```````````````````````````````` example ` .

http://foo.bar.`baz`

```````````````````````````````` When a backtick string is not closed by a matching backtick string, we just have literal backticks: ```````````````````````````````` example ```foo`` .

```foo``

```````````````````````````````` ```````````````````````````````` example `foo .

`foo

```````````````````````````````` The following case also illustrates the need for opening and closing backtick strings to be equal in length: ```````````````````````````````` example `foo``bar`` .

`foobar

```````````````````````````````` ## Emphasis and strong emphasis John Gruber's original [Markdown syntax description](http://daringfireball.net/projects/markdown/syntax#em) says: > Markdown treats asterisks (`*`) and underscores (`_`) as indicators of > emphasis. Text wrapped with one `*` or `_` will be wrapped with an HTML > `` tag; double `*`'s or `_`'s will be wrapped with an HTML `` > tag. This is enough for most users, but these rules leave much undecided, especially when it comes to nested emphasis. The original `Markdown.pl` test suite makes it clear that triple `***` and `___` delimiters can be used for strong emphasis, and most implementations have also allowed the following patterns: ``` markdown ***strong emph*** ***strong** in emph* ***emph* in strong** **in strong *emph*** *in emph **strong*** ``` The following patterns are less widely supported, but the intent is clear and they are useful (especially in contexts like bibliography entries): ``` markdown *emph *with emph* in it* **strong **with strong** in it** ``` Many implementations have also restricted intraword emphasis to the `*` forms, to avoid unwanted emphasis in words containing internal underscores. (It is best practice to put these in code spans, but users often do not.) ``` markdown internal emphasis: foo*bar*baz no emphasis: foo_bar_baz ``` The rules given below capture all of these patterns, while allowing for efficient parsing strategies that do not backtrack. First, some definitions. A [delimiter run](@) is either a sequence of one or more `*` characters that is not preceded or followed by a non-backslash-escaped `*` character, or a sequence of one or more `_` characters that is not preceded or followed by a non-backslash-escaped `_` character. A [left-flanking delimiter run](@) is a [delimiter run] that is (1) not followed by [Unicode whitespace], and either (2a) not followed by a [punctuation character], or (2b) followed by a [punctuation character] and preceded by [Unicode whitespace] or a [punctuation character]. For purposes of this definition, the beginning and the end of the line count as Unicode whitespace. A [right-flanking delimiter run](@) is a [delimiter run] that is (1) not preceded by [Unicode whitespace], and either (2a) not preceded by a [punctuation character], or (2b) preceded by a [punctuation character] and followed by [Unicode whitespace] or a [punctuation character]. For purposes of this definition, the beginning and the end of the line count as Unicode whitespace. Here are some examples of delimiter runs. - left-flanking but not right-flanking: ``` ***abc _abc **"abc" _"abc" ``` - right-flanking but not left-flanking: ``` abc*** abc_ "abc"** "abc"_ ``` - Both left and right-flanking: ``` abc***def "abc"_"def" ``` - Neither left nor right-flanking: ``` abc *** def a _ b ``` (The idea of distinguishing left-flanking and right-flanking delimiter runs based on the character before and the character after comes from Roopesh Chander's [vfmd](http://www.vfmd.org/vfmd-spec/specification/#procedure-for-identifying-emphasis-tags). vfmd uses the terminology "emphasis indicator string" instead of "delimiter run," and its rules for distinguishing left- and right-flanking runs are a bit more complex than the ones given here.) The following rules define emphasis and strong emphasis: 1. A single `*` character [can open emphasis](@) iff (if and only if) it is part of a [left-flanking delimiter run]. 2. A single `_` character [can open emphasis] iff it is part of a [left-flanking delimiter run] and either (a) not part of a [right-flanking delimiter run] or (b) part of a [right-flanking delimiter run] preceded by punctuation. 3. A single `*` character [can close emphasis](@) iff it is part of a [right-flanking delimiter run]. 4. A single `_` character [can close emphasis] iff it is part of a [right-flanking delimiter run] and either (a) not part of a [left-flanking delimiter run] or (b) part of a [left-flanking delimiter run] followed by punctuation. 5. A double `**` [can open strong emphasis](@) iff it is part of a [left-flanking delimiter run]. 6. A double `__` [can open strong emphasis] iff it is part of a [left-flanking delimiter run] and either (a) not part of a [right-flanking delimiter run] or (b) part of a [right-flanking delimiter run] preceded by punctuation. 7. A double `**` [can close strong emphasis](@) iff it is part of a [right-flanking delimiter run]. 8. A double `__` [can close strong emphasis] iff it is part of a [right-flanking delimiter run] and either (a) not part of a [left-flanking delimiter run] or (b) part of a [left-flanking delimiter run] followed by punctuation. 9. Emphasis begins with a delimiter that [can open emphasis] and ends with a delimiter that [can close emphasis], and that uses the same character (`_` or `*`) as the opening delimiter. The opening and closing delimiters must belong to separate [delimiter runs]. If one of the delimiters can both open and close emphasis, then the sum of the lengths of the delimiter runs containing the opening and closing delimiters must not be a multiple of 3 unless both lengths are multiples of 3. 10. Strong emphasis begins with a delimiter that [can open strong emphasis] and ends with a delimiter that [can close strong emphasis], and that uses the same character (`_` or `*`) as the opening delimiter. The opening and closing delimiters must belong to separate [delimiter runs]. If one of the delimiters can both open and close strong emphasis, then the sum of the lengths of the delimiter runs containing the opening and closing delimiters must not be a multiple of 3 unless both lengths are multiples of 3. 11. A literal `*` character cannot occur at the beginning or end of `*`-delimited emphasis or `**`-delimited strong emphasis, unless it is backslash-escaped. 12. A literal `_` character cannot occur at the beginning or end of `_`-delimited emphasis or `__`-delimited strong emphasis, unless it is backslash-escaped. Where rules 1--12 above are compatible with multiple parsings, the following principles resolve ambiguity: 13. The number of nestings should be minimized. Thus, for example, an interpretation `...` is always preferred to `...`. 14. An interpretation `...` is always preferred to `...`. 15. When two potential emphasis or strong emphasis spans overlap, so that the second begins before the first ends and ends after the first ends, the first takes precedence. Thus, for example, `*foo _bar* baz_` is parsed as `foo _bar baz_` rather than `*foo bar* baz`. 16. When there are two potential emphasis or strong emphasis spans with the same closing delimiter, the shorter one (the one that opens later) takes precedence. Thus, for example, `**foo **bar baz**` is parsed as `**foo bar baz` rather than `foo **bar baz`. 17. Inline code spans, links, images, and HTML tags group more tightly than emphasis. So, when there is a choice between an interpretation that contains one of these elements and one that does not, the former always wins. Thus, for example, `*[foo*](bar)` is parsed as `*foo*` rather than as `[foo](bar)`. These rules can be illustrated through a series of examples. Rule 1: ```````````````````````````````` example *foo bar* .

foo bar

```````````````````````````````` This is not emphasis, because the opening `*` is followed by whitespace, and hence not part of a [left-flanking delimiter run]: ```````````````````````````````` example a * foo bar* .

a * foo bar*

```````````````````````````````` This is not emphasis, because the opening `*` is preceded by an alphanumeric and followed by punctuation, and hence not part of a [left-flanking delimiter run]: ```````````````````````````````` example a*"foo"* .

a*"foo"*

```````````````````````````````` Unicode nonbreaking spaces count as whitespace, too: ```````````````````````````````` example * a * .

* a *

```````````````````````````````` Intraword emphasis with `*` is permitted: ```````````````````````````````` example foo*bar* .

foobar

```````````````````````````````` ```````````````````````````````` example 5*6*78 .

5678

```````````````````````````````` Rule 2: ```````````````````````````````` example _foo bar_ .

foo bar

```````````````````````````````` This is not emphasis, because the opening `_` is followed by whitespace: ```````````````````````````````` example _ foo bar_ .

_ foo bar_

```````````````````````````````` This is not emphasis, because the opening `_` is preceded by an alphanumeric and followed by punctuation: ```````````````````````````````` example a_"foo"_ .

a_"foo"_

```````````````````````````````` Emphasis with `_` is not allowed inside words: ```````````````````````````````` example foo_bar_ .

foo_bar_

```````````````````````````````` ```````````````````````````````` example 5_6_78 .

5_6_78

```````````````````````````````` ```````````````````````````````` example пристаням_стремятся_ .

пристаням_стремятся_

```````````````````````````````` Here `_` does not generate emphasis, because the first delimiter run is right-flanking and the second left-flanking: ```````````````````````````````` example aa_"bb"_cc .

aa_"bb"_cc

```````````````````````````````` This is emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation: ```````````````````````````````` example foo-_(bar)_ .

foo-(bar)

```````````````````````````````` Rule 3: This is not emphasis, because the closing delimiter does not match the opening delimiter: ```````````````````````````````` example _foo* .

_foo*

```````````````````````````````` This is not emphasis, because the closing `*` is preceded by whitespace: ```````````````````````````````` example *foo bar * .

*foo bar *

```````````````````````````````` A newline also counts as whitespace: ```````````````````````````````` example *foo bar * .

*foo bar *

```````````````````````````````` This is not emphasis, because the second `*` is preceded by punctuation and followed by an alphanumeric (hence it is not part of a [right-flanking delimiter run]: ```````````````````````````````` example *(*foo) .

*(*foo)

```````````````````````````````` The point of this restriction is more easily appreciated with this example: ```````````````````````````````` example *(*foo*)* .

(foo)

```````````````````````````````` Intraword emphasis with `*` is allowed: ```````````````````````````````` example *foo*bar .

foobar

```````````````````````````````` Rule 4: This is not emphasis, because the closing `_` is preceded by whitespace: ```````````````````````````````` example _foo bar _ .

_foo bar _

```````````````````````````````` This is not emphasis, because the second `_` is preceded by punctuation and followed by an alphanumeric: ```````````````````````````````` example _(_foo) .

_(_foo)

```````````````````````````````` This is emphasis within emphasis: ```````````````````````````````` example _(_foo_)_ .

(foo)

```````````````````````````````` Intraword emphasis is disallowed for `_`: ```````````````````````````````` example _foo_bar .

_foo_bar

```````````````````````````````` ```````````````````````````````` example _пристаням_стремятся .

_пристаням_стремятся

```````````````````````````````` ```````````````````````````````` example _foo_bar_baz_ .

foo_bar_baz

```````````````````````````````` This is emphasis, even though the closing delimiter is both left- and right-flanking, because it is followed by punctuation: ```````````````````````````````` example _(bar)_. .

(bar).

```````````````````````````````` Rule 5: ```````````````````````````````` example **foo bar** .

foo bar

```````````````````````````````` This is not strong emphasis, because the opening delimiter is followed by whitespace: ```````````````````````````````` example ** foo bar** .

** foo bar**

```````````````````````````````` This is not strong emphasis, because the opening `**` is preceded by an alphanumeric and followed by punctuation, and hence not part of a [left-flanking delimiter run]: ```````````````````````````````` example a**"foo"** .

a**"foo"**

```````````````````````````````` Intraword strong emphasis with `**` is permitted: ```````````````````````````````` example foo**bar** .

foobar

```````````````````````````````` Rule 6: ```````````````````````````````` example __foo bar__ .

foo bar

```````````````````````````````` This is not strong emphasis, because the opening delimiter is followed by whitespace: ```````````````````````````````` example __ foo bar__ .

__ foo bar__

```````````````````````````````` A newline counts as whitespace: ```````````````````````````````` example __ foo bar__ .

__ foo bar__

```````````````````````````````` This is not strong emphasis, because the opening `__` is preceded by an alphanumeric and followed by punctuation: ```````````````````````````````` example a__"foo"__ .

a__"foo"__

```````````````````````````````` Intraword strong emphasis is forbidden with `__`: ```````````````````````````````` example foo__bar__ .

foo__bar__

```````````````````````````````` ```````````````````````````````` example 5__6__78 .

5__6__78

```````````````````````````````` ```````````````````````````````` example пристаням__стремятся__ .

пристаням__стремятся__

```````````````````````````````` ```````````````````````````````` example __foo, __bar__, baz__ .

foo, bar, baz

```````````````````````````````` This is strong emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation: ```````````````````````````````` example foo-__(bar)__ .

foo-(bar)

```````````````````````````````` Rule 7: This is not strong emphasis, because the closing delimiter is preceded by whitespace: ```````````````````````````````` example **foo bar ** .

**foo bar **

```````````````````````````````` (Nor can it be interpreted as an emphasized `*foo bar *`, because of Rule 11.) This is not strong emphasis, because the second `**` is preceded by punctuation and followed by an alphanumeric: ```````````````````````````````` example **(**foo) .

**(**foo)

```````````````````````````````` The point of this restriction is more easily appreciated with these examples: ```````````````````````````````` example *(**foo**)* .

(foo)

```````````````````````````````` ```````````````````````````````` example **Gomphocarpus (*Gomphocarpus physocarpus*, syn. *Asclepias physocarpa*)** .

Gomphocarpus (Gomphocarpus physocarpus, syn. Asclepias physocarpa)

```````````````````````````````` ```````````````````````````````` example **foo "*bar*" foo** .

foo "bar" foo

```````````````````````````````` Intraword emphasis: ```````````````````````````````` example **foo**bar .

foobar

```````````````````````````````` Rule 8: This is not strong emphasis, because the closing delimiter is preceded by whitespace: ```````````````````````````````` example __foo bar __ .

__foo bar __

```````````````````````````````` This is not strong emphasis, because the second `__` is preceded by punctuation and followed by an alphanumeric: ```````````````````````````````` example __(__foo) .

__(__foo)

```````````````````````````````` The point of this restriction is more easily appreciated with this example: ```````````````````````````````` example _(__foo__)_ .

(foo)

```````````````````````````````` Intraword strong emphasis is forbidden with `__`: ```````````````````````````````` example __foo__bar .

__foo__bar

```````````````````````````````` ```````````````````````````````` example __пристаням__стремятся .

__пристаням__стремятся

```````````````````````````````` ```````````````````````````````` example __foo__bar__baz__ .

foo__bar__baz

```````````````````````````````` This is strong emphasis, even though the closing delimiter is both left- and right-flanking, because it is followed by punctuation: ```````````````````````````````` example __(bar)__. .

(bar).

```````````````````````````````` Rule 9: Any nonempty sequence of inline elements can be the contents of an emphasized span. ```````````````````````````````` example *foo [bar](/url)* .

foo bar

```````````````````````````````` ```````````````````````````````` example *foo bar* .

foo bar

```````````````````````````````` In particular, emphasis and strong emphasis can be nested inside emphasis: ```````````````````````````````` example _foo __bar__ baz_ .

foo bar baz

```````````````````````````````` ```````````````````````````````` example _foo _bar_ baz_ .

foo bar baz

```````````````````````````````` ```````````````````````````````` example __foo_ bar_ .

foo bar

```````````````````````````````` ```````````````````````````````` example *foo *bar** .

foo bar

```````````````````````````````` ```````````````````````````````` example *foo **bar** baz* .

foo bar baz

```````````````````````````````` ```````````````````````````````` example *foo**bar**baz* .

foobarbaz

```````````````````````````````` Note that in the preceding case, the interpretation ``` markdown

foobarbaz

``` is precluded by the condition that a delimiter that can both open and close (like the `*` after `foo`) cannot form emphasis if the sum of the lengths of the delimiter runs containing the opening and closing delimiters is a multiple of 3 unless both lengths are multiples of 3. For the same reason, we don't get two consecutive emphasis sections in this example: ```````````````````````````````` example *foo**bar* .

foo**bar

```````````````````````````````` The same condition ensures that the following cases are all strong emphasis nested inside emphasis, even when the interior spaces are omitted: ```````````````````````````````` example ***foo** bar* .

foo bar

```````````````````````````````` ```````````````````````````````` example *foo **bar*** .

foo bar

```````````````````````````````` ```````````````````````````````` example *foo**bar*** .

foobar

```````````````````````````````` When the lengths of the interior closing and opening delimiter runs are *both* multiples of 3, though, they can match to create emphasis: ```````````````````````````````` example foo***bar***baz .

foobarbaz

```````````````````````````````` ```````````````````````````````` example foo******bar*********baz .

foobar***baz

```````````````````````````````` Indefinite levels of nesting are possible: ```````````````````````````````` example *foo **bar *baz* bim** bop* .

foo bar baz bim bop

```````````````````````````````` ```````````````````````````````` example *foo [*bar*](/url)* .

foo bar

```````````````````````````````` There can be no empty emphasis or strong emphasis: ```````````````````````````````` example ** is not an empty emphasis .

** is not an empty emphasis

```````````````````````````````` ```````````````````````````````` example **** is not an empty strong emphasis .

**** is not an empty strong emphasis

```````````````````````````````` Rule 10: Any nonempty sequence of inline elements can be the contents of an strongly emphasized span. ```````````````````````````````` example **foo [bar](/url)** .

foo bar

```````````````````````````````` ```````````````````````````````` example **foo bar** .

foo bar

```````````````````````````````` In particular, emphasis and strong emphasis can be nested inside strong emphasis: ```````````````````````````````` example __foo _bar_ baz__ .

foo bar baz

```````````````````````````````` ```````````````````````````````` example __foo __bar__ baz__ .

foo bar baz

```````````````````````````````` ```````````````````````````````` example ____foo__ bar__ .

foo bar

```````````````````````````````` ```````````````````````````````` example **foo **bar**** .

foo bar

```````````````````````````````` ```````````````````````````````` example **foo *bar* baz** .

foo bar baz

```````````````````````````````` ```````````````````````````````` example **foo*bar*baz** .

foobarbaz

```````````````````````````````` ```````````````````````````````` example ***foo* bar** .

foo bar

```````````````````````````````` ```````````````````````````````` example **foo *bar*** .

foo bar

```````````````````````````````` Indefinite levels of nesting are possible: ```````````````````````````````` example **foo *bar **baz** bim* bop** .

foo bar baz bim bop

```````````````````````````````` ```````````````````````````````` example **foo [*bar*](/url)** .

foo bar

```````````````````````````````` There can be no empty emphasis or strong emphasis: ```````````````````````````````` example __ is not an empty emphasis .

__ is not an empty emphasis

```````````````````````````````` ```````````````````````````````` example ____ is not an empty strong emphasis .

____ is not an empty strong emphasis

```````````````````````````````` Rule 11: ```````````````````````````````` example foo *** .

foo ***

```````````````````````````````` ```````````````````````````````` example foo *\** .

foo *

```````````````````````````````` ```````````````````````````````` example foo *_* .

foo _

```````````````````````````````` ```````````````````````````````` example foo ***** .

foo *****

```````````````````````````````` ```````````````````````````````` example foo **\*** .

foo *

```````````````````````````````` ```````````````````````````````` example foo **_** .

foo _

```````````````````````````````` Note that when delimiters do not match evenly, Rule 11 determines that the excess literal `*` characters will appear outside of the emphasis, rather than inside it: ```````````````````````````````` example **foo* .

*foo

```````````````````````````````` ```````````````````````````````` example *foo** .

foo*

```````````````````````````````` ```````````````````````````````` example ***foo** .

*foo

```````````````````````````````` ```````````````````````````````` example ****foo* .

***foo

```````````````````````````````` ```````````````````````````````` example **foo*** .

foo*

```````````````````````````````` ```````````````````````````````` example *foo**** .

foo***

```````````````````````````````` Rule 12: ```````````````````````````````` example foo ___ .

foo ___

```````````````````````````````` ```````````````````````````````` example foo _\__ .

foo _

```````````````````````````````` ```````````````````````````````` example foo _*_ .

foo *

```````````````````````````````` ```````````````````````````````` example foo _____ .

foo _____

```````````````````````````````` ```````````````````````````````` example foo __\___ .

foo _

```````````````````````````````` ```````````````````````````````` example foo __*__ .

foo *

```````````````````````````````` ```````````````````````````````` example __foo_ .

_foo

```````````````````````````````` Note that when delimiters do not match evenly, Rule 12 determines that the excess literal `_` characters will appear outside of the emphasis, rather than inside it: ```````````````````````````````` example _foo__ .

foo_

```````````````````````````````` ```````````````````````````````` example ___foo__ .

_foo

```````````````````````````````` ```````````````````````````````` example ____foo_ .

___foo

```````````````````````````````` ```````````````````````````````` example __foo___ .

foo_

```````````````````````````````` ```````````````````````````````` example _foo____ .

foo___

```````````````````````````````` Rule 13 implies that if you want emphasis nested directly inside emphasis, you must use different delimiters: ```````````````````````````````` example **foo** .

foo

```````````````````````````````` ```````````````````````````````` example *_foo_* .

foo

```````````````````````````````` ```````````````````````````````` example __foo__ .

foo

```````````````````````````````` ```````````````````````````````` example _*foo*_ .

foo

```````````````````````````````` However, strong emphasis within strong emphasis is possible without switching delimiters: ```````````````````````````````` example ****foo**** .

foo

```````````````````````````````` ```````````````````````````````` example ____foo____ .

foo

```````````````````````````````` Rule 13 can be applied to arbitrarily long sequences of delimiters: ```````````````````````````````` example ******foo****** .

foo

```````````````````````````````` Rule 14: ```````````````````````````````` example ***foo*** .

foo

```````````````````````````````` ```````````````````````````````` example _____foo_____ .

foo

```````````````````````````````` Rule 15: ```````````````````````````````` example *foo _bar* baz_ .

foo _bar baz_

```````````````````````````````` ```````````````````````````````` example *foo __bar *baz bim__ bam* .

foo bar *baz bim bam

```````````````````````````````` Rule 16: ```````````````````````````````` example **foo **bar baz** .

**foo bar baz

```````````````````````````````` ```````````````````````````````` example *foo *bar baz* .

*foo bar baz

```````````````````````````````` Rule 17: ```````````````````````````````` example *[bar*](/url) .

*bar*

```````````````````````````````` ```````````````````````````````` example _foo [bar_](/url) .

_foo bar_

```````````````````````````````` ```````````````````````````````` example * .

*

```````````````````````````````` ```````````````````````````````` example ** .

**

```````````````````````````````` ```````````````````````````````` example __ .

__

```````````````````````````````` ```````````````````````````````` example *a `*`* .

a *

```````````````````````````````` ```````````````````````````````` example _a `_`_ .

a _

```````````````````````````````` ```````````````````````````````` example **a .

**ahttp://foo.bar/?q=**

```````````````````````````````` ```````````````````````````````` example __a .

__ahttp://foo.bar/?q=__

```````````````````````````````` ## Links A link contains [link text] (the visible text), a [link destination] (the URI that is the link destination), and optionally a [link title]. There are two basic kinds of links in Markdown. In [inline links] the destination and title are given immediately after the link text. In [reference links] the destination and title are defined elsewhere in the document. A [link text](@) consists of a sequence of zero or more inline elements enclosed by square brackets (`[` and `]`). The following rules apply: - Links may not contain other links, at any level of nesting. If multiple otherwise valid link definitions appear nested inside each other, the inner-most definition is used. - Brackets are allowed in the [link text] only if (a) they are backslash-escaped or (b) they appear as a matched pair of brackets, with an open bracket `[`, a sequence of zero or more inlines, and a close bracket `]`. - Backtick [code spans], [autolinks], and raw [HTML tags] bind more tightly than the brackets in link text. Thus, for example, `` [foo`]` `` could not be a link text, since the second `]` is part of a code span. - The brackets in link text bind more tightly than markers for [emphasis and strong emphasis]. Thus, for example, `*[foo*](url)` is a link. A [link destination](@) consists of either - a sequence of zero or more characters between an opening `<` and a closing `>` that contains no line breaks or unescaped `<` or `>` characters, or - a nonempty sequence of characters that does not start with `<`, does not include ASCII space or control characters, and includes parentheses only if (a) they are backslash-escaped or (b) they are part of a balanced pair of unescaped parentheses. (Implementations may impose limits on parentheses nesting to avoid performance issues, but at least three levels of nesting should be supported.) A [link title](@) consists of either - a sequence of zero or more characters between straight double-quote characters (`"`), including a `"` character only if it is backslash-escaped, or - a sequence of zero or more characters between straight single-quote characters (`'`), including a `'` character only if it is backslash-escaped, or - a sequence of zero or more characters between matching parentheses (`(...)`), including a `(` or `)` character only if it is backslash-escaped. Although [link titles] may span multiple lines, they may not contain a [blank line]. An [inline link](@) consists of a [link text] followed immediately by a left parenthesis `(`, optional [whitespace], an optional [link destination], an optional [link title] separated from the link destination by [whitespace], optional [whitespace], and a right parenthesis `)`. The link's text consists of the inlines contained in the [link text] (excluding the enclosing square brackets). The link's URI consists of the link destination, excluding enclosing `<...>` if present, with backslash-escapes in effect as described above. The link's title consists of the link title, excluding its enclosing delimiters, with backslash-escapes in effect as described above. Here is a simple inline link: ```````````````````````````````` example [link](/uri "title") .

link

```````````````````````````````` The title may be omitted: ```````````````````````````````` example [link](/uri) .

link

```````````````````````````````` Both the title and the destination may be omitted: ```````````````````````````````` example [link]() .

link

```````````````````````````````` ```````````````````````````````` example [link](<>) .

link

```````````````````````````````` The destination can only contain spaces if it is enclosed in pointy brackets: ```````````````````````````````` example [link](/my uri) .

[link](/my uri)

```````````````````````````````` ```````````````````````````````` example [link](
) .

link

```````````````````````````````` The destination cannot contain line breaks, even if enclosed in pointy brackets: ```````````````````````````````` example [link](foo bar) .

[link](foo bar)

```````````````````````````````` ```````````````````````````````` example [link]() .

[link]()

```````````````````````````````` The destination can contain `)` if it is enclosed in pointy brackets: ```````````````````````````````` example [a]() .

a

```````````````````````````````` Pointy brackets that enclose links must be unescaped: ```````````````````````````````` example [link]() .

[link](<foo>)

```````````````````````````````` These are not links, because the opening pointy bracket is not matched properly: ```````````````````````````````` example [a]( [a](c) .

[a](<b)c [a](<b)c> [a](c)

```````````````````````````````` Parentheses inside the link destination may be escaped: ```````````````````````````````` example [link](\(foo\)) .

link

```````````````````````````````` Any number of parentheses are allowed without escaping, as long as they are balanced: ```````````````````````````````` example [link](foo(and(bar))) .

link

```````````````````````````````` However, if you have unbalanced parentheses, you need to escape or use the `<...>` form: ```````````````````````````````` example [link](foo\(and\(bar\)) .

link

```````````````````````````````` ```````````````````````````````` example [link]() .

link

```````````````````````````````` Parentheses and other symbols can also be escaped, as usual in Markdown: ```````````````````````````````` example [link](foo\)\:) .

link

```````````````````````````````` A link can contain fragment identifiers and queries: ```````````````````````````````` example [link](#fragment) [link](http://example.com#fragment) [link](http://example.com?foo=3#frag) .

link

link

link

```````````````````````````````` Note that a backslash before a non-escapable character is just a backslash: ```````````````````````````````` example [link](foo\bar) .

link

```````````````````````````````` URL-escaping should be left alone inside the destination, as all URL-escaped characters are also valid URL characters. Entity and numerical character references in the destination will be parsed into the corresponding Unicode code points, as usual. These may be optionally URL-escaped when written as HTML, but this spec does not enforce any particular policy for rendering URLs in HTML or other formats. Renderers may make different decisions about how to escape or normalize URLs in the output. ```````````````````````````````` example [link](foo%20bä) .

link

```````````````````````````````` Note that, because titles can often be parsed as destinations, if you try to omit the destination and keep the title, you'll get unexpected results: ```````````````````````````````` example [link]("title") .

link

```````````````````````````````` Titles may be in single quotes, double quotes, or parentheses: ```````````````````````````````` example [link](/url "title") [link](/url 'title') [link](/url (title)) .

link link link

```````````````````````````````` Backslash escapes and entity and numeric character references may be used in titles: ```````````````````````````````` example [link](/url "title \""") .

link

```````````````````````````````` Titles must be separated from the link using a [whitespace]. Other [Unicode whitespace] like non-breaking space doesn't work. ```````````````````````````````` example [link](/url "title") .

link

```````````````````````````````` Nested balanced quotes are not allowed without escaping: ```````````````````````````````` example [link](/url "title "and" title") .

[link](/url "title "and" title")

```````````````````````````````` But it is easy to work around this by using a different quote type: ```````````````````````````````` example [link](/url 'title "and" title') .

link

```````````````````````````````` (Note: `Markdown.pl` did allow double quotes inside a double-quoted title, and its test suite included a test demonstrating this. But it is hard to see a good rationale for the extra complexity this brings, since there are already many ways---backslash escaping, entity and numeric character references, or using a different quote type for the enclosing title---to write titles containing double quotes. `Markdown.pl`'s handling of titles has a number of other strange features. For example, it allows single-quoted titles in inline links, but not reference links. And, in reference links but not inline links, it allows a title to begin with `"` and end with `)`. `Markdown.pl` 1.0.1 even allows titles with no closing quotation mark, though 1.0.2b8 does not. It seems preferable to adopt a simple, rational rule that works the same way in inline links and link reference definitions.) [Whitespace] is allowed around the destination and title: ```````````````````````````````` example [link]( /uri "title" ) .

link

```````````````````````````````` But it is not allowed between the link text and the following parenthesis: ```````````````````````````````` example [link] (/uri) .

[link] (/uri)

```````````````````````````````` The link text may contain balanced brackets, but not unbalanced ones, unless they are escaped: ```````````````````````````````` example [link [foo [bar]]](/uri) .

link [foo [bar]]

```````````````````````````````` ```````````````````````````````` example [link] bar](/uri) .

[link] bar](/uri)

```````````````````````````````` ```````````````````````````````` example [link [bar](/uri) .

[link bar

```````````````````````````````` ```````````````````````````````` example [link \[bar](/uri) .

link [bar

```````````````````````````````` The link text may contain inline content: ```````````````````````````````` example [link *foo **bar** `#`*](/uri) .

link foo bar #

```````````````````````````````` ```````````````````````````````` example [![moon](moon.jpg)](/uri) .

moon

```````````````````````````````` However, links may not contain other links, at any level of nesting. ```````````````````````````````` example [foo [bar](/uri)](/uri) .

[foo bar](/uri)

```````````````````````````````` ```````````````````````````````` example [foo *[bar [baz](/uri)](/uri)*](/uri) .

[foo [bar baz](/uri)](/uri)

```````````````````````````````` ```````````````````````````````` example ![[[foo](uri1)](uri2)](uri3) .

[foo](uri2)

```````````````````````````````` These cases illustrate the precedence of link text grouping over emphasis grouping: ```````````````````````````````` example *[foo*](/uri) .

*foo*

```````````````````````````````` ```````````````````````````````` example [foo *bar](baz*) .

foo *bar

```````````````````````````````` Note that brackets that *aren't* part of links do not take precedence: ```````````````````````````````` example *foo [bar* baz] .

foo [bar baz]

```````````````````````````````` These cases illustrate the precedence of HTML tags, code spans, and autolinks over link grouping: ```````````````````````````````` example [foo .

[foo

```````````````````````````````` ```````````````````````````````` example [foo`](/uri)` .

[foo](/uri)

```````````````````````````````` ```````````````````````````````` example [foo .

[foohttp://example.com/?search=](uri)

```````````````````````````````` There are three kinds of [reference link](@)s: [full](#full-reference-link), [collapsed](#collapsed-reference-link), and [shortcut](#shortcut-reference-link). A [full reference link](@) consists of a [link text] immediately followed by a [link label] that [matches] a [link reference definition] elsewhere in the document. A [link label](@) begins with a left bracket (`[`) and ends with the first right bracket (`]`) that is not backslash-escaped. Between these brackets there must be at least one [non-whitespace character]. Unescaped square bracket characters are not allowed inside the opening and closing square brackets of [link labels]. A link label can have at most 999 characters inside the square brackets. One label [matches](@) another just in case their normalized forms are equal. To normalize a label, strip off the opening and closing brackets, perform the *Unicode case fold*, strip leading and trailing [whitespace] and collapse consecutive internal [whitespace] to a single space. If there are multiple matching reference link definitions, the one that comes first in the document is used. (It is desirable in such cases to emit a warning.) The contents of the first link label are parsed as inlines, which are used as the link's text. The link's URI and title are provided by the matching [link reference definition]. Here is a simple example: ```````````````````````````````` example [foo][bar] [bar]: /url "title" .

foo

```````````````````````````````` The rules for the [link text] are the same as with [inline links]. Thus: The link text may contain balanced brackets, but not unbalanced ones, unless they are escaped: ```````````````````````````````` example [link [foo [bar]]][ref] [ref]: /uri .

link [foo [bar]]

```````````````````````````````` ```````````````````````````````` example [link \[bar][ref] [ref]: /uri .

link [bar

```````````````````````````````` The link text may contain inline content: ```````````````````````````````` example [link *foo **bar** `#`*][ref] [ref]: /uri .

link foo bar #

```````````````````````````````` ```````````````````````````````` example [![moon](moon.jpg)][ref] [ref]: /uri .

moon

```````````````````````````````` However, links may not contain other links, at any level of nesting. ```````````````````````````````` example [foo [bar](/uri)][ref] [ref]: /uri .

[foo bar]ref

```````````````````````````````` ```````````````````````````````` example [foo *bar [baz][ref]*][ref] [ref]: /uri .

[foo bar baz]ref

```````````````````````````````` (In the examples above, we have two [shortcut reference links] instead of one [full reference link].) The following cases illustrate the precedence of link text grouping over emphasis grouping: ```````````````````````````````` example *[foo*][ref] [ref]: /uri .

*foo*

```````````````````````````````` ```````````````````````````````` example [foo *bar][ref] [ref]: /uri .

foo *bar

```````````````````````````````` These cases illustrate the precedence of HTML tags, code spans, and autolinks over link grouping: ```````````````````````````````` example [foo [ref]: /uri .

[foo

```````````````````````````````` ```````````````````````````````` example [foo`][ref]` [ref]: /uri .

[foo][ref]

```````````````````````````````` ```````````````````````````````` example [foo [ref]: /uri .

[foohttp://example.com/?search=][ref]

```````````````````````````````` Matching is case-insensitive: ```````````````````````````````` example [foo][BaR] [bar]: /url "title" .

foo

```````````````````````````````` Unicode case fold is used: ```````````````````````````````` example [Толпой][Толпой] is a Russian word. [ТОЛПОЙ]: /url .

Толпой is a Russian word.

```````````````````````````````` Consecutive internal [whitespace] is treated as one space for purposes of determining matching: ```````````````````````````````` example [Foo bar]: /url [Baz][Foo bar] .

Baz

```````````````````````````````` No [whitespace] is allowed between the [link text] and the [link label]: ```````````````````````````````` example [foo] [bar] [bar]: /url "title" .

[foo] bar

```````````````````````````````` ```````````````````````````````` example [foo] [bar] [bar]: /url "title" .

[foo] bar

```````````````````````````````` This is a departure from John Gruber's original Markdown syntax description, which explicitly allows whitespace between the link text and the link label. It brings reference links in line with [inline links], which (according to both original Markdown and this spec) cannot have whitespace after the link text. More importantly, it prevents inadvertent capture of consecutive [shortcut reference links]. If whitespace is allowed between the link text and the link label, then in the following we will have a single reference link, not two shortcut reference links, as intended: ``` markdown [foo] [bar] [foo]: /url1 [bar]: /url2 ``` (Note that [shortcut reference links] were introduced by Gruber himself in a beta version of `Markdown.pl`, but never included in the official syntax description. Without shortcut reference links, it is harmless to allow space between the link text and link label; but once shortcut references are introduced, it is too dangerous to allow this, as it frequently leads to unintended results.) When there are multiple matching [link reference definitions], the first is used: ```````````````````````````````` example [foo]: /url1 [foo]: /url2 [bar][foo] .

bar

```````````````````````````````` Note that matching is performed on normalized strings, not parsed inline content. So the following does not match, even though the labels define equivalent inline content: ```````````````````````````````` example [bar][foo\!] [foo!]: /url .

[bar][foo!]

```````````````````````````````` [Link labels] cannot contain brackets, unless they are backslash-escaped: ```````````````````````````````` example [foo][ref[] [ref[]: /uri .

[foo][ref[]

[ref[]: /uri

```````````````````````````````` ```````````````````````````````` example [foo][ref[bar]] [ref[bar]]: /uri .

[foo][ref[bar]]

[ref[bar]]: /uri

```````````````````````````````` ```````````````````````````````` example [[[foo]]] [[[foo]]]: /url .

[[[foo]]]

[[[foo]]]: /url

```````````````````````````````` ```````````````````````````````` example [foo][ref\[] [ref\[]: /uri .

foo

```````````````````````````````` Note that in this example `]` is not backslash-escaped: ```````````````````````````````` example [bar\\]: /uri [bar\\] .

bar\

```````````````````````````````` A [link label] must contain at least one [non-whitespace character]: ```````````````````````````````` example [] []: /uri .

[]

[]: /uri

```````````````````````````````` ```````````````````````````````` example [ ] [ ]: /uri .

[ ]

[ ]: /uri

```````````````````````````````` A [collapsed reference link](@) consists of a [link label] that [matches] a [link reference definition] elsewhere in the document, followed by the string `[]`. The contents of the first link label are parsed as inlines, which are used as the link's text. The link's URI and title are provided by the matching reference link definition. Thus, `[foo][]` is equivalent to `[foo][foo]`. ```````````````````````````````` example [foo][] [foo]: /url "title" .

foo

```````````````````````````````` ```````````````````````````````` example [*foo* bar][] [*foo* bar]: /url "title" .

foo bar

```````````````````````````````` The link labels are case-insensitive: ```````````````````````````````` example [Foo][] [foo]: /url "title" .

Foo

```````````````````````````````` As with full reference links, [whitespace] is not allowed between the two sets of brackets: ```````````````````````````````` example [foo] [] [foo]: /url "title" .

foo []

```````````````````````````````` A [shortcut reference link](@) consists of a [link label] that [matches] a [link reference definition] elsewhere in the document and is not followed by `[]` or a link label. The contents of the first link label are parsed as inlines, which are used as the link's text. The link's URI and title are provided by the matching link reference definition. Thus, `[foo]` is equivalent to `[foo][]`. ```````````````````````````````` example [foo] [foo]: /url "title" .

foo

```````````````````````````````` ```````````````````````````````` example [*foo* bar] [*foo* bar]: /url "title" .

foo bar

```````````````````````````````` ```````````````````````````````` example [[*foo* bar]] [*foo* bar]: /url "title" .

[foo bar]

```````````````````````````````` ```````````````````````````````` example [[bar [foo] [foo]: /url .

[[bar foo

```````````````````````````````` The link labels are case-insensitive: ```````````````````````````````` example [Foo] [foo]: /url "title" .

Foo

```````````````````````````````` A space after the link text should be preserved: ```````````````````````````````` example [foo] bar [foo]: /url .

foo bar

```````````````````````````````` If you just want bracketed text, you can backslash-escape the opening bracket to avoid links: ```````````````````````````````` example \[foo] [foo]: /url "title" .

[foo]

```````````````````````````````` Note that this is a link, because a link label ends with the first following closing bracket: ```````````````````````````````` example [foo*]: /url *[foo*] .

*foo*

```````````````````````````````` Full and compact references take precedence over shortcut references: ```````````````````````````````` example [foo][bar] [foo]: /url1 [bar]: /url2 .

foo

```````````````````````````````` ```````````````````````````````` example [foo][] [foo]: /url1 .

foo

```````````````````````````````` Inline links also take precedence: ```````````````````````````````` example [foo]() [foo]: /url1 .

foo

```````````````````````````````` ```````````````````````````````` example [foo](not a link) [foo]: /url1 .

foo(not a link)

```````````````````````````````` In the following case `[bar][baz]` is parsed as a reference, `[foo]` as normal text: ```````````````````````````````` example [foo][bar][baz] [baz]: /url .

[foo]bar

```````````````````````````````` Here, though, `[foo][bar]` is parsed as a reference, since `[bar]` is defined: ```````````````````````````````` example [foo][bar][baz] [baz]: /url1 [bar]: /url2 .

foobaz

```````````````````````````````` Here `[foo]` is not parsed as a shortcut reference, because it is followed by a link label (even though `[bar]` is not defined): ```````````````````````````````` example [foo][bar][baz] [baz]: /url1 [foo]: /url2 .

[foo]bar

```````````````````````````````` ## Images Syntax for images is like the syntax for links, with one difference. Instead of [link text], we have an [image description](@). The rules for this are the same as for [link text], except that (a) an image description starts with `![` rather than `[`, and (b) an image description may contain links. An image description has inline elements as its contents. When an image is rendered to HTML, this is standardly used as the image's `alt` attribute. ```````````````````````````````` example ![foo](/url "title") .

foo

```````````````````````````````` ```````````````````````````````` example ![foo *bar*] [foo *bar*]: train.jpg "train & tracks" .

foo bar

```````````````````````````````` ```````````````````````````````` example ![foo ![bar](/url)](/url2) .

foo bar

```````````````````````````````` ```````````````````````````````` example ![foo [bar](/url)](/url2) .

foo bar

```````````````````````````````` Though this spec is concerned with parsing, not rendering, it is recommended that in rendering to HTML, only the plain string content of the [image description] be used. Note that in the above example, the alt attribute's value is `foo bar`, not `foo [bar](/url)` or `foo bar`. Only the plain string content is rendered, without formatting. ```````````````````````````````` example ![foo *bar*][] [foo *bar*]: train.jpg "train & tracks" .

foo bar

```````````````````````````````` ```````````````````````````````` example ![foo *bar*][foobar] [FOOBAR]: train.jpg "train & tracks" .

foo bar

```````````````````````````````` ```````````````````````````````` example ![foo](train.jpg) .

foo

```````````````````````````````` ```````````````````````````````` example My ![foo bar](/path/to/train.jpg "title" ) .

My foo bar

```````````````````````````````` ```````````````````````````````` example ![foo]() .

foo

```````````````````````````````` ```````````````````````````````` example ![](/url) .

```````````````````````````````` Reference-style: ```````````````````````````````` example ![foo][bar] [bar]: /url .

foo

```````````````````````````````` ```````````````````````````````` example ![foo][bar] [BAR]: /url .

foo

```````````````````````````````` Collapsed: ```````````````````````````````` example ![foo][] [foo]: /url "title" .

foo

```````````````````````````````` ```````````````````````````````` example ![*foo* bar][] [*foo* bar]: /url "title" .

foo bar

```````````````````````````````` The labels are case-insensitive: ```````````````````````````````` example ![Foo][] [foo]: /url "title" .

Foo

```````````````````````````````` As with reference links, [whitespace] is not allowed between the two sets of brackets: ```````````````````````````````` example ![foo] [] [foo]: /url "title" .

foo []

```````````````````````````````` Shortcut: ```````````````````````````````` example ![foo] [foo]: /url "title" .

foo

```````````````````````````````` ```````````````````````````````` example ![*foo* bar] [*foo* bar]: /url "title" .

foo bar

```````````````````````````````` Note that link labels cannot contain unescaped brackets: ```````````````````````````````` example ![[foo]] [[foo]]: /url "title" .

![[foo]]

[[foo]]: /url "title"

```````````````````````````````` The link labels are case-insensitive: ```````````````````````````````` example ![Foo] [foo]: /url "title" .

Foo

```````````````````````````````` If you just want a literal `!` followed by bracketed text, you can backslash-escape the opening `[`: ```````````````````````````````` example !\[foo] [foo]: /url "title" .

![foo]

```````````````````````````````` If you want a link after a literal `!`, backslash-escape the `!`: ```````````````````````````````` example \![foo] [foo]: /url "title" .

!foo

```````````````````````````````` ## Autolinks [Autolink](@)s are absolute URIs and email addresses inside `<` and `>`. They are parsed as links, with the URL or email address as the link label. A [URI autolink](@) consists of `<`, followed by an [absolute URI] followed by `>`. It is parsed as a link to the URI, with the URI as the link's label. An [absolute URI](@), for these purposes, consists of a [scheme] followed by a colon (`:`) followed by zero or more characters other than ASCII [whitespace] and control characters, `<`, and `>`. If the URI includes these characters, they must be percent-encoded (e.g. `%20` for a space). For purposes of this spec, a [scheme](@) is any sequence of 2--32 characters beginning with an ASCII letter and followed by any combination of ASCII letters, digits, or the symbols plus ("+"), period ("."), or hyphen ("-"). Here are some valid autolinks: ```````````````````````````````` example .

http://foo.bar.baz

```````````````````````````````` ```````````````````````````````` example .

http://foo.bar.baz/test?q=hello&id=22&boolean

```````````````````````````````` ```````````````````````````````` example .

irc://foo.bar:2233/baz

```````````````````````````````` Uppercase is also fine: ```````````````````````````````` example .

MAILTO:FOO@BAR.BAZ

```````````````````````````````` Note that many strings that count as [absolute URIs] for purposes of this spec are not valid URIs, because their schemes are not registered or because of other problems with their syntax: ```````````````````````````````` example .

a+b+c:d

```````````````````````````````` ```````````````````````````````` example .

made-up-scheme://foo,bar

```````````````````````````````` ```````````````````````````````` example .

http://../

```````````````````````````````` ```````````````````````````````` example .

localhost:5001/foo

```````````````````````````````` Spaces are not allowed in autolinks: ```````````````````````````````` example .

<http://foo.bar/baz bim>

```````````````````````````````` Backslash-escapes do not work inside autolinks: ```````````````````````````````` example .

http://example.com/\[\

```````````````````````````````` An [email autolink](@) consists of `<`, followed by an [email address], followed by `>`. The link's label is the email address, and the URL is `mailto:` followed by the email address. An [email address](@), for these purposes, is anything that matches the [non-normative regex from the HTML5 spec](https://html.spec.whatwg.org/multipage/forms.html#e-mail-state-(type=email)): /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])? (?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/ Examples of email autolinks: ```````````````````````````````` example .

foo@bar.example.com

```````````````````````````````` ```````````````````````````````` example .

foo+special@Bar.baz-bar0.com

```````````````````````````````` Backslash-escapes do not work inside email autolinks: ```````````````````````````````` example .

<foo+@bar.example.com>

```````````````````````````````` These are not autolinks: ```````````````````````````````` example <> .

<>

```````````````````````````````` ```````````````````````````````` example < http://foo.bar > .

< http://foo.bar >

```````````````````````````````` ```````````````````````````````` example .

<m:abc>

```````````````````````````````` ```````````````````````````````` example .

<foo.bar.baz>

```````````````````````````````` ```````````````````````````````` example http://example.com .

http://example.com

```````````````````````````````` ```````````````````````````````` example foo@bar.example.com .

foo@bar.example.com

```````````````````````````````` ## Raw HTML Text between `<` and `>` that looks like an HTML tag is parsed as a raw HTML tag and will be rendered in HTML without escaping. Tag and attribute names are not limited to current HTML tags, so custom tags (and even, say, DocBook tags) may be used. Here is the grammar for tags: A [tag name](@) consists of an ASCII letter followed by zero or more ASCII letters, digits, or hyphens (`-`). An [attribute](@) consists of [whitespace], an [attribute name], and an optional [attribute value specification]. An [attribute name](@) consists of an ASCII letter, `_`, or `:`, followed by zero or more ASCII letters, digits, `_`, `.`, `:`, or `-`. (Note: This is the XML specification restricted to ASCII. HTML5 is laxer.) An [attribute value specification](@) consists of optional [whitespace], a `=` character, optional [whitespace], and an [attribute value]. An [attribute value](@) consists of an [unquoted attribute value], a [single-quoted attribute value], or a [double-quoted attribute value]. An [unquoted attribute value](@) is a nonempty string of characters not including [whitespace], `"`, `'`, `=`, `<`, `>`, or `` ` ``. A [single-quoted attribute value](@) consists of `'`, zero or more characters not including `'`, and a final `'`. A [double-quoted attribute value](@) consists of `"`, zero or more characters not including `"`, and a final `"`. An [open tag](@) consists of a `<` character, a [tag name], zero or more [attributes], optional [whitespace], an optional `/` character, and a `>` character. A [closing tag](@) consists of the string ``. An [HTML comment](@) consists of ``, where *text* does not start with `>` or `->`, does not end with `-`, and does not contain `--`. (See the [HTML5 spec](http://www.w3.org/TR/html5/syntax.html#comments).) A [processing instruction](@) consists of the string ``, and the string `?>`. A [declaration](@) consists of the string ``, and the character `>`. A [CDATA section](@) consists of the string ``, and the string `]]>`. An [HTML tag](@) consists of an [open tag], a [closing tag], an [HTML comment], a [processing instruction], a [declaration], or a [CDATA section]. Here are some simple open tags: ```````````````````````````````` example .

```````````````````````````````` Empty elements: ```````````````````````````````` example .

```````````````````````````````` [Whitespace] is allowed: ```````````````````````````````` example .

```````````````````````````````` With attributes: ```````````````````````````````` example .

```````````````````````````````` Custom tag names can be used: ```````````````````````````````` example Foo .

Foo

```````````````````````````````` Illegal tag names, not parsed as HTML: ```````````````````````````````` example <33> <__> .

<33> <__>

```````````````````````````````` Illegal attribute names: ```````````````````````````````` example
.

<a h*#ref="hi">

```````````````````````````````` Illegal attribute values: ```````````````````````````````` example
.

</a href="foo">

```````````````````````````````` Comments: ```````````````````````````````` example foo .

foo

```````````````````````````````` ```````````````````````````````` example foo .

foo <!-- not a comment -- two hyphens -->

```````````````````````````````` Not comments: ```````````````````````````````` example foo foo --> foo .

foo <!--> foo -->

foo <!-- foo--->

```````````````````````````````` Processing instructions: ```````````````````````````````` example foo .

foo

```````````````````````````````` Declarations: ```````````````````````````````` example foo .

foo

```````````````````````````````` CDATA sections: ```````````````````````````````` example foo &<]]> .

foo &<]]>

```````````````````````````````` Entity and numeric character references are preserved in HTML attributes: ```````````````````````````````` example foo
.

foo

```````````````````````````````` Backslash escapes do not work in HTML attributes: ```````````````````````````````` example foo .

foo

```````````````````````````````` ```````````````````````````````` example .

<a href=""">

```````````````````````````````` ## Hard line breaks A line break (not in a code span or HTML tag) that is preceded by two or more spaces and does not occur at the end of a block is parsed as a [hard line break](@) (rendered in HTML as a `
` tag): ```````````````````````````````` example foo baz .

foo
baz

```````````````````````````````` For a more visible alternative, a backslash before the [line ending] may be used instead of two spaces: ```````````````````````````````` example foo\ baz .

foo
baz

```````````````````````````````` More than two spaces can be used: ```````````````````````````````` example foo baz .

foo
baz

```````````````````````````````` Leading spaces at the beginning of the next line are ignored: ```````````````````````````````` example foo bar .

foo
bar

```````````````````````````````` ```````````````````````````````` example foo\ bar .

foo
bar

```````````````````````````````` Line breaks can occur inside emphasis, links, and other constructs that allow inline content: ```````````````````````````````` example *foo bar* .

foo
bar

```````````````````````````````` ```````````````````````````````` example *foo\ bar* .

foo
bar

```````````````````````````````` Line breaks do not occur inside code spans ```````````````````````````````` example `code span` .

code span

```````````````````````````````` ```````````````````````````````` example `code\ span` .

code\ span

```````````````````````````````` or HTML tags: ```````````````````````````````` example
.

```````````````````````````````` ```````````````````````````````` example .

```````````````````````````````` Hard line breaks are for separating inline content within a block. Neither syntax for hard line breaks works at the end of a paragraph or other block element: ```````````````````````````````` example foo\ .

foo\

```````````````````````````````` ```````````````````````````````` example foo .

foo

```````````````````````````````` ```````````````````````````````` example ### foo\ .

foo\

```````````````````````````````` ```````````````````````````````` example ### foo .

foo

```````````````````````````````` ## Soft line breaks A regular line break (not in a code span or HTML tag) that is not preceded by two or more spaces or a backslash is parsed as a [softbreak](@). (A softbreak may be rendered in HTML either as a [line ending] or as a space. The result will be the same in browsers. In the examples here, a [line ending] will be used.) ```````````````````````````````` example foo baz .

foo baz

```````````````````````````````` Spaces at the end of the line and beginning of the next line are removed: ```````````````````````````````` example foo baz .

foo baz

```````````````````````````````` A conforming parser may render a soft line break in HTML either as a line break or as a space. A renderer may also provide an option to render soft line breaks as hard line breaks. ## Textual content Any characters not given an interpretation by the above rules will be parsed as plain textual content. ```````````````````````````````` example hello $.;'there .

hello $.;'there

```````````````````````````````` ```````````````````````````````` example Foo χρῆν .

Foo χρῆν

```````````````````````````````` Internal spaces are preserved verbatim: ```````````````````````````````` example Multiple spaces .

Multiple spaces

```````````````````````````````` # Appendix: A parsing strategy In this appendix we describe some features of the parsing strategy used in the CommonMark reference implementations. ## Overview Parsing has two phases: 1. In the first phase, lines of input are consumed and the block structure of the document---its division into paragraphs, block quotes, list items, and so on---is constructed. Text is assigned to these blocks but not parsed. Link reference definitions are parsed and a map of links is constructed. 2. In the second phase, the raw text contents of paragraphs and headings are parsed into sequences of Markdown inline elements (strings, code spans, links, emphasis, and so on), using the map of link references constructed in phase 1. At each point in processing, the document is represented as a tree of **blocks**. The root of the tree is a `document` block. The `document` may have any number of other blocks as **children**. These children may, in turn, have other blocks as children. The last child of a block is normally considered **open**, meaning that subsequent lines of input can alter its contents. (Blocks that are not open are **closed**.) Here, for example, is a possible document tree, with the open blocks marked by arrows: ``` tree -> document -> block_quote paragraph "Lorem ipsum dolor\nsit amet." -> list (type=bullet tight=true bullet_char=-) list_item paragraph "Qui *quodsi iracundia*" -> list_item -> paragraph "aliquando id" ``` ## Phase 1: block structure Each line that is processed has an effect on this tree. The line is analyzed and, depending on its contents, the document may be altered in one or more of the following ways: 1. One or more open blocks may be closed. 2. One or more new blocks may be created as children of the last open block. 3. Text may be added to the last (deepest) open block remaining on the tree. Once a line has been incorporated into the tree in this way, it can be discarded, so input can be read in a stream. For each line, we follow this procedure: 1. First we iterate through the open blocks, starting with the root document, and descending through last children down to the last open block. Each block imposes a condition that the line must satisfy if the block is to remain open. For example, a block quote requires a `>` character. A paragraph requires a non-blank line. In this phase we may match all or just some of the open blocks. But we cannot close unmatched blocks yet, because we may have a [lazy continuation line]. 2. Next, after consuming the continuation markers for existing blocks, we look for new block starts (e.g. `>` for a block quote). If we encounter a new block start, we close any blocks unmatched in step 1 before creating the new block as a child of the last matched block. 3. Finally, we look at the remainder of the line (after block markers like `>`, list markers, and indentation have been consumed). This is text that can be incorporated into the last open block (a paragraph, code block, heading, or raw HTML). Setext headings are formed when we see a line of a paragraph that is a [setext heading underline]. Reference link definitions are detected when a paragraph is closed; the accumulated text lines are parsed to see if they begin with one or more reference link definitions. Any remainder becomes a normal paragraph. We can see how this works by considering how the tree above is generated by four lines of Markdown: ``` markdown > Lorem ipsum dolor sit amet. > - Qui *quodsi iracundia* > - aliquando id ``` At the outset, our document model is just ``` tree -> document ``` The first line of our text, ``` markdown > Lorem ipsum dolor ``` causes a `block_quote` block to be created as a child of our open `document` block, and a `paragraph` block as a child of the `block_quote`. Then the text is added to the last open block, the `paragraph`: ``` tree -> document -> block_quote -> paragraph "Lorem ipsum dolor" ``` The next line, ``` markdown sit amet. ``` is a "lazy continuation" of the open `paragraph`, so it gets added to the paragraph's text: ``` tree -> document -> block_quote -> paragraph "Lorem ipsum dolor\nsit amet." ``` The third line, ``` markdown > - Qui *quodsi iracundia* ``` causes the `paragraph` block to be closed, and a new `list` block opened as a child of the `block_quote`. A `list_item` is also added as a child of the `list`, and a `paragraph` as a child of the `list_item`. The text is then added to the new `paragraph`: ``` tree -> document -> block_quote paragraph "Lorem ipsum dolor\nsit amet." -> list (type=bullet tight=true bullet_char=-) -> list_item -> paragraph "Qui *quodsi iracundia*" ``` The fourth line, ``` markdown > - aliquando id ``` causes the `list_item` (and its child the `paragraph`) to be closed, and a new `list_item` opened up as child of the `list`. A `paragraph` is added as a child of the new `list_item`, to contain the text. We thus obtain the final tree: ``` tree -> document -> block_quote paragraph "Lorem ipsum dolor\nsit amet." -> list (type=bullet tight=true bullet_char=-) list_item paragraph "Qui *quodsi iracundia*" -> list_item -> paragraph "aliquando id" ``` ## Phase 2: inline structure Once all of the input has been parsed, all open blocks are closed. We then "walk the tree," visiting every node, and parse raw string contents of paragraphs and headings as inlines. At this point we have seen all the link reference definitions, so we can resolve reference links as we go. ``` tree document block_quote paragraph str "Lorem ipsum dolor" softbreak str "sit amet." list (type=bullet tight=true bullet_char=-) list_item paragraph str "Qui " emph str "quodsi iracundia" list_item paragraph str "aliquando id" ``` Notice how the [line ending] in the first paragraph has been parsed as a `softbreak`, and the asterisks in the first list item have become an `emph`. ### An algorithm for parsing nested emphasis and links By far the trickiest part of inline parsing is handling emphasis, strong emphasis, links, and images. This is done using the following algorithm. When we're parsing inlines and we hit either - a run of `*` or `_` characters, or - a `[` or `![` we insert a text node with these symbols as its literal content, and we add a pointer to this text node to the [delimiter stack](@). The [delimiter stack] is a doubly linked list. Each element contains a pointer to a text node, plus information about - the type of delimiter (`[`, `![`, `*`, `_`) - the number of delimiters, - whether the delimiter is "active" (all are active to start), and - whether the delimiter is a potential opener, a potential closer, or both (which depends on what sort of characters precede and follow the delimiters). When we hit a `]` character, we call the *look for link or image* procedure (see below). When we hit the end of the input, we call the *process emphasis* procedure (see below), with `stack_bottom` = NULL. #### *look for link or image* Starting at the top of the delimiter stack, we look backwards through the stack for an opening `[` or `![` delimiter. - If we don't find one, we return a literal text node `]`. - If we do find one, but it's not *active*, we remove the inactive delimiter from the stack, and return a literal text node `]`. - If we find one and it's active, then we parse ahead to see if we have an inline link/image, reference link/image, compact reference link/image, or shortcut reference link/image. + If we don't, then we remove the opening delimiter from the delimiter stack and return a literal text node `]`. + If we do, then * We return a link or image node whose children are the inlines after the text node pointed to by the opening delimiter. * We run *process emphasis* on these inlines, with the `[` opener as `stack_bottom`. * We remove the opening delimiter. * If we have a link (and not an image), we also set all `[` delimiters before the opening delimiter to *inactive*. (This will prevent us from getting links within links.) #### *process emphasis* Parameter `stack_bottom` sets a lower bound to how far we descend in the [delimiter stack]. If it is NULL, we can go all the way to the bottom. Otherwise, we stop before visiting `stack_bottom`. Let `current_position` point to the element on the [delimiter stack] just above `stack_bottom` (or the first element if `stack_bottom` is NULL). We keep track of the `openers_bottom` for each delimiter type (`*`, `_`) and each length of the closing delimiter run (modulo 3). Initialize this to `stack_bottom`. Then we repeat the following until we run out of potential closers: - Move `current_position` forward in the delimiter stack (if needed) until we find the first potential closer with delimiter `*` or `_`. (This will be the potential closer closest to the beginning of the input -- the first one in parse order.) - Now, look back in the stack (staying above `stack_bottom` and the `openers_bottom` for this delimiter type) for the first matching potential opener ("matching" means same delimiter). - If one is found: + Figure out whether we have emphasis or strong emphasis: if both closer and opener spans have length >= 2, we have strong, otherwise regular. + Insert an emph or strong emph node accordingly, after the text node corresponding to the opener. + Remove any delimiters between the opener and closer from the delimiter stack. + Remove 1 (for regular emph) or 2 (for strong emph) delimiters from the opening and closing text nodes. If they become empty as a result, remove them and remove the corresponding element of the delimiter stack. If the closing node is removed, reset `current_position` to the next element in the stack. - If none is found: + Set `openers_bottom` to the element before `current_position`. (We know that there are no openers for this kind of closer up to and including this point, so this puts a lower bound on future searches.) + If the closer at `current_position` is not a potential opener, remove it from the delimiter stack (since we know it can't be a closer either). + Advance `current_position` to the next element in the stack. After we're done, we remove all delimiters above `stack_bottom` from the delimiter stack. goldmark-1.7.4/_benchmark/go/benchmark_test.go000066400000000000000000000043331463655211100213500ustar00rootroot00000000000000package benchmark import ( "bytes" "io/ioutil" "testing" gomarkdown "github.com/gomarkdown/markdown" "github.com/yuin/goldmark" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/util" "gitlab.com/golang-commonmark/markdown" "github.com/russross/blackfriday/v2" "github.com/88250/lute" ) func BenchmarkMarkdown(b *testing.B) { b.Run("Blackfriday-v2", func(b *testing.B) { r := func(src []byte) ([]byte, error) { out := blackfriday.Run(src) return out, nil } doBenchmark(b, r) }) b.Run("GoldMark", func(b *testing.B) { markdown := goldmark.New( goldmark.WithRendererOptions(html.WithXHTML(), html.WithUnsafe()), ) r := func(src []byte) ([]byte, error) { var out bytes.Buffer err := markdown.Convert(src, &out) return out.Bytes(), err } doBenchmark(b, r) }) b.Run("CommonMark", func(b *testing.B) { md := markdown.New(markdown.XHTMLOutput(true)) r := func(src []byte) ([]byte, error) { var out bytes.Buffer err := md.Render(&out, src) return out.Bytes(), err } doBenchmark(b, r) }) b.Run("Lute", func(b *testing.B) { luteEngine := lute.New() luteEngine.SetGFMAutoLink(false) luteEngine.SetGFMStrikethrough(false) luteEngine.SetGFMTable(false) luteEngine.SetGFMTaskListItem(false) luteEngine.SetCodeSyntaxHighlight(false) luteEngine.SetSoftBreak2HardBreak(false) luteEngine.SetAutoSpace(false) luteEngine.SetFixTermTypo(false) r := func(src []byte) ([]byte, error) { out := luteEngine.MarkdownStr("Benchmark", util.BytesToReadOnlyString(src)) return util.StringToReadOnlyBytes(out), nil } doBenchmark(b, r) }) b.Run("GoMarkdown", func(b *testing.B) { r := func(src []byte) ([]byte, error) { out := gomarkdown.ToHTML(src, nil, nil) return out, nil } doBenchmark(b, r) }) } // The different frameworks have different APIs. Create an adapter that // should behave the same in the memory department. func doBenchmark(b *testing.B, render func(src []byte) ([]byte, error)) { b.StopTimer() source, err := ioutil.ReadFile("_data.md") if err != nil { b.Fatal(err) } b.StartTimer() for i := 0; i < b.N; i++ { out, err := render(source) if err != nil { b.Fatal(err) } if len(out) < 100 { b.Fatal("No result") } } } goldmark-1.7.4/_benchmark/go/go.mod000066400000000000000000000016201463655211100171320ustar00rootroot00000000000000module banchmark go 1.17 require ( github.com/88250/lute v1.7.5 github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a github.com/russross/blackfriday/v2 v2.1.0 github.com/yuin/goldmark v1.2.1 gitlab.com/golang-commonmark/markdown v0.0.0-20211110145824-bf3e522c626a ) require ( github.com/alecthomas/chroma v0.10.0 // indirect github.com/dlclark/regexp2 v1.10.0 // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect gitlab.com/golang-commonmark/html v0.0.0-20191124015941-a22733972181 // indirect gitlab.com/golang-commonmark/linkify v0.0.0-20191026162114-a0c2df6c8f82 // indirect gitlab.com/golang-commonmark/mdurl v0.0.0-20191124015652-932350d1cb84 // indirect gitlab.com/golang-commonmark/puny v0.0.0-20191124015043-9f83538fa04f // indirect golang.org/x/text v0.10.0 // indirect ) replace gopkg.in/russross/blackfriday.v2 v2.0.1 => github.com/russross/blackfriday/v2 v2.0.1 goldmark-1.7.4/_benchmark/go/go.sum000066400000000000000000000101021463655211100171520ustar00rootroot00000000000000github.com/88250/lute v1.7.5 h1:mcPFURh5sK1WH1kFRjqK5DkMWOfVN2BhyrXitN8GmpQ= github.com/88250/lute v1.7.5/go.mod h1:cEoBGi0zArPqAsp0MdG9SKinvH/xxZZWXU7sRx8vHSA= github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.10.0 h1:+/GIL799phkJqYW+3YbOd8LCcbHzT0Pbo8zl70MHsq0= github.com/dlclark/regexp2 v1.10.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a h1:AWZzzFrqyjYlRloN6edwTLTUbKxf5flLXNuTBDm3Ews= github.com/gomarkdown/markdown v0.0.0-20230322041520-c84983bdbf2a/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g= github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/yuin/goldmark v1.2.1 h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= gitlab.com/golang-commonmark/html v0.0.0-20191124015941-a22733972181 h1:K+bMSIx9A7mLES1rtG+qKduLIXq40DAzYHtb0XuCukA= gitlab.com/golang-commonmark/html v0.0.0-20191124015941-a22733972181/go.mod h1:dzYhVIwWCtzPAa4QP98wfB9+mzt33MSmM8wsKiMi2ow= gitlab.com/golang-commonmark/linkify v0.0.0-20191026162114-a0c2df6c8f82 h1:oYrL81N608MLZhma3ruL8qTM4xcpYECGut8KSxRY59g= gitlab.com/golang-commonmark/linkify v0.0.0-20191026162114-a0c2df6c8f82/go.mod h1:Gn+LZmCrhPECMD3SOKlE+BOHwhOYD9j7WT9NUtkCrC8= gitlab.com/golang-commonmark/markdown v0.0.0-20211110145824-bf3e522c626a h1:O85GKETcmnCNAfv4Aym9tepU8OE0NmcZNqPlXcsBKBs= gitlab.com/golang-commonmark/markdown v0.0.0-20211110145824-bf3e522c626a/go.mod h1:LaSIs30YPGs1H5jwGgPhLzc8vkNc/k0rDX/fEZqiU/M= gitlab.com/golang-commonmark/mdurl v0.0.0-20191124015652-932350d1cb84 h1:qqjvoVXdWIcZCLPMlzgA7P9FZWdPGPvP/l3ef8GzV6o= gitlab.com/golang-commonmark/mdurl v0.0.0-20191124015652-932350d1cb84/go.mod h1:IJZ+fdMvbW2qW6htJx7sLJ04FEs4Ldl/MDsJtMKywfw= gitlab.com/golang-commonmark/puny v0.0.0-20191124015043-9f83538fa04f h1:Wku8eEdeJqIOFHtrfkYUByc4bCaTeA6fL0UJgfEiFMI= gitlab.com/golang-commonmark/puny v0.0.0-20191124015043-9f83538fa04f/go.mod h1:Tiuhl+njh/JIg0uS/sOJVYi0x2HEa5rc1OAaVsb5tAs= gitlab.com/opennota/wd v0.0.0-20180912061657-c5d65f63c638 h1:uPZaMiz6Sz0PZs3IZJWpU5qHKGNy///1pacZC9txiUI= gitlab.com/opennota/wd v0.0.0-20180912061657-c5d65f63c638/go.mod h1:EGRJaqe2eO9XGmFtQCvV3Lm9NLico3UhFwUpCG/+mVU= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58= golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= goldmark-1.7.4/_test/000077500000000000000000000000001463655211100144455ustar00rootroot00000000000000goldmark-1.7.4/_test/extra.txt000066400000000000000000000343031463655211100163340ustar00rootroot000000000000001 //- - - - - - - - -// * A B //- - - - - - - - -//
  • A B
//= = = = = = = = = = = = = = = = = = = = = = = =// 2 //- - - - - - - - -// **test**\ test**test**\ **test**test\ test**test** //- - - - - - - - -//

test
testtest
testtest
testtest

//= = = = = = = = = = = = = = = = = = = = = = = =// 3 //- - - - - - - - -// >* > > 1 > 2 >3 //- - - - - - - - -//

1 2 3

//= = = = = = = = = = = = = = = = = = = = = = = =// 4 //- - - - - - - - -// `test`a`test` //- - - - - - - - -//

testatest

//= = = = = = = = = = = = = = = = = = = = = = = =// 5 //- - - - - - - - -// _**TL/DR** - [Go see summary.](#my-summary-area)_ //- - - - - - - - -//

TL/DR - Go see summary.

//= = = = = = = = = = = = = = = = = = = = = = = =// 6 //- - - - - - - - -// [This link won't be rendered correctly](https://geeksocket.in/some-long-link-here "This is the place where everything breaks") //- - - - - - - - -//

This link won't be rendered correctly

//= = = = = = = = = = = = = = = = = = = = = = = =// 7 //- - - - - - - - -// [](./target.md) //- - - - - - - - -//

//= = = = = = = = = = = = = = = = = = = = = = = =// 8 //- - - - - - - - -// []() //- - - - - - - - -//

//= = = = = = = = = = = = = = = = = = = = = = = =// 9 //- - - - - - - - -// [daß] is the old german spelling of [dass] [daß]: www.das-dass.de //- - - - - - - - -//

daß is the old german spelling of dass

//= = = = = = = = = = = = = = = = = = = = = = = =// 10 //- - - - - - - - -// 1. First step. ~~~ aaa --- bbb ~~~ 2. few other steps. //- - - - - - - - -//
  1. First step.

    aaa
    ---
    bbb
    
  2. few other steps.

//= = = = = = = = = = = = = = = = = = = = = = = =// 11: delimiters between ascii punctuations should be parsed //- - - - - - - - -// `{%`_name_`%}` //- - - - - - - - -//

{%name%}

//= = = = = = = = = = = = = = = = = = = = = = = =// 12: the alt attribute of img should be escaped //- - - - - - - - -// !["](quot.jpg) !['](apos.jpg) ![<](lt.jpg) ![>](gt.jpg) ![&](amp.jpg) //- - - - - - - - -//

" ' < > &

//= = = = = = = = = = = = = = = = = = = = = = = =// 13: fenced code block starting with tab inside list //- - - - - - - - -// * foo ```Makefile foo foo ``` //- - - - - - - - -//
  • foo
    foo
    	foo
    
//= = = = = = = = = = = = = = = = = = = = = = = =// 14: fenced code block inside list, mismatched tab start //- - - - - - - - -// * foo ```Makefile foo foo ``` //- - - - - - - - -//
  • foo
    foo
      foo
    
//= = = = = = = = = = = = = = = = = = = = = = = =// 15: fenced code block inside nested list //- - - - - - - - -// * foo - bar ```Makefile foo foo ``` //- - - - - - - - -//
  • foo
    • bar
      foo
      	foo
      
//= = = = = = = = = = = = = = = = = = = = = = = =// 16: indented code block starting with a tab. //- - - - - - - - -// * foo foo foo //- - - - - - - - -//
  • foo

    foo
    	foo
    
//= = = = = = = = = = = = = = = = = = = = = = = =// 17: fenced code block in list, empty line, spaces on start //- - - - - - - - -// * foo ```Makefile foo foo ``` //- - - - - - - - -//
  • foo
    foo
    
    foo
    
//= = = = = = = = = = = = = = = = = = = = = = = =// 18: fenced code block in list, empty line, no spaces on start //- - - - - - - - -// * foo ```Makefile foo foo ``` //- - - - - - - - -//
  • foo
    foo
    
    foo
    
//= = = = = = = = = = = = = = = = = = = = = = = =// 19: fenced code block inside nested list, empty line, spaces on start //- - - - - - - - -// * foo - bar ```Makefile foo foo ``` //- - - - - - - - -//
  • foo
    • bar
      foo
      
      foo
      
//= = = = = = = = = = = = = = = = = = = = = = = =// 20: fenced code block inside nested list, empty line, no space on start //- - - - - - - - -// * foo - bar ```Makefile foo foo ``` //- - - - - - - - -//
  • foo
    • bar
      foo
      
      foo
      
//= = = = = = = = = = = = = = = = = = = = = = = =// 21: Fenced code block within list can start with tab //- - - - - - - - -// - List ``` A B C ``` //- - - - - - - - -//
  • List

    A
    	B
    C
    
//= = = = = = = = = = = = = = = = = = = = = = = =// 22: Indented code block within list can start with tab //- - - - - - - - -// - List A B C a //- - - - - - - - -//
  • List

    A
    	B
    C
    

a

//= = = = = = = = = = = = = = = = = = = = = = = =// 23: Emphasis corner case(yuin/goldmark#245) //- - - - - - - - -// a* b c d *e* //- - - - - - - - -//

a* b c d e

//= = = = = = = = = = = = = = = = = = = = = = = =// 24: HTML block tags can contain trailing spaces //- - - - - - - - -// //- - - - - - - - -// //= = = = = = = = = = = = = = = = = = = = = = = =// 25: Indented code blocks can start with tab //- - - - - - - - -// x //- - - - - - - - -//
	x
//= = = = = = = = = = = = = = = = = = = = = = = =// 26: NUL bytes must be replaced with U+FFFD OPTIONS: {"enableEscape": true} //- - - - - - - - -// hello\x00world hello\ufffdworld

x

x

//= = = = = = = = = = = = = = = = = = = = = = = =// 28: Single # is a heading level 1 //- - - - - - - - -// # //- - - - - - - - -//

//= = = = = = = = = = = = = = = = = = = = = = = =// 29: An empty list item cannot interrupt a paragraph //- - - - - - - - -// x * //- - - - - - - - -//

x *

//= = = = = = = = = = = = = = = = = = = = = = = =// 30: A link reference definition followed by a single quote without closer //- - - - - - - - -// [x] [x]: <> ' //- - - - - - - - -//

x

'

//= = = = = = = = = = = = = = = = = = = = = = = =// 31: A link reference definition followed by a double quote without closer //- - - - - - - - -// [x] [x]: <> " //- - - - - - - - -//

x

"

//= = = = = = = = = = = = = = = = = = = = = = = =// 32: Hex character entities must be limited to 6 characters //- - - - - - - - -// A //- - - - - - - - -//

&#x0000041;

//= = = = = = = = = = = = = = = = = = = = = = = =// 33: \x01 should be escaped all the time OPTIONS: {"enableEscape": true} //- - - - - - - - -// [x](\x01) //- - - - - - - - -//

x

//= = = = = = = = = = = = = = = = = = = = = = = =// 34: A form feed should not be treated as a space OPTIONS: {"enableEscape": true} //- - - - - - - - -// x \f //- - - - - - - - -//

x \f

//= = = = = = = = = = = = = = = = = = = = = = = =// 35: A link reference definition can contain a new line //- - - - - - - - -// This is a [test][foo bar] 1...2..3... [foo bar]: / //- - - - - - - - -//

This is a test 1...2..3...

//= = = = = = = = = = = = = = = = = = = = = = = =// 36: Emphasis and links //- - - - - - - - -// _a[b_c_](d) //- - - - - - - - -//

_ab_c_

//= = = = = = = = = = = = = = = = = = = = = = = =// 37: Tabs and spaces OPTIONS: {"enableEscape": true} //- - - - - - - - -// \t\t x\n //- - - - - - - - -//
\t x\n
//= = = = = = = = = = = = = = = = = = = = = = = =// 38: Decimal HTML entity literals should allow 7 digits //- - - - - - - - -// � //- - - - - - - - -//

\uFFFD

//= = = = = = = = = = = = = = = = = = = = = = = =// 39: Decimal HTML entities should not be interpreted as octal when starting with a 0 //- - - - - - - - -// d //- - - - - - - - -//

d

//= = = = = = = = = = = = = = = = = = = = = = = =// 40: Invalid HTML tag names //- - - - - - - - -// <1> < p> //- - - - - - - - -//

<1>

<a:>

<a\f>

< p>

//= = = = = = = = = = = = = = = = = = = = = = = =// 41: Link references can not contain spaces after link label //- - - - - - - - -// [x] :> [o] :x //- - - - - - - - -//

[x] :>

[o] :x

//= = = = = = = = = = = = = = = = = = = = = = = =// 42: Unclosed link reference titles can interrupt link references //- - - - - - - - -// [r]: <> ' [o]: x ' //- - - - - - - - -//

'

'

//= = = = = = = = = = = = = = = = = = = = = = = =// 43: A link containing an image containing a link should disable the outer link //- - - - - - - - -// [ ![ [b](c) ](x) ](y) //- - - - - - - - -//

[  b ](y)

//= = = = = = = = = = = = = = = = = = = = = = = =// 44: An empty list item(with trailing spaces) cannot interrupt a paragraph //- - - - - - - - -// a * //- - - - - - - - -//

a *

//= = = = = = = = = = = = = = = = = = = = = = = =// 45: Multiple empty list items //- - - - - - - - -// - - //- - - - - - - - -//
//= = = = = = = = = = = = = = = = = = = = = = = =// 46: Vertical tab should not be treated as spaces OPTIONS: {"enableEscape": true} //- - - - - - - - -// \v //- - - - - - - - -//

\v

//= = = = = = = = = = = = = = = = = = = = = = = =// 47: Escape back slashes should not be treated as hard line breaks //- - - - - - - - -// \\\\ a //- - - - - - - - -//

\ a

//= = = = = = = = = = = = = = = = = = = = = = = =// 48: Multiple paragraphs in tight list //- - - - - - - - -// - a > b //- - - - - - - - -//
  • a
    b
//= = = = = = = = = = = = = = = = = = = = = = = =// 49: A list item that is indented up to 3 spaces after an empty list item //- - - - - - - - -// 1. 1. b - - b //- - - - - - - - -//
  1. b

  • b

//= = = = = = = = = = = = = = = = = = = = = = = =// 50: Spaces before a visible hard linebreak should be preserved //- - - - - - - - -// a \ b //- - - - - - - - -//

a
b

//= = = = = = = = = = = = = = = = = = = = = = = =// 51: Empty line in a fenced code block under list items //- - - - - - - - -// * This is a list item ``` This is a test This line will be dropped. This line will be displayed. ``` //- - - - - - - - -//
  • This is a list item
    This is a test
    
    This line will be dropped.
    This line will be displayed.
    
//= = = = = = = = = = = = = = = = = = = = = = = =// 52: windows-style newline and HTMLs OPTIONS: {"enableEscape": true} //- - - - - - - - -// link //- - - - - - - - -//

link

//= = = = = = = = = = = = = = = = = = = = = = = =// 53: HTML comment without trailing new lines OPTIONS: {"trim": true} //- - - - - - - - -// //- - - - - - - - -// //= = = = = = = = = = = = = = = = = = = = = = = =// 54: Escaped characters followed by a null character OPTIONS: {"enableEscape": true} //- - - - - - - - -// \\\x00\" //- - - - - - - - -//

\\\ufffd"

//= = = = = = = = = = = = = = = = = = = = = = = =// 55: inline HTML comment //- - - - - - - - -// a c a //- - - - - - - - -//

a c

a

//= = = = = = = = = = = = = = = = = = = = = = = =// 56: An empty list followed by blockquote //- - - - - - - - -// 1. > This is a quote. //- - - - - - - - -//

This is a quote.

//= = = = = = = = = = = = = = = = = = = = = = = =// 57: Tabbed fenced code block within a list //- - - - - - - - -// 1. ``` ``` //- - - - - - - - -//
//= = = = = = = = = = = = = = = = = = = = = = = =// 58: HTML end tag without trailing new lines OPTIONS: {"trim": true} //- - - - - - - - -//

//- - - - - - - - -//

//= = = = = = = = = = = = = = = = = = = = = = = =//

59: Raw HTML tag with one new line
//- - - - - - - - -//

//- - - - - - - - -//

//= = = = = = = = = = = = = = = = = = = = = = = =// 60: Raw HTML tag with multiple new lines //- - - - - - - - -// //- - - - - - - - -//

<img src=./.assets/logo.svg

/>

//= = = = = = = = = = = = = = = = = = = = = = = =// 61: Image alt with a new line //- - - - - - - - -// ![alt text](logo.png) //- - - - - - - - -//

alt
text

//= = = = = = = = = = = = = = = = = = = = = = = =// 62: Image alt with an escaped character //- - - - - - - - -// ![\`alt](https://example.com/img.png) //- - - - - - - - -//

`alt

//= = = = = = = = = = = = = = = = = = = = = = = =// 63: Emphasis in link label //- - - - - - - - -// [*[a]*](b) //- - - - - - - - -//

[a]

//= = = = = = = = = = = = = = = = = = = = = = = =// goldmark-1.7.4/_test/options.txt000066400000000000000000000043361463655211100167070ustar00rootroot000000000000001 //- - - - - - - - -// ## Title 0 ## Title1 # {#id_1 .class-1} ## Title2 {#id_2} ## Title3 ## {#id_3 .class-3} ## Title4 ## {data-attr3=value3} ## Title5 ## {#id_5 data-attr5=value5} ## Title6 ## {#id_6 .class6 data-attr6=value6} ## Title7 ## {#id_7 data-attr7="value \"7"} ## Title8 {#id .className data-attrName=attrValue class="class1 class2"} //- - - - - - - - -//

Title 0

Title1

Title2

Title3

Title4

Title5

Title6

Title7

Title8

//= = = = = = = = = = = = = = = = = = = = = = = =// 2 //- - - - - - - - -// # # FOO //- - - - - - - - -//

FOO

//= = = = = = = = = = = = = = = = = = = = = = = =// 3 //- - - - - - - - -// ## `records(self, zone, params={})` //- - - - - - - - -//

records(self, zone, params={})

//= = = = = = = = = = = = = = = = = = = = = = = =// 4 //- - - - - - - - -// ## Test {#hey .sort,class=fine,class=shell} Doesn't matter //- - - - - - - - -//

Test {#hey .sort,class=fine,class=shell} Doesn't matter

//= = = = = = = = = = = = = = = = = = = = = = = =// 5 //- - - - - - - - -// ## Test ## {#hey .sort,class=fine,class=shell} Doesn't matter //- - - - - - - - -//

Test ## {#hey .sort,class=fine,class=shell} Doesn't matter

//= = = = = = = = = = = = = = = = = = = = = = = =// 6: class must be a string //- - - - - - - - -// # Test ## {class=0#.} //- - - - - - - - -//

Test ## {class=0#.}

//= = = = = = = = = = = = = = = = = = = = = = = =// 7: short handed ids can contain hyphens ("-"), underscores ("_"), colons (":"), and periods (".") //- - - - - - - - -// # Test ## {#id-foo_bar:baz.qux .foobar} //- - - - - - - - -//

Test

//= = = = = = = = = = = = = = = = = = = = = = = =// goldmark-1.7.4/_test/spec.json000066400000000000000000004223071463655211100163020ustar00rootroot00000000000000[ { "markdown": "\tfoo\tbaz\t\tbim\n", "html": "
foo\tbaz\t\tbim\n
\n", "example": 1, "start_line": 355, "end_line": 360, "section": "Tabs" }, { "markdown": " \tfoo\tbaz\t\tbim\n", "html": "
foo\tbaz\t\tbim\n
\n", "example": 2, "start_line": 362, "end_line": 367, "section": "Tabs" }, { "markdown": " a\ta\n ὐ\ta\n", "html": "
a\ta\nὐ\ta\n
\n", "example": 3, "start_line": 369, "end_line": 376, "section": "Tabs" }, { "markdown": " - foo\n\n\tbar\n", "html": "
    \n
  • \n

    foo

    \n

    bar

    \n
  • \n
\n", "example": 4, "start_line": 382, "end_line": 393, "section": "Tabs" }, { "markdown": "- foo\n\n\t\tbar\n", "html": "
    \n
  • \n

    foo

    \n
      bar\n
    \n
  • \n
\n", "example": 5, "start_line": 395, "end_line": 407, "section": "Tabs" }, { "markdown": ">\t\tfoo\n", "html": "
\n
  foo\n
\n
\n", "example": 6, "start_line": 418, "end_line": 425, "section": "Tabs" }, { "markdown": "-\t\tfoo\n", "html": "
    \n
  • \n
      foo\n
    \n
  • \n
\n", "example": 7, "start_line": 427, "end_line": 436, "section": "Tabs" }, { "markdown": " foo\n\tbar\n", "html": "
foo\nbar\n
\n", "example": 8, "start_line": 439, "end_line": 446, "section": "Tabs" }, { "markdown": " - foo\n - bar\n\t - baz\n", "html": "
    \n
  • foo\n
      \n
    • bar\n
        \n
      • baz
      • \n
      \n
    • \n
    \n
  • \n
\n", "example": 9, "start_line": 448, "end_line": 464, "section": "Tabs" }, { "markdown": "#\tFoo\n", "html": "

Foo

\n", "example": 10, "start_line": 466, "end_line": 470, "section": "Tabs" }, { "markdown": "*\t*\t*\t\n", "html": "
\n", "example": 11, "start_line": 472, "end_line": 476, "section": "Tabs" }, { "markdown": "\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~\n", "html": "

!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~

\n", "example": 12, "start_line": 489, "end_line": 493, "section": "Backslash escapes" }, { "markdown": "\\\t\\A\\a\\ \\3\\φ\\«\n", "html": "

\\\t\\A\\a\\ \\3\\φ\\«

\n", "example": 13, "start_line": 499, "end_line": 503, "section": "Backslash escapes" }, { "markdown": "\\*not emphasized*\n\\
not a tag\n\\[not a link](/foo)\n\\`not code`\n1\\. not a list\n\\* not a list\n\\# not a heading\n\\[foo]: /url \"not a reference\"\n\\ö not a character entity\n", "html": "

*not emphasized*\n<br/> not a tag\n[not a link](/foo)\n`not code`\n1. not a list\n* not a list\n# not a heading\n[foo]: /url "not a reference"\n&ouml; not a character entity

\n", "example": 14, "start_line": 509, "end_line": 529, "section": "Backslash escapes" }, { "markdown": "\\\\*emphasis*\n", "html": "

\\emphasis

\n", "example": 15, "start_line": 534, "end_line": 538, "section": "Backslash escapes" }, { "markdown": "foo\\\nbar\n", "html": "

foo
\nbar

\n", "example": 16, "start_line": 543, "end_line": 549, "section": "Backslash escapes" }, { "markdown": "`` \\[\\` ``\n", "html": "

\\[\\`

\n", "example": 17, "start_line": 555, "end_line": 559, "section": "Backslash escapes" }, { "markdown": " \\[\\]\n", "html": "
\\[\\]\n
\n", "example": 18, "start_line": 562, "end_line": 567, "section": "Backslash escapes" }, { "markdown": "~~~\n\\[\\]\n~~~\n", "html": "
\\[\\]\n
\n", "example": 19, "start_line": 570, "end_line": 577, "section": "Backslash escapes" }, { "markdown": "\n", "html": "

https://example.com?find=\\*

\n", "example": 20, "start_line": 580, "end_line": 584, "section": "Backslash escapes" }, { "markdown": "\n", "html": "\n", "example": 21, "start_line": 587, "end_line": 591, "section": "Backslash escapes" }, { "markdown": "[foo](/bar\\* \"ti\\*tle\")\n", "html": "

foo

\n", "example": 22, "start_line": 597, "end_line": 601, "section": "Backslash escapes" }, { "markdown": "[foo]\n\n[foo]: /bar\\* \"ti\\*tle\"\n", "html": "

foo

\n", "example": 23, "start_line": 604, "end_line": 610, "section": "Backslash escapes" }, { "markdown": "``` foo\\+bar\nfoo\n```\n", "html": "
foo\n
\n", "example": 24, "start_line": 613, "end_line": 620, "section": "Backslash escapes" }, { "markdown": "  & © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸\n", "html": "

  & © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸

\n", "example": 25, "start_line": 649, "end_line": 657, "section": "Entity and numeric character references" }, { "markdown": "# Ӓ Ϡ �\n", "html": "

# Ӓ Ϡ �

\n", "example": 26, "start_line": 668, "end_line": 672, "section": "Entity and numeric character references" }, { "markdown": "" ആ ಫ\n", "html": "

" ആ ಫ

\n", "example": 27, "start_line": 681, "end_line": 685, "section": "Entity and numeric character references" }, { "markdown": "  &x; &#; &#x;\n�\n&#abcdef0;\n&ThisIsNotDefined; &hi?;\n", "html": "

&nbsp &x; &#; &#x;\n&#87654321;\n&#abcdef0;\n&ThisIsNotDefined; &hi?;

\n", "example": 28, "start_line": 690, "end_line": 700, "section": "Entity and numeric character references" }, { "markdown": "©\n", "html": "

&copy

\n", "example": 29, "start_line": 707, "end_line": 711, "section": "Entity and numeric character references" }, { "markdown": "&MadeUpEntity;\n", "html": "

&MadeUpEntity;

\n", "example": 30, "start_line": 717, "end_line": 721, "section": "Entity and numeric character references" }, { "markdown": "\n", "html": "\n", "example": 31, "start_line": 728, "end_line": 732, "section": "Entity and numeric character references" }, { "markdown": "[foo](/föö \"föö\")\n", "html": "

foo

\n", "example": 32, "start_line": 735, "end_line": 739, "section": "Entity and numeric character references" }, { "markdown": "[foo]\n\n[foo]: /föö \"föö\"\n", "html": "

foo

\n", "example": 33, "start_line": 742, "end_line": 748, "section": "Entity and numeric character references" }, { "markdown": "``` föö\nfoo\n```\n", "html": "
foo\n
\n", "example": 34, "start_line": 751, "end_line": 758, "section": "Entity and numeric character references" }, { "markdown": "`föö`\n", "html": "

f&ouml;&ouml;

\n", "example": 35, "start_line": 764, "end_line": 768, "section": "Entity and numeric character references" }, { "markdown": " föfö\n", "html": "
f&ouml;f&ouml;\n
\n", "example": 36, "start_line": 771, "end_line": 776, "section": "Entity and numeric character references" }, { "markdown": "*foo*\n*foo*\n", "html": "

*foo*\nfoo

\n", "example": 37, "start_line": 783, "end_line": 789, "section": "Entity and numeric character references" }, { "markdown": "* foo\n\n* foo\n", "html": "

* foo

\n
    \n
  • foo
  • \n
\n", "example": 38, "start_line": 791, "end_line": 800, "section": "Entity and numeric character references" }, { "markdown": "foo bar\n", "html": "

foo\n\nbar

\n", "example": 39, "start_line": 802, "end_line": 808, "section": "Entity and numeric character references" }, { "markdown": " foo\n", "html": "

\tfoo

\n", "example": 40, "start_line": 810, "end_line": 814, "section": "Entity and numeric character references" }, { "markdown": "[a](url "tit")\n", "html": "

[a](url "tit")

\n", "example": 41, "start_line": 817, "end_line": 821, "section": "Entity and numeric character references" }, { "markdown": "- `one\n- two`\n", "html": "
    \n
  • `one
  • \n
  • two`
  • \n
\n", "example": 42, "start_line": 840, "end_line": 848, "section": "Precedence" }, { "markdown": "***\n---\n___\n", "html": "
\n
\n
\n", "example": 43, "start_line": 879, "end_line": 887, "section": "Thematic breaks" }, { "markdown": "+++\n", "html": "

+++

\n", "example": 44, "start_line": 892, "end_line": 896, "section": "Thematic breaks" }, { "markdown": "===\n", "html": "

===

\n", "example": 45, "start_line": 899, "end_line": 903, "section": "Thematic breaks" }, { "markdown": "--\n**\n__\n", "html": "

--\n**\n__

\n", "example": 46, "start_line": 908, "end_line": 916, "section": "Thematic breaks" }, { "markdown": " ***\n ***\n ***\n", "html": "
\n
\n
\n", "example": 47, "start_line": 921, "end_line": 929, "section": "Thematic breaks" }, { "markdown": " ***\n", "html": "
***\n
\n", "example": 48, "start_line": 934, "end_line": 939, "section": "Thematic breaks" }, { "markdown": "Foo\n ***\n", "html": "

Foo\n***

\n", "example": 49, "start_line": 942, "end_line": 948, "section": "Thematic breaks" }, { "markdown": "_____________________________________\n", "html": "
\n", "example": 50, "start_line": 953, "end_line": 957, "section": "Thematic breaks" }, { "markdown": " - - -\n", "html": "
\n", "example": 51, "start_line": 962, "end_line": 966, "section": "Thematic breaks" }, { "markdown": " ** * ** * ** * **\n", "html": "
\n", "example": 52, "start_line": 969, "end_line": 973, "section": "Thematic breaks" }, { "markdown": "- - - -\n", "html": "
\n", "example": 53, "start_line": 976, "end_line": 980, "section": "Thematic breaks" }, { "markdown": "- - - - \n", "html": "
\n", "example": 54, "start_line": 985, "end_line": 989, "section": "Thematic breaks" }, { "markdown": "_ _ _ _ a\n\na------\n\n---a---\n", "html": "

_ _ _ _ a

\n

a------

\n

---a---

\n", "example": 55, "start_line": 994, "end_line": 1004, "section": "Thematic breaks" }, { "markdown": " *-*\n", "html": "

-

\n", "example": 56, "start_line": 1010, "end_line": 1014, "section": "Thematic breaks" }, { "markdown": "- foo\n***\n- bar\n", "html": "
    \n
  • foo
  • \n
\n
\n
    \n
  • bar
  • \n
\n", "example": 57, "start_line": 1019, "end_line": 1031, "section": "Thematic breaks" }, { "markdown": "Foo\n***\nbar\n", "html": "

Foo

\n
\n

bar

\n", "example": 58, "start_line": 1036, "end_line": 1044, "section": "Thematic breaks" }, { "markdown": "Foo\n---\nbar\n", "html": "

Foo

\n

bar

\n", "example": 59, "start_line": 1053, "end_line": 1060, "section": "Thematic breaks" }, { "markdown": "* Foo\n* * *\n* Bar\n", "html": "
    \n
  • Foo
  • \n
\n
\n
    \n
  • Bar
  • \n
\n", "example": 60, "start_line": 1066, "end_line": 1078, "section": "Thematic breaks" }, { "markdown": "- Foo\n- * * *\n", "html": "
    \n
  • Foo
  • \n
  • \n
    \n
  • \n
\n", "example": 61, "start_line": 1083, "end_line": 1093, "section": "Thematic breaks" }, { "markdown": "# foo\n## foo\n### foo\n#### foo\n##### foo\n###### foo\n", "html": "

foo

\n

foo

\n

foo

\n

foo

\n
foo
\n
foo
\n", "example": 62, "start_line": 1112, "end_line": 1126, "section": "ATX headings" }, { "markdown": "####### foo\n", "html": "

####### foo

\n", "example": 63, "start_line": 1131, "end_line": 1135, "section": "ATX headings" }, { "markdown": "#5 bolt\n\n#hashtag\n", "html": "

#5 bolt

\n

#hashtag

\n", "example": 64, "start_line": 1146, "end_line": 1153, "section": "ATX headings" }, { "markdown": "\\## foo\n", "html": "

## foo

\n", "example": 65, "start_line": 1158, "end_line": 1162, "section": "ATX headings" }, { "markdown": "# foo *bar* \\*baz\\*\n", "html": "

foo bar *baz*

\n", "example": 66, "start_line": 1167, "end_line": 1171, "section": "ATX headings" }, { "markdown": "# foo \n", "html": "

foo

\n", "example": 67, "start_line": 1176, "end_line": 1180, "section": "ATX headings" }, { "markdown": " ### foo\n ## foo\n # foo\n", "html": "

foo

\n

foo

\n

foo

\n", "example": 68, "start_line": 1185, "end_line": 1193, "section": "ATX headings" }, { "markdown": " # foo\n", "html": "
# foo\n
\n", "example": 69, "start_line": 1198, "end_line": 1203, "section": "ATX headings" }, { "markdown": "foo\n # bar\n", "html": "

foo\n# bar

\n", "example": 70, "start_line": 1206, "end_line": 1212, "section": "ATX headings" }, { "markdown": "## foo ##\n ### bar ###\n", "html": "

foo

\n

bar

\n", "example": 71, "start_line": 1217, "end_line": 1223, "section": "ATX headings" }, { "markdown": "# foo ##################################\n##### foo ##\n", "html": "

foo

\n
foo
\n", "example": 72, "start_line": 1228, "end_line": 1234, "section": "ATX headings" }, { "markdown": "### foo ### \n", "html": "

foo

\n", "example": 73, "start_line": 1239, "end_line": 1243, "section": "ATX headings" }, { "markdown": "### foo ### b\n", "html": "

foo ### b

\n", "example": 74, "start_line": 1250, "end_line": 1254, "section": "ATX headings" }, { "markdown": "# foo#\n", "html": "

foo#

\n", "example": 75, "start_line": 1259, "end_line": 1263, "section": "ATX headings" }, { "markdown": "### foo \\###\n## foo #\\##\n# foo \\#\n", "html": "

foo ###

\n

foo ###

\n

foo #

\n", "example": 76, "start_line": 1269, "end_line": 1277, "section": "ATX headings" }, { "markdown": "****\n## foo\n****\n", "html": "
\n

foo

\n
\n", "example": 77, "start_line": 1283, "end_line": 1291, "section": "ATX headings" }, { "markdown": "Foo bar\n# baz\nBar foo\n", "html": "

Foo bar

\n

baz

\n

Bar foo

\n", "example": 78, "start_line": 1294, "end_line": 1302, "section": "ATX headings" }, { "markdown": "## \n#\n### ###\n", "html": "

\n

\n

\n", "example": 79, "start_line": 1307, "end_line": 1315, "section": "ATX headings" }, { "markdown": "Foo *bar*\n=========\n\nFoo *bar*\n---------\n", "html": "

Foo bar

\n

Foo bar

\n", "example": 80, "start_line": 1347, "end_line": 1356, "section": "Setext headings" }, { "markdown": "Foo *bar\nbaz*\n====\n", "html": "

Foo bar\nbaz

\n", "example": 81, "start_line": 1361, "end_line": 1368, "section": "Setext headings" }, { "markdown": " Foo *bar\nbaz*\t\n====\n", "html": "

Foo bar\nbaz

\n", "example": 82, "start_line": 1375, "end_line": 1382, "section": "Setext headings" }, { "markdown": "Foo\n-------------------------\n\nFoo\n=\n", "html": "

Foo

\n

Foo

\n", "example": 83, "start_line": 1387, "end_line": 1396, "section": "Setext headings" }, { "markdown": " Foo\n---\n\n Foo\n-----\n\n Foo\n ===\n", "html": "

Foo

\n

Foo

\n

Foo

\n", "example": 84, "start_line": 1402, "end_line": 1415, "section": "Setext headings" }, { "markdown": " Foo\n ---\n\n Foo\n---\n", "html": "
Foo\n---\n\nFoo\n
\n
\n", "example": 85, "start_line": 1420, "end_line": 1433, "section": "Setext headings" }, { "markdown": "Foo\n ---- \n", "html": "

Foo

\n", "example": 86, "start_line": 1439, "end_line": 1444, "section": "Setext headings" }, { "markdown": "Foo\n ---\n", "html": "

Foo\n---

\n", "example": 87, "start_line": 1449, "end_line": 1455, "section": "Setext headings" }, { "markdown": "Foo\n= =\n\nFoo\n--- -\n", "html": "

Foo\n= =

\n

Foo

\n
\n", "example": 88, "start_line": 1460, "end_line": 1471, "section": "Setext headings" }, { "markdown": "Foo \n-----\n", "html": "

Foo

\n", "example": 89, "start_line": 1476, "end_line": 1481, "section": "Setext headings" }, { "markdown": "Foo\\\n----\n", "html": "

Foo\\

\n", "example": 90, "start_line": 1486, "end_line": 1491, "section": "Setext headings" }, { "markdown": "`Foo\n----\n`\n\n\n", "html": "

`Foo

\n

`

\n

<a title="a lot

\n

of dashes"/>

\n", "example": 91, "start_line": 1497, "end_line": 1510, "section": "Setext headings" }, { "markdown": "> Foo\n---\n", "html": "
\n

Foo

\n
\n
\n", "example": 92, "start_line": 1516, "end_line": 1524, "section": "Setext headings" }, { "markdown": "> foo\nbar\n===\n", "html": "
\n

foo\nbar\n===

\n
\n", "example": 93, "start_line": 1527, "end_line": 1537, "section": "Setext headings" }, { "markdown": "- Foo\n---\n", "html": "
    \n
  • Foo
  • \n
\n
\n", "example": 94, "start_line": 1540, "end_line": 1548, "section": "Setext headings" }, { "markdown": "Foo\nBar\n---\n", "html": "

Foo\nBar

\n", "example": 95, "start_line": 1555, "end_line": 1562, "section": "Setext headings" }, { "markdown": "---\nFoo\n---\nBar\n---\nBaz\n", "html": "
\n

Foo

\n

Bar

\n

Baz

\n", "example": 96, "start_line": 1568, "end_line": 1580, "section": "Setext headings" }, { "markdown": "\n====\n", "html": "

====

\n", "example": 97, "start_line": 1585, "end_line": 1590, "section": "Setext headings" }, { "markdown": "---\n---\n", "html": "
\n
\n", "example": 98, "start_line": 1597, "end_line": 1603, "section": "Setext headings" }, { "markdown": "- foo\n-----\n", "html": "
    \n
  • foo
  • \n
\n
\n", "example": 99, "start_line": 1606, "end_line": 1614, "section": "Setext headings" }, { "markdown": " foo\n---\n", "html": "
foo\n
\n
\n", "example": 100, "start_line": 1617, "end_line": 1624, "section": "Setext headings" }, { "markdown": "> foo\n-----\n", "html": "
\n

foo

\n
\n
\n", "example": 101, "start_line": 1627, "end_line": 1635, "section": "Setext headings" }, { "markdown": "\\> foo\n------\n", "html": "

> foo

\n", "example": 102, "start_line": 1641, "end_line": 1646, "section": "Setext headings" }, { "markdown": "Foo\n\nbar\n---\nbaz\n", "html": "

Foo

\n

bar

\n

baz

\n", "example": 103, "start_line": 1672, "end_line": 1682, "section": "Setext headings" }, { "markdown": "Foo\nbar\n\n---\n\nbaz\n", "html": "

Foo\nbar

\n
\n

baz

\n", "example": 104, "start_line": 1688, "end_line": 1700, "section": "Setext headings" }, { "markdown": "Foo\nbar\n* * *\nbaz\n", "html": "

Foo\nbar

\n
\n

baz

\n", "example": 105, "start_line": 1706, "end_line": 1716, "section": "Setext headings" }, { "markdown": "Foo\nbar\n\\---\nbaz\n", "html": "

Foo\nbar\n---\nbaz

\n", "example": 106, "start_line": 1721, "end_line": 1731, "section": "Setext headings" }, { "markdown": " a simple\n indented code block\n", "html": "
a simple\n  indented code block\n
\n", "example": 107, "start_line": 1749, "end_line": 1756, "section": "Indented code blocks" }, { "markdown": " - foo\n\n bar\n", "html": "
    \n
  • \n

    foo

    \n

    bar

    \n
  • \n
\n", "example": 108, "start_line": 1763, "end_line": 1774, "section": "Indented code blocks" }, { "markdown": "1. foo\n\n - bar\n", "html": "
    \n
  1. \n

    foo

    \n
      \n
    • bar
    • \n
    \n
  2. \n
\n", "example": 109, "start_line": 1777, "end_line": 1790, "section": "Indented code blocks" }, { "markdown": "
\n *hi*\n\n - one\n", "html": "
<a/>\n*hi*\n\n- one\n
\n", "example": 110, "start_line": 1797, "end_line": 1808, "section": "Indented code blocks" }, { "markdown": " chunk1\n\n chunk2\n \n \n \n chunk3\n", "html": "
chunk1\n\nchunk2\n\n\n\nchunk3\n
\n", "example": 111, "start_line": 1813, "end_line": 1830, "section": "Indented code blocks" }, { "markdown": " chunk1\n \n chunk2\n", "html": "
chunk1\n  \n  chunk2\n
\n", "example": 112, "start_line": 1836, "end_line": 1845, "section": "Indented code blocks" }, { "markdown": "Foo\n bar\n\n", "html": "

Foo\nbar

\n", "example": 113, "start_line": 1851, "end_line": 1858, "section": "Indented code blocks" }, { "markdown": " foo\nbar\n", "html": "
foo\n
\n

bar

\n", "example": 114, "start_line": 1865, "end_line": 1872, "section": "Indented code blocks" }, { "markdown": "# Heading\n foo\nHeading\n------\n foo\n----\n", "html": "

Heading

\n
foo\n
\n

Heading

\n
foo\n
\n
\n", "example": 115, "start_line": 1878, "end_line": 1893, "section": "Indented code blocks" }, { "markdown": " foo\n bar\n", "html": "
    foo\nbar\n
\n", "example": 116, "start_line": 1898, "end_line": 1905, "section": "Indented code blocks" }, { "markdown": "\n \n foo\n \n\n", "html": "
foo\n
\n", "example": 117, "start_line": 1911, "end_line": 1920, "section": "Indented code blocks" }, { "markdown": " foo \n", "html": "
foo  \n
\n", "example": 118, "start_line": 1925, "end_line": 1930, "section": "Indented code blocks" }, { "markdown": "```\n<\n >\n```\n", "html": "
<\n >\n
\n", "example": 119, "start_line": 1980, "end_line": 1989, "section": "Fenced code blocks" }, { "markdown": "~~~\n<\n >\n~~~\n", "html": "
<\n >\n
\n", "example": 120, "start_line": 1994, "end_line": 2003, "section": "Fenced code blocks" }, { "markdown": "``\nfoo\n``\n", "html": "

foo

\n", "example": 121, "start_line": 2007, "end_line": 2013, "section": "Fenced code blocks" }, { "markdown": "```\naaa\n~~~\n```\n", "html": "
aaa\n~~~\n
\n", "example": 122, "start_line": 2018, "end_line": 2027, "section": "Fenced code blocks" }, { "markdown": "~~~\naaa\n```\n~~~\n", "html": "
aaa\n```\n
\n", "example": 123, "start_line": 2030, "end_line": 2039, "section": "Fenced code blocks" }, { "markdown": "````\naaa\n```\n``````\n", "html": "
aaa\n```\n
\n", "example": 124, "start_line": 2044, "end_line": 2053, "section": "Fenced code blocks" }, { "markdown": "~~~~\naaa\n~~~\n~~~~\n", "html": "
aaa\n~~~\n
\n", "example": 125, "start_line": 2056, "end_line": 2065, "section": "Fenced code blocks" }, { "markdown": "```\n", "html": "
\n", "example": 126, "start_line": 2071, "end_line": 2075, "section": "Fenced code blocks" }, { "markdown": "`````\n\n```\naaa\n", "html": "
\n```\naaa\n
\n", "example": 127, "start_line": 2078, "end_line": 2088, "section": "Fenced code blocks" }, { "markdown": "> ```\n> aaa\n\nbbb\n", "html": "
\n
aaa\n
\n
\n

bbb

\n", "example": 128, "start_line": 2091, "end_line": 2102, "section": "Fenced code blocks" }, { "markdown": "```\n\n \n```\n", "html": "
\n  \n
\n", "example": 129, "start_line": 2107, "end_line": 2116, "section": "Fenced code blocks" }, { "markdown": "```\n```\n", "html": "
\n", "example": 130, "start_line": 2121, "end_line": 2126, "section": "Fenced code blocks" }, { "markdown": " ```\n aaa\naaa\n```\n", "html": "
aaa\naaa\n
\n", "example": 131, "start_line": 2133, "end_line": 2142, "section": "Fenced code blocks" }, { "markdown": " ```\naaa\n aaa\naaa\n ```\n", "html": "
aaa\naaa\naaa\n
\n", "example": 132, "start_line": 2145, "end_line": 2156, "section": "Fenced code blocks" }, { "markdown": " ```\n aaa\n aaa\n aaa\n ```\n", "html": "
aaa\n aaa\naaa\n
\n", "example": 133, "start_line": 2159, "end_line": 2170, "section": "Fenced code blocks" }, { "markdown": " ```\n aaa\n ```\n", "html": "
```\naaa\n```\n
\n", "example": 134, "start_line": 2175, "end_line": 2184, "section": "Fenced code blocks" }, { "markdown": "```\naaa\n ```\n", "html": "
aaa\n
\n", "example": 135, "start_line": 2190, "end_line": 2197, "section": "Fenced code blocks" }, { "markdown": " ```\naaa\n ```\n", "html": "
aaa\n
\n", "example": 136, "start_line": 2200, "end_line": 2207, "section": "Fenced code blocks" }, { "markdown": "```\naaa\n ```\n", "html": "
aaa\n    ```\n
\n", "example": 137, "start_line": 2212, "end_line": 2220, "section": "Fenced code blocks" }, { "markdown": "``` ```\naaa\n", "html": "

\naaa

\n", "example": 138, "start_line": 2226, "end_line": 2232, "section": "Fenced code blocks" }, { "markdown": "~~~~~~\naaa\n~~~ ~~\n", "html": "
aaa\n~~~ ~~\n
\n", "example": 139, "start_line": 2235, "end_line": 2243, "section": "Fenced code blocks" }, { "markdown": "foo\n```\nbar\n```\nbaz\n", "html": "

foo

\n
bar\n
\n

baz

\n", "example": 140, "start_line": 2249, "end_line": 2260, "section": "Fenced code blocks" }, { "markdown": "foo\n---\n~~~\nbar\n~~~\n# baz\n", "html": "

foo

\n
bar\n
\n

baz

\n", "example": 141, "start_line": 2266, "end_line": 2278, "section": "Fenced code blocks" }, { "markdown": "```ruby\ndef foo(x)\n return 3\nend\n```\n", "html": "
def foo(x)\n  return 3\nend\n
\n", "example": 142, "start_line": 2288, "end_line": 2299, "section": "Fenced code blocks" }, { "markdown": "~~~~ ruby startline=3 $%@#$\ndef foo(x)\n return 3\nend\n~~~~~~~\n", "html": "
def foo(x)\n  return 3\nend\n
\n", "example": 143, "start_line": 2302, "end_line": 2313, "section": "Fenced code blocks" }, { "markdown": "````;\n````\n", "html": "
\n", "example": 144, "start_line": 2316, "end_line": 2321, "section": "Fenced code blocks" }, { "markdown": "``` aa ```\nfoo\n", "html": "

aa\nfoo

\n", "example": 145, "start_line": 2326, "end_line": 2332, "section": "Fenced code blocks" }, { "markdown": "~~~ aa ``` ~~~\nfoo\n~~~\n", "html": "
foo\n
\n", "example": 146, "start_line": 2337, "end_line": 2344, "section": "Fenced code blocks" }, { "markdown": "```\n``` aaa\n```\n", "html": "
``` aaa\n
\n", "example": 147, "start_line": 2349, "end_line": 2356, "section": "Fenced code blocks" }, { "markdown": "
\n
\n**Hello**,\n\n_world_.\n
\n
\n", "html": "
\n
\n**Hello**,\n

world.\n

\n
\n", "example": 148, "start_line": 2428, "end_line": 2443, "section": "HTML blocks" }, { "markdown": "\n \n \n \n
\n hi\n
\n\nokay.\n", "html": "\n \n \n \n
\n hi\n
\n

okay.

\n", "example": 149, "start_line": 2457, "end_line": 2476, "section": "HTML blocks" }, { "markdown": "
\n*foo*\n", "example": 151, "start_line": 2492, "end_line": 2498, "section": "HTML blocks" }, { "markdown": "
\n\n*Markdown*\n\n
\n", "html": "
\n

Markdown

\n
\n", "example": 152, "start_line": 2503, "end_line": 2513, "section": "HTML blocks" }, { "markdown": "
\n
\n", "html": "
\n
\n", "example": 153, "start_line": 2519, "end_line": 2527, "section": "HTML blocks" }, { "markdown": "
\n
\n", "html": "
\n
\n", "example": 154, "start_line": 2530, "end_line": 2538, "section": "HTML blocks" }, { "markdown": "
\n*foo*\n\n*bar*\n", "html": "
\n*foo*\n

bar

\n", "example": 155, "start_line": 2542, "end_line": 2551, "section": "HTML blocks" }, { "markdown": "
\n", "html": "\n", "example": 159, "start_line": 2591, "end_line": 2595, "section": "HTML blocks" }, { "markdown": "
\nfoo\n
\n", "html": "
\nfoo\n
\n", "example": 160, "start_line": 2598, "end_line": 2606, "section": "HTML blocks" }, { "markdown": "
\n``` c\nint x = 33;\n```\n", "html": "
\n``` c\nint x = 33;\n```\n", "example": 161, "start_line": 2615, "end_line": 2625, "section": "HTML blocks" }, { "markdown": "\n*bar*\n\n", "html": "\n*bar*\n\n", "example": 162, "start_line": 2632, "end_line": 2640, "section": "HTML blocks" }, { "markdown": "\n*bar*\n\n", "html": "\n*bar*\n\n", "example": 163, "start_line": 2645, "end_line": 2653, "section": "HTML blocks" }, { "markdown": "\n*bar*\n\n", "html": "\n*bar*\n\n", "example": 164, "start_line": 2656, "end_line": 2664, "section": "HTML blocks" }, { "markdown": "\n*bar*\n", "html": "\n*bar*\n", "example": 165, "start_line": 2667, "end_line": 2673, "section": "HTML blocks" }, { "markdown": "\n*foo*\n\n", "html": "\n*foo*\n\n", "example": 166, "start_line": 2682, "end_line": 2690, "section": "HTML blocks" }, { "markdown": "\n\n*foo*\n\n\n", "html": "\n

foo

\n
\n", "example": 167, "start_line": 2697, "end_line": 2707, "section": "HTML blocks" }, { "markdown": "*foo*\n", "html": "

foo

\n", "example": 168, "start_line": 2715, "end_line": 2719, "section": "HTML blocks" }, { "markdown": "
\nimport Text.HTML.TagSoup\n\nmain :: IO ()\nmain = print $ parseTags tags\n
\nokay\n", "html": "
\nimport Text.HTML.TagSoup\n\nmain :: IO ()\nmain = print $ parseTags tags\n
\n

okay

\n", "example": 169, "start_line": 2731, "end_line": 2747, "section": "HTML blocks" }, { "markdown": "\nokay\n", "html": "\n

okay

\n", "example": 170, "start_line": 2752, "end_line": 2766, "section": "HTML blocks" }, { "markdown": "\n", "html": "\n", "example": 171, "start_line": 2771, "end_line": 2787, "section": "HTML blocks" }, { "markdown": "\nh1 {color:red;}\n\np {color:blue;}\n\nokay\n", "html": "\nh1 {color:red;}\n\np {color:blue;}\n\n

okay

\n", "example": 172, "start_line": 2791, "end_line": 2807, "section": "HTML blocks" }, { "markdown": "\n\nfoo\n", "html": "\n\nfoo\n", "example": 173, "start_line": 2814, "end_line": 2824, "section": "HTML blocks" }, { "markdown": ">
\n> foo\n\nbar\n", "html": "
\n
\nfoo\n
\n

bar

\n", "example": 174, "start_line": 2827, "end_line": 2838, "section": "HTML blocks" }, { "markdown": "-
\n- foo\n", "html": "
    \n
  • \n
    \n
  • \n
  • foo
  • \n
\n", "example": 175, "start_line": 2841, "end_line": 2851, "section": "HTML blocks" }, { "markdown": "\n*foo*\n", "html": "\n

foo

\n", "example": 176, "start_line": 2856, "end_line": 2862, "section": "HTML blocks" }, { "markdown": "*bar*\n*baz*\n", "html": "*bar*\n

baz

\n", "example": 177, "start_line": 2865, "end_line": 2871, "section": "HTML blocks" }, { "markdown": "1. *bar*\n", "html": "1. *bar*\n", "example": 178, "start_line": 2877, "end_line": 2885, "section": "HTML blocks" }, { "markdown": "\nokay\n", "html": "\n

okay

\n", "example": 179, "start_line": 2890, "end_line": 2902, "section": "HTML blocks" }, { "markdown": "';\n\n?>\nokay\n", "html": "';\n\n?>\n

okay

\n", "example": 180, "start_line": 2908, "end_line": 2922, "section": "HTML blocks" }, { "markdown": "\n", "html": "\n", "example": 181, "start_line": 2927, "end_line": 2931, "section": "HTML blocks" }, { "markdown": "\nokay\n", "html": "\n

okay

\n", "example": 182, "start_line": 2936, "end_line": 2964, "section": "HTML blocks" }, { "markdown": " \n\n \n", "html": " \n
<!-- foo -->\n
\n", "example": 183, "start_line": 2970, "end_line": 2978, "section": "HTML blocks" }, { "markdown": "
\n\n
\n", "html": "
\n
<div>\n
\n", "example": 184, "start_line": 2981, "end_line": 2989, "section": "HTML blocks" }, { "markdown": "Foo\n
\nbar\n
\n", "html": "

Foo

\n
\nbar\n
\n", "example": 185, "start_line": 2995, "end_line": 3005, "section": "HTML blocks" }, { "markdown": "
\nbar\n
\n*foo*\n", "html": "
\nbar\n
\n*foo*\n", "example": 186, "start_line": 3012, "end_line": 3022, "section": "HTML blocks" }, { "markdown": "Foo\n\nbaz\n", "html": "

Foo\n\nbaz

\n", "example": 187, "start_line": 3027, "end_line": 3035, "section": "HTML blocks" }, { "markdown": "
\n\n*Emphasized* text.\n\n
\n", "html": "
\n

Emphasized text.

\n
\n", "example": 188, "start_line": 3068, "end_line": 3078, "section": "HTML blocks" }, { "markdown": "
\n*Emphasized* text.\n
\n", "html": "
\n*Emphasized* text.\n
\n", "example": 189, "start_line": 3081, "end_line": 3089, "section": "HTML blocks" }, { "markdown": "\n\n\n\n\n\n\n\n
\nHi\n
\n", "html": "\n\n\n\n
\nHi\n
\n", "example": 190, "start_line": 3103, "end_line": 3123, "section": "HTML blocks" }, { "markdown": "\n\n \n\n \n\n \n\n
\n Hi\n
\n", "html": "\n \n
<td>\n  Hi\n</td>\n
\n \n
\n", "example": 191, "start_line": 3130, "end_line": 3151, "section": "HTML blocks" }, { "markdown": "[foo]: /url \"title\"\n\n[foo]\n", "html": "

foo

\n", "example": 192, "start_line": 3179, "end_line": 3185, "section": "Link reference definitions" }, { "markdown": " [foo]: \n /url \n 'the title' \n\n[foo]\n", "html": "

foo

\n", "example": 193, "start_line": 3188, "end_line": 3196, "section": "Link reference definitions" }, { "markdown": "[Foo*bar\\]]:my_(url) 'title (with parens)'\n\n[Foo*bar\\]]\n", "html": "

Foo*bar]

\n", "example": 194, "start_line": 3199, "end_line": 3205, "section": "Link reference definitions" }, { "markdown": "[Foo bar]:\n\n'title'\n\n[Foo bar]\n", "html": "

Foo bar

\n", "example": 195, "start_line": 3208, "end_line": 3216, "section": "Link reference definitions" }, { "markdown": "[foo]: /url '\ntitle\nline1\nline2\n'\n\n[foo]\n", "html": "

foo

\n", "example": 196, "start_line": 3221, "end_line": 3235, "section": "Link reference definitions" }, { "markdown": "[foo]: /url 'title\n\nwith blank line'\n\n[foo]\n", "html": "

[foo]: /url 'title

\n

with blank line'

\n

[foo]

\n", "example": 197, "start_line": 3240, "end_line": 3250, "section": "Link reference definitions" }, { "markdown": "[foo]:\n/url\n\n[foo]\n", "html": "

foo

\n", "example": 198, "start_line": 3255, "end_line": 3262, "section": "Link reference definitions" }, { "markdown": "[foo]:\n\n[foo]\n", "html": "

[foo]:

\n

[foo]

\n", "example": 199, "start_line": 3267, "end_line": 3274, "section": "Link reference definitions" }, { "markdown": "[foo]: <>\n\n[foo]\n", "html": "

foo

\n", "example": 200, "start_line": 3279, "end_line": 3285, "section": "Link reference definitions" }, { "markdown": "[foo]: (baz)\n\n[foo]\n", "html": "

[foo]: (baz)

\n

[foo]

\n", "example": 201, "start_line": 3290, "end_line": 3297, "section": "Link reference definitions" }, { "markdown": "[foo]: /url\\bar\\*baz \"foo\\\"bar\\baz\"\n\n[foo]\n", "html": "

foo

\n", "example": 202, "start_line": 3303, "end_line": 3309, "section": "Link reference definitions" }, { "markdown": "[foo]\n\n[foo]: url\n", "html": "

foo

\n", "example": 203, "start_line": 3314, "end_line": 3320, "section": "Link reference definitions" }, { "markdown": "[foo]\n\n[foo]: first\n[foo]: second\n", "html": "

foo

\n", "example": 204, "start_line": 3326, "end_line": 3333, "section": "Link reference definitions" }, { "markdown": "[FOO]: /url\n\n[Foo]\n", "html": "

Foo

\n", "example": 205, "start_line": 3339, "end_line": 3345, "section": "Link reference definitions" }, { "markdown": "[ΑΓΩ]: /φου\n\n[αγω]\n", "html": "

αγω

\n", "example": 206, "start_line": 3348, "end_line": 3354, "section": "Link reference definitions" }, { "markdown": "[foo]: /url\n", "html": "", "example": 207, "start_line": 3363, "end_line": 3366, "section": "Link reference definitions" }, { "markdown": "[\nfoo\n]: /url\nbar\n", "html": "

bar

\n", "example": 208, "start_line": 3371, "end_line": 3378, "section": "Link reference definitions" }, { "markdown": "[foo]: /url \"title\" ok\n", "html": "

[foo]: /url "title" ok

\n", "example": 209, "start_line": 3384, "end_line": 3388, "section": "Link reference definitions" }, { "markdown": "[foo]: /url\n\"title\" ok\n", "html": "

"title" ok

\n", "example": 210, "start_line": 3393, "end_line": 3398, "section": "Link reference definitions" }, { "markdown": " [foo]: /url \"title\"\n\n[foo]\n", "html": "
[foo]: /url "title"\n
\n

[foo]

\n", "example": 211, "start_line": 3404, "end_line": 3412, "section": "Link reference definitions" }, { "markdown": "```\n[foo]: /url\n```\n\n[foo]\n", "html": "
[foo]: /url\n
\n

[foo]

\n", "example": 212, "start_line": 3418, "end_line": 3428, "section": "Link reference definitions" }, { "markdown": "Foo\n[bar]: /baz\n\n[bar]\n", "html": "

Foo\n[bar]: /baz

\n

[bar]

\n", "example": 213, "start_line": 3433, "end_line": 3442, "section": "Link reference definitions" }, { "markdown": "# [Foo]\n[foo]: /url\n> bar\n", "html": "

Foo

\n
\n

bar

\n
\n", "example": 214, "start_line": 3448, "end_line": 3457, "section": "Link reference definitions" }, { "markdown": "[foo]: /url\nbar\n===\n[foo]\n", "html": "

bar

\n

foo

\n", "example": 215, "start_line": 3459, "end_line": 3467, "section": "Link reference definitions" }, { "markdown": "[foo]: /url\n===\n[foo]\n", "html": "

===\nfoo

\n", "example": 216, "start_line": 3469, "end_line": 3476, "section": "Link reference definitions" }, { "markdown": "[foo]: /foo-url \"foo\"\n[bar]: /bar-url\n \"bar\"\n[baz]: /baz-url\n\n[foo],\n[bar],\n[baz]\n", "html": "

foo,\nbar,\nbaz

\n", "example": 217, "start_line": 3482, "end_line": 3495, "section": "Link reference definitions" }, { "markdown": "[foo]\n\n> [foo]: /url\n", "html": "

foo

\n
\n
\n", "example": 218, "start_line": 3503, "end_line": 3511, "section": "Link reference definitions" }, { "markdown": "aaa\n\nbbb\n", "html": "

aaa

\n

bbb

\n", "example": 219, "start_line": 3525, "end_line": 3532, "section": "Paragraphs" }, { "markdown": "aaa\nbbb\n\nccc\nddd\n", "html": "

aaa\nbbb

\n

ccc\nddd

\n", "example": 220, "start_line": 3537, "end_line": 3548, "section": "Paragraphs" }, { "markdown": "aaa\n\n\nbbb\n", "html": "

aaa

\n

bbb

\n", "example": 221, "start_line": 3553, "end_line": 3561, "section": "Paragraphs" }, { "markdown": " aaa\n bbb\n", "html": "

aaa\nbbb

\n", "example": 222, "start_line": 3566, "end_line": 3572, "section": "Paragraphs" }, { "markdown": "aaa\n bbb\n ccc\n", "html": "

aaa\nbbb\nccc

\n", "example": 223, "start_line": 3578, "end_line": 3586, "section": "Paragraphs" }, { "markdown": " aaa\nbbb\n", "html": "

aaa\nbbb

\n", "example": 224, "start_line": 3592, "end_line": 3598, "section": "Paragraphs" }, { "markdown": " aaa\nbbb\n", "html": "
aaa\n
\n

bbb

\n", "example": 225, "start_line": 3601, "end_line": 3608, "section": "Paragraphs" }, { "markdown": "aaa \nbbb \n", "html": "

aaa
\nbbb

\n", "example": 226, "start_line": 3615, "end_line": 3621, "section": "Paragraphs" }, { "markdown": " \n\naaa\n \n\n# aaa\n\n \n", "html": "

aaa

\n

aaa

\n", "example": 227, "start_line": 3632, "end_line": 3644, "section": "Blank lines" }, { "markdown": "> # Foo\n> bar\n> baz\n", "html": "
\n

Foo

\n

bar\nbaz

\n
\n", "example": 228, "start_line": 3700, "end_line": 3710, "section": "Block quotes" }, { "markdown": "># Foo\n>bar\n> baz\n", "html": "
\n

Foo

\n

bar\nbaz

\n
\n", "example": 229, "start_line": 3715, "end_line": 3725, "section": "Block quotes" }, { "markdown": " > # Foo\n > bar\n > baz\n", "html": "
\n

Foo

\n

bar\nbaz

\n
\n", "example": 230, "start_line": 3730, "end_line": 3740, "section": "Block quotes" }, { "markdown": " > # Foo\n > bar\n > baz\n", "html": "
> # Foo\n> bar\n> baz\n
\n", "example": 231, "start_line": 3745, "end_line": 3754, "section": "Block quotes" }, { "markdown": "> # Foo\n> bar\nbaz\n", "html": "
\n

Foo

\n

bar\nbaz

\n
\n", "example": 232, "start_line": 3760, "end_line": 3770, "section": "Block quotes" }, { "markdown": "> bar\nbaz\n> foo\n", "html": "
\n

bar\nbaz\nfoo

\n
\n", "example": 233, "start_line": 3776, "end_line": 3786, "section": "Block quotes" }, { "markdown": "> foo\n---\n", "html": "
\n

foo

\n
\n
\n", "example": 234, "start_line": 3800, "end_line": 3808, "section": "Block quotes" }, { "markdown": "> - foo\n- bar\n", "html": "
\n
    \n
  • foo
  • \n
\n
\n
    \n
  • bar
  • \n
\n", "example": 235, "start_line": 3820, "end_line": 3832, "section": "Block quotes" }, { "markdown": "> foo\n bar\n", "html": "
\n
foo\n
\n
\n
bar\n
\n", "example": 236, "start_line": 3838, "end_line": 3848, "section": "Block quotes" }, { "markdown": "> ```\nfoo\n```\n", "html": "
\n
\n
\n

foo

\n
\n", "example": 237, "start_line": 3851, "end_line": 3861, "section": "Block quotes" }, { "markdown": "> foo\n - bar\n", "html": "
\n

foo\n- bar

\n
\n", "example": 238, "start_line": 3867, "end_line": 3875, "section": "Block quotes" }, { "markdown": ">\n", "html": "
\n
\n", "example": 239, "start_line": 3891, "end_line": 3896, "section": "Block quotes" }, { "markdown": ">\n> \n> \n", "html": "
\n
\n", "example": 240, "start_line": 3899, "end_line": 3906, "section": "Block quotes" }, { "markdown": ">\n> foo\n> \n", "html": "
\n

foo

\n
\n", "example": 241, "start_line": 3911, "end_line": 3919, "section": "Block quotes" }, { "markdown": "> foo\n\n> bar\n", "html": "
\n

foo

\n
\n
\n

bar

\n
\n", "example": 242, "start_line": 3924, "end_line": 3935, "section": "Block quotes" }, { "markdown": "> foo\n> bar\n", "html": "
\n

foo\nbar

\n
\n", "example": 243, "start_line": 3946, "end_line": 3954, "section": "Block quotes" }, { "markdown": "> foo\n>\n> bar\n", "html": "
\n

foo

\n

bar

\n
\n", "example": 244, "start_line": 3959, "end_line": 3968, "section": "Block quotes" }, { "markdown": "foo\n> bar\n", "html": "

foo

\n
\n

bar

\n
\n", "example": 245, "start_line": 3973, "end_line": 3981, "section": "Block quotes" }, { "markdown": "> aaa\n***\n> bbb\n", "html": "
\n

aaa

\n
\n
\n
\n

bbb

\n
\n", "example": 246, "start_line": 3987, "end_line": 3999, "section": "Block quotes" }, { "markdown": "> bar\nbaz\n", "html": "
\n

bar\nbaz

\n
\n", "example": 247, "start_line": 4005, "end_line": 4013, "section": "Block quotes" }, { "markdown": "> bar\n\nbaz\n", "html": "
\n

bar

\n
\n

baz

\n", "example": 248, "start_line": 4016, "end_line": 4025, "section": "Block quotes" }, { "markdown": "> bar\n>\nbaz\n", "html": "
\n

bar

\n
\n

baz

\n", "example": 249, "start_line": 4028, "end_line": 4037, "section": "Block quotes" }, { "markdown": "> > > foo\nbar\n", "html": "
\n
\n
\n

foo\nbar

\n
\n
\n
\n", "example": 250, "start_line": 4044, "end_line": 4056, "section": "Block quotes" }, { "markdown": ">>> foo\n> bar\n>>baz\n", "html": "
\n
\n
\n

foo\nbar\nbaz

\n
\n
\n
\n", "example": 251, "start_line": 4059, "end_line": 4073, "section": "Block quotes" }, { "markdown": "> code\n\n> not code\n", "html": "
\n
code\n
\n
\n
\n

not code

\n
\n", "example": 252, "start_line": 4081, "end_line": 4093, "section": "Block quotes" }, { "markdown": "A paragraph\nwith two lines.\n\n indented code\n\n> A block quote.\n", "html": "

A paragraph\nwith two lines.

\n
indented code\n
\n
\n

A block quote.

\n
\n", "example": 253, "start_line": 4135, "end_line": 4150, "section": "List items" }, { "markdown": "1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n", "html": "
    \n
  1. \n

    A paragraph\nwith two lines.

    \n
    indented code\n
    \n
    \n

    A block quote.

    \n
    \n
  2. \n
\n", "example": 254, "start_line": 4157, "end_line": 4176, "section": "List items" }, { "markdown": "- one\n\n two\n", "html": "
    \n
  • one
  • \n
\n

two

\n", "example": 255, "start_line": 4190, "end_line": 4199, "section": "List items" }, { "markdown": "- one\n\n two\n", "html": "
    \n
  • \n

    one

    \n

    two

    \n
  • \n
\n", "example": 256, "start_line": 4202, "end_line": 4213, "section": "List items" }, { "markdown": " - one\n\n two\n", "html": "
    \n
  • one
  • \n
\n
 two\n
\n", "example": 257, "start_line": 4216, "end_line": 4226, "section": "List items" }, { "markdown": " - one\n\n two\n", "html": "
    \n
  • \n

    one

    \n

    two

    \n
  • \n
\n", "example": 258, "start_line": 4229, "end_line": 4240, "section": "List items" }, { "markdown": " > > 1. one\n>>\n>> two\n", "html": "
\n
\n
    \n
  1. \n

    one

    \n

    two

    \n
  2. \n
\n
\n
\n", "example": 259, "start_line": 4251, "end_line": 4266, "section": "List items" }, { "markdown": ">>- one\n>>\n > > two\n", "html": "
\n
\n
    \n
  • one
  • \n
\n

two

\n
\n
\n", "example": 260, "start_line": 4278, "end_line": 4291, "section": "List items" }, { "markdown": "-one\n\n2.two\n", "html": "

-one

\n

2.two

\n", "example": 261, "start_line": 4297, "end_line": 4304, "section": "List items" }, { "markdown": "- foo\n\n\n bar\n", "html": "
    \n
  • \n

    foo

    \n

    bar

    \n
  • \n
\n", "example": 262, "start_line": 4310, "end_line": 4322, "section": "List items" }, { "markdown": "1. foo\n\n ```\n bar\n ```\n\n baz\n\n > bam\n", "html": "
    \n
  1. \n

    foo

    \n
    bar\n
    \n

    baz

    \n
    \n

    bam

    \n
    \n
  2. \n
\n", "example": 263, "start_line": 4327, "end_line": 4349, "section": "List items" }, { "markdown": "- Foo\n\n bar\n\n\n baz\n", "html": "
    \n
  • \n

    Foo

    \n
    bar\n\n\nbaz\n
    \n
  • \n
\n", "example": 264, "start_line": 4355, "end_line": 4373, "section": "List items" }, { "markdown": "123456789. ok\n", "html": "
    \n
  1. ok
  2. \n
\n", "example": 265, "start_line": 4377, "end_line": 4383, "section": "List items" }, { "markdown": "1234567890. not ok\n", "html": "

1234567890. not ok

\n", "example": 266, "start_line": 4386, "end_line": 4390, "section": "List items" }, { "markdown": "0. ok\n", "html": "
    \n
  1. ok
  2. \n
\n", "example": 267, "start_line": 4395, "end_line": 4401, "section": "List items" }, { "markdown": "003. ok\n", "html": "
    \n
  1. ok
  2. \n
\n", "example": 268, "start_line": 4404, "end_line": 4410, "section": "List items" }, { "markdown": "-1. not ok\n", "html": "

-1. not ok

\n", "example": 269, "start_line": 4415, "end_line": 4419, "section": "List items" }, { "markdown": "- foo\n\n bar\n", "html": "
    \n
  • \n

    foo

    \n
    bar\n
    \n
  • \n
\n", "example": 270, "start_line": 4438, "end_line": 4450, "section": "List items" }, { "markdown": " 10. foo\n\n bar\n", "html": "
    \n
  1. \n

    foo

    \n
    bar\n
    \n
  2. \n
\n", "example": 271, "start_line": 4455, "end_line": 4467, "section": "List items" }, { "markdown": " indented code\n\nparagraph\n\n more code\n", "html": "
indented code\n
\n

paragraph

\n
more code\n
\n", "example": 272, "start_line": 4474, "end_line": 4486, "section": "List items" }, { "markdown": "1. indented code\n\n paragraph\n\n more code\n", "html": "
    \n
  1. \n
    indented code\n
    \n

    paragraph

    \n
    more code\n
    \n
  2. \n
\n", "example": 273, "start_line": 4489, "end_line": 4505, "section": "List items" }, { "markdown": "1. indented code\n\n paragraph\n\n more code\n", "html": "
    \n
  1. \n
     indented code\n
    \n

    paragraph

    \n
    more code\n
    \n
  2. \n
\n", "example": 274, "start_line": 4511, "end_line": 4527, "section": "List items" }, { "markdown": " foo\n\nbar\n", "html": "

foo

\n

bar

\n", "example": 275, "start_line": 4538, "end_line": 4545, "section": "List items" }, { "markdown": "- foo\n\n bar\n", "html": "
    \n
  • foo
  • \n
\n

bar

\n", "example": 276, "start_line": 4548, "end_line": 4557, "section": "List items" }, { "markdown": "- foo\n\n bar\n", "html": "
    \n
  • \n

    foo

    \n

    bar

    \n
  • \n
\n", "example": 277, "start_line": 4565, "end_line": 4576, "section": "List items" }, { "markdown": "-\n foo\n-\n ```\n bar\n ```\n-\n baz\n", "html": "
    \n
  • foo
  • \n
  • \n
    bar\n
    \n
  • \n
  • \n
    baz\n
    \n
  • \n
\n", "example": 278, "start_line": 4592, "end_line": 4613, "section": "List items" }, { "markdown": "- \n foo\n", "html": "
    \n
  • foo
  • \n
\n", "example": 279, "start_line": 4618, "end_line": 4625, "section": "List items" }, { "markdown": "-\n\n foo\n", "html": "
    \n
  • \n
\n

foo

\n", "example": 280, "start_line": 4632, "end_line": 4641, "section": "List items" }, { "markdown": "- foo\n-\n- bar\n", "html": "
    \n
  • foo
  • \n
  • \n
  • bar
  • \n
\n", "example": 281, "start_line": 4646, "end_line": 4656, "section": "List items" }, { "markdown": "- foo\n- \n- bar\n", "html": "
    \n
  • foo
  • \n
  • \n
  • bar
  • \n
\n", "example": 282, "start_line": 4661, "end_line": 4671, "section": "List items" }, { "markdown": "1. foo\n2.\n3. bar\n", "html": "
    \n
  1. foo
  2. \n
  3. \n
  4. bar
  5. \n
\n", "example": 283, "start_line": 4676, "end_line": 4686, "section": "List items" }, { "markdown": "*\n", "html": "
    \n
  • \n
\n", "example": 284, "start_line": 4691, "end_line": 4697, "section": "List items" }, { "markdown": "foo\n*\n\nfoo\n1.\n", "html": "

foo\n*

\n

foo\n1.

\n", "example": 285, "start_line": 4701, "end_line": 4712, "section": "List items" }, { "markdown": " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n", "html": "
    \n
  1. \n

    A paragraph\nwith two lines.

    \n
    indented code\n
    \n
    \n

    A block quote.

    \n
    \n
  2. \n
\n", "example": 286, "start_line": 4723, "end_line": 4742, "section": "List items" }, { "markdown": " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n", "html": "
    \n
  1. \n

    A paragraph\nwith two lines.

    \n
    indented code\n
    \n
    \n

    A block quote.

    \n
    \n
  2. \n
\n", "example": 287, "start_line": 4747, "end_line": 4766, "section": "List items" }, { "markdown": " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n", "html": "
    \n
  1. \n

    A paragraph\nwith two lines.

    \n
    indented code\n
    \n
    \n

    A block quote.

    \n
    \n
  2. \n
\n", "example": 288, "start_line": 4771, "end_line": 4790, "section": "List items" }, { "markdown": " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n", "html": "
1.  A paragraph\n    with two lines.\n\n        indented code\n\n    > A block quote.\n
\n", "example": 289, "start_line": 4795, "end_line": 4810, "section": "List items" }, { "markdown": " 1. A paragraph\nwith two lines.\n\n indented code\n\n > A block quote.\n", "html": "
    \n
  1. \n

    A paragraph\nwith two lines.

    \n
    indented code\n
    \n
    \n

    A block quote.

    \n
    \n
  2. \n
\n", "example": 290, "start_line": 4825, "end_line": 4844, "section": "List items" }, { "markdown": " 1. A paragraph\n with two lines.\n", "html": "
    \n
  1. A paragraph\nwith two lines.
  2. \n
\n", "example": 291, "start_line": 4849, "end_line": 4857, "section": "List items" }, { "markdown": "> 1. > Blockquote\ncontinued here.\n", "html": "
\n
    \n
  1. \n
    \n

    Blockquote\ncontinued here.

    \n
    \n
  2. \n
\n
\n", "example": 292, "start_line": 4862, "end_line": 4876, "section": "List items" }, { "markdown": "> 1. > Blockquote\n> continued here.\n", "html": "
\n
    \n
  1. \n
    \n

    Blockquote\ncontinued here.

    \n
    \n
  2. \n
\n
\n", "example": 293, "start_line": 4879, "end_line": 4893, "section": "List items" }, { "markdown": "- foo\n - bar\n - baz\n - boo\n", "html": "
    \n
  • foo\n
      \n
    • bar\n
        \n
      • baz\n
          \n
        • boo
        • \n
        \n
      • \n
      \n
    • \n
    \n
  • \n
\n", "example": 294, "start_line": 4907, "end_line": 4928, "section": "List items" }, { "markdown": "- foo\n - bar\n - baz\n - boo\n", "html": "
    \n
  • foo
  • \n
  • bar
  • \n
  • baz
  • \n
  • boo
  • \n
\n", "example": 295, "start_line": 4933, "end_line": 4945, "section": "List items" }, { "markdown": "10) foo\n - bar\n", "html": "
    \n
  1. foo\n
      \n
    • bar
    • \n
    \n
  2. \n
\n", "example": 296, "start_line": 4950, "end_line": 4961, "section": "List items" }, { "markdown": "10) foo\n - bar\n", "html": "
    \n
  1. foo
  2. \n
\n
    \n
  • bar
  • \n
\n", "example": 297, "start_line": 4966, "end_line": 4976, "section": "List items" }, { "markdown": "- - foo\n", "html": "
    \n
  • \n
      \n
    • foo
    • \n
    \n
  • \n
\n", "example": 298, "start_line": 4981, "end_line": 4991, "section": "List items" }, { "markdown": "1. - 2. foo\n", "html": "
    \n
  1. \n
      \n
    • \n
        \n
      1. foo
      2. \n
      \n
    • \n
    \n
  2. \n
\n", "example": 299, "start_line": 4994, "end_line": 5008, "section": "List items" }, { "markdown": "- # Foo\n- Bar\n ---\n baz\n", "html": "
    \n
  • \n

    Foo

    \n
  • \n
  • \n

    Bar

    \nbaz
  • \n
\n", "example": 300, "start_line": 5013, "end_line": 5027, "section": "List items" }, { "markdown": "- foo\n- bar\n+ baz\n", "html": "
    \n
  • foo
  • \n
  • bar
  • \n
\n
    \n
  • baz
  • \n
\n", "example": 301, "start_line": 5249, "end_line": 5261, "section": "Lists" }, { "markdown": "1. foo\n2. bar\n3) baz\n", "html": "
    \n
  1. foo
  2. \n
  3. bar
  4. \n
\n
    \n
  1. baz
  2. \n
\n", "example": 302, "start_line": 5264, "end_line": 5276, "section": "Lists" }, { "markdown": "Foo\n- bar\n- baz\n", "html": "

Foo

\n
    \n
  • bar
  • \n
  • baz
  • \n
\n", "example": 303, "start_line": 5283, "end_line": 5293, "section": "Lists" }, { "markdown": "The number of windows in my house is\n14. The number of doors is 6.\n", "html": "

The number of windows in my house is\n14. The number of doors is 6.

\n", "example": 304, "start_line": 5360, "end_line": 5366, "section": "Lists" }, { "markdown": "The number of windows in my house is\n1. The number of doors is 6.\n", "html": "

The number of windows in my house is

\n
    \n
  1. The number of doors is 6.
  2. \n
\n", "example": 305, "start_line": 5370, "end_line": 5378, "section": "Lists" }, { "markdown": "- foo\n\n- bar\n\n\n- baz\n", "html": "
    \n
  • \n

    foo

    \n
  • \n
  • \n

    bar

    \n
  • \n
  • \n

    baz

    \n
  • \n
\n", "example": 306, "start_line": 5384, "end_line": 5403, "section": "Lists" }, { "markdown": "- foo\n - bar\n - baz\n\n\n bim\n", "html": "
    \n
  • foo\n
      \n
    • bar\n
        \n
      • \n

        baz

        \n

        bim

        \n
      • \n
      \n
    • \n
    \n
  • \n
\n", "example": 307, "start_line": 5405, "end_line": 5427, "section": "Lists" }, { "markdown": "- foo\n- bar\n\n\n\n- baz\n- bim\n", "html": "
    \n
  • foo
  • \n
  • bar
  • \n
\n\n
    \n
  • baz
  • \n
  • bim
  • \n
\n", "example": 308, "start_line": 5435, "end_line": 5453, "section": "Lists" }, { "markdown": "- foo\n\n notcode\n\n- foo\n\n\n\n code\n", "html": "
    \n
  • \n

    foo

    \n

    notcode

    \n
  • \n
  • \n

    foo

    \n
  • \n
\n\n
code\n
\n", "example": 309, "start_line": 5456, "end_line": 5479, "section": "Lists" }, { "markdown": "- a\n - b\n - c\n - d\n - e\n - f\n- g\n", "html": "
    \n
  • a
  • \n
  • b
  • \n
  • c
  • \n
  • d
  • \n
  • e
  • \n
  • f
  • \n
  • g
  • \n
\n", "example": 310, "start_line": 5487, "end_line": 5505, "section": "Lists" }, { "markdown": "1. a\n\n 2. b\n\n 3. c\n", "html": "
    \n
  1. \n

    a

    \n
  2. \n
  3. \n

    b

    \n
  4. \n
  5. \n

    c

    \n
  6. \n
\n", "example": 311, "start_line": 5508, "end_line": 5526, "section": "Lists" }, { "markdown": "- a\n - b\n - c\n - d\n - e\n", "html": "
    \n
  • a
  • \n
  • b
  • \n
  • c
  • \n
  • d\n- e
  • \n
\n", "example": 312, "start_line": 5532, "end_line": 5546, "section": "Lists" }, { "markdown": "1. a\n\n 2. b\n\n 3. c\n", "html": "
    \n
  1. \n

    a

    \n
  2. \n
  3. \n

    b

    \n
  4. \n
\n
3. c\n
\n", "example": 313, "start_line": 5552, "end_line": 5569, "section": "Lists" }, { "markdown": "- a\n- b\n\n- c\n", "html": "
    \n
  • \n

    a

    \n
  • \n
  • \n

    b

    \n
  • \n
  • \n

    c

    \n
  • \n
\n", "example": 314, "start_line": 5575, "end_line": 5592, "section": "Lists" }, { "markdown": "* a\n*\n\n* c\n", "html": "
    \n
  • \n

    a

    \n
  • \n
  • \n
  • \n

    c

    \n
  • \n
\n", "example": 315, "start_line": 5597, "end_line": 5612, "section": "Lists" }, { "markdown": "- a\n- b\n\n c\n- d\n", "html": "
    \n
  • \n

    a

    \n
  • \n
  • \n

    b

    \n

    c

    \n
  • \n
  • \n

    d

    \n
  • \n
\n", "example": 316, "start_line": 5619, "end_line": 5638, "section": "Lists" }, { "markdown": "- a\n- b\n\n [ref]: /url\n- d\n", "html": "
    \n
  • \n

    a

    \n
  • \n
  • \n

    b

    \n
  • \n
  • \n

    d

    \n
  • \n
\n", "example": 317, "start_line": 5641, "end_line": 5659, "section": "Lists" }, { "markdown": "- a\n- ```\n b\n\n\n ```\n- c\n", "html": "
    \n
  • a
  • \n
  • \n
    b\n\n\n
    \n
  • \n
  • c
  • \n
\n", "example": 318, "start_line": 5664, "end_line": 5683, "section": "Lists" }, { "markdown": "- a\n - b\n\n c\n- d\n", "html": "
    \n
  • a\n
      \n
    • \n

      b

      \n

      c

      \n
    • \n
    \n
  • \n
  • d
  • \n
\n", "example": 319, "start_line": 5690, "end_line": 5708, "section": "Lists" }, { "markdown": "* a\n > b\n >\n* c\n", "html": "
    \n
  • a\n
    \n

    b

    \n
    \n
  • \n
  • c
  • \n
\n", "example": 320, "start_line": 5714, "end_line": 5728, "section": "Lists" }, { "markdown": "- a\n > b\n ```\n c\n ```\n- d\n", "html": "
    \n
  • a\n
    \n

    b

    \n
    \n
    c\n
    \n
  • \n
  • d
  • \n
\n", "example": 321, "start_line": 5734, "end_line": 5752, "section": "Lists" }, { "markdown": "- a\n", "html": "
    \n
  • a
  • \n
\n", "example": 322, "start_line": 5757, "end_line": 5763, "section": "Lists" }, { "markdown": "- a\n - b\n", "html": "
    \n
  • a\n
      \n
    • b
    • \n
    \n
  • \n
\n", "example": 323, "start_line": 5766, "end_line": 5777, "section": "Lists" }, { "markdown": "1. ```\n foo\n ```\n\n bar\n", "html": "
    \n
  1. \n
    foo\n
    \n

    bar

    \n
  2. \n
\n", "example": 324, "start_line": 5783, "end_line": 5797, "section": "Lists" }, { "markdown": "* foo\n * bar\n\n baz\n", "html": "
    \n
  • \n

    foo

    \n
      \n
    • bar
    • \n
    \n

    baz

    \n
  • \n
\n", "example": 325, "start_line": 5802, "end_line": 5817, "section": "Lists" }, { "markdown": "- a\n - b\n - c\n\n- d\n - e\n - f\n", "html": "
    \n
  • \n

    a

    \n
      \n
    • b
    • \n
    • c
    • \n
    \n
  • \n
  • \n

    d

    \n
      \n
    • e
    • \n
    • f
    • \n
    \n
  • \n
\n", "example": 326, "start_line": 5820, "end_line": 5845, "section": "Lists" }, { "markdown": "`hi`lo`\n", "html": "

hilo`

\n", "example": 327, "start_line": 5854, "end_line": 5858, "section": "Inlines" }, { "markdown": "`foo`\n", "html": "

foo

\n", "example": 328, "start_line": 5886, "end_line": 5890, "section": "Code spans" }, { "markdown": "`` foo ` bar ``\n", "html": "

foo ` bar

\n", "example": 329, "start_line": 5897, "end_line": 5901, "section": "Code spans" }, { "markdown": "` `` `\n", "html": "

``

\n", "example": 330, "start_line": 5907, "end_line": 5911, "section": "Code spans" }, { "markdown": "` `` `\n", "html": "

``

\n", "example": 331, "start_line": 5915, "end_line": 5919, "section": "Code spans" }, { "markdown": "` a`\n", "html": "

a

\n", "example": 332, "start_line": 5924, "end_line": 5928, "section": "Code spans" }, { "markdown": "` b `\n", "html": "

 b 

\n", "example": 333, "start_line": 5933, "end_line": 5937, "section": "Code spans" }, { "markdown": "` `\n` `\n", "html": "

 \n

\n", "example": 334, "start_line": 5941, "end_line": 5947, "section": "Code spans" }, { "markdown": "``\nfoo\nbar \nbaz\n``\n", "html": "

foo bar baz

\n", "example": 335, "start_line": 5952, "end_line": 5960, "section": "Code spans" }, { "markdown": "``\nfoo \n``\n", "html": "

foo

\n", "example": 336, "start_line": 5962, "end_line": 5968, "section": "Code spans" }, { "markdown": "`foo bar \nbaz`\n", "html": "

foo bar baz

\n", "example": 337, "start_line": 5973, "end_line": 5978, "section": "Code spans" }, { "markdown": "`foo\\`bar`\n", "html": "

foo\\bar`

\n", "example": 338, "start_line": 5990, "end_line": 5994, "section": "Code spans" }, { "markdown": "``foo`bar``\n", "html": "

foo`bar

\n", "example": 339, "start_line": 6001, "end_line": 6005, "section": "Code spans" }, { "markdown": "` foo `` bar `\n", "html": "

foo `` bar

\n", "example": 340, "start_line": 6007, "end_line": 6011, "section": "Code spans" }, { "markdown": "*foo`*`\n", "html": "

*foo*

\n", "example": 341, "start_line": 6019, "end_line": 6023, "section": "Code spans" }, { "markdown": "[not a `link](/foo`)\n", "html": "

[not a link](/foo)

\n", "example": 342, "start_line": 6028, "end_line": 6032, "section": "Code spans" }, { "markdown": "``\n", "html": "

<a href="">`

\n", "example": 343, "start_line": 6038, "end_line": 6042, "section": "Code spans" }, { "markdown": "
`\n", "html": "

`

\n", "example": 344, "start_line": 6047, "end_line": 6051, "section": "Code spans" }, { "markdown": "``\n", "html": "

<https://foo.bar.baz>`

\n", "example": 345, "start_line": 6056, "end_line": 6060, "section": "Code spans" }, { "markdown": "`\n", "html": "

https://foo.bar.`baz`

\n", "example": 346, "start_line": 6065, "end_line": 6069, "section": "Code spans" }, { "markdown": "```foo``\n", "html": "

```foo``

\n", "example": 347, "start_line": 6075, "end_line": 6079, "section": "Code spans" }, { "markdown": "`foo\n", "html": "

`foo

\n", "example": 348, "start_line": 6082, "end_line": 6086, "section": "Code spans" }, { "markdown": "`foo``bar``\n", "html": "

`foobar

\n", "example": 349, "start_line": 6091, "end_line": 6095, "section": "Code spans" }, { "markdown": "*foo bar*\n", "html": "

foo bar

\n", "example": 350, "start_line": 6308, "end_line": 6312, "section": "Emphasis and strong emphasis" }, { "markdown": "a * foo bar*\n", "html": "

a * foo bar*

\n", "example": 351, "start_line": 6318, "end_line": 6322, "section": "Emphasis and strong emphasis" }, { "markdown": "a*\"foo\"*\n", "html": "

a*"foo"*

\n", "example": 352, "start_line": 6329, "end_line": 6333, "section": "Emphasis and strong emphasis" }, { "markdown": "* a *\n", "html": "

* a *

\n", "example": 353, "start_line": 6338, "end_line": 6342, "section": "Emphasis and strong emphasis" }, { "markdown": "*$*alpha.\n\n*£*bravo.\n\n*€*charlie.\n", "html": "

*$*alpha.

\n

*£*bravo.

\n

*€*charlie.

\n", "example": 354, "start_line": 6347, "end_line": 6357, "section": "Emphasis and strong emphasis" }, { "markdown": "foo*bar*\n", "html": "

foobar

\n", "example": 355, "start_line": 6362, "end_line": 6366, "section": "Emphasis and strong emphasis" }, { "markdown": "5*6*78\n", "html": "

5678

\n", "example": 356, "start_line": 6369, "end_line": 6373, "section": "Emphasis and strong emphasis" }, { "markdown": "_foo bar_\n", "html": "

foo bar

\n", "example": 357, "start_line": 6378, "end_line": 6382, "section": "Emphasis and strong emphasis" }, { "markdown": "_ foo bar_\n", "html": "

_ foo bar_

\n", "example": 358, "start_line": 6388, "end_line": 6392, "section": "Emphasis and strong emphasis" }, { "markdown": "a_\"foo\"_\n", "html": "

a_"foo"_

\n", "example": 359, "start_line": 6398, "end_line": 6402, "section": "Emphasis and strong emphasis" }, { "markdown": "foo_bar_\n", "html": "

foo_bar_

\n", "example": 360, "start_line": 6407, "end_line": 6411, "section": "Emphasis and strong emphasis" }, { "markdown": "5_6_78\n", "html": "

5_6_78

\n", "example": 361, "start_line": 6414, "end_line": 6418, "section": "Emphasis and strong emphasis" }, { "markdown": "пристаням_стремятся_\n", "html": "

пристаням_стремятся_

\n", "example": 362, "start_line": 6421, "end_line": 6425, "section": "Emphasis and strong emphasis" }, { "markdown": "aa_\"bb\"_cc\n", "html": "

aa_"bb"_cc

\n", "example": 363, "start_line": 6431, "end_line": 6435, "section": "Emphasis and strong emphasis" }, { "markdown": "foo-_(bar)_\n", "html": "

foo-(bar)

\n", "example": 364, "start_line": 6442, "end_line": 6446, "section": "Emphasis and strong emphasis" }, { "markdown": "_foo*\n", "html": "

_foo*

\n", "example": 365, "start_line": 6454, "end_line": 6458, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo bar *\n", "html": "

*foo bar *

\n", "example": 366, "start_line": 6464, "end_line": 6468, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo bar\n*\n", "html": "

*foo bar\n*

\n", "example": 367, "start_line": 6473, "end_line": 6479, "section": "Emphasis and strong emphasis" }, { "markdown": "*(*foo)\n", "html": "

*(*foo)

\n", "example": 368, "start_line": 6486, "end_line": 6490, "section": "Emphasis and strong emphasis" }, { "markdown": "*(*foo*)*\n", "html": "

(foo)

\n", "example": 369, "start_line": 6496, "end_line": 6500, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo*bar\n", "html": "

foobar

\n", "example": 370, "start_line": 6505, "end_line": 6509, "section": "Emphasis and strong emphasis" }, { "markdown": "_foo bar _\n", "html": "

_foo bar _

\n", "example": 371, "start_line": 6518, "end_line": 6522, "section": "Emphasis and strong emphasis" }, { "markdown": "_(_foo)\n", "html": "

_(_foo)

\n", "example": 372, "start_line": 6528, "end_line": 6532, "section": "Emphasis and strong emphasis" }, { "markdown": "_(_foo_)_\n", "html": "

(foo)

\n", "example": 373, "start_line": 6537, "end_line": 6541, "section": "Emphasis and strong emphasis" }, { "markdown": "_foo_bar\n", "html": "

_foo_bar

\n", "example": 374, "start_line": 6546, "end_line": 6550, "section": "Emphasis and strong emphasis" }, { "markdown": "_пристаням_стремятся\n", "html": "

_пристаням_стремятся

\n", "example": 375, "start_line": 6553, "end_line": 6557, "section": "Emphasis and strong emphasis" }, { "markdown": "_foo_bar_baz_\n", "html": "

foo_bar_baz

\n", "example": 376, "start_line": 6560, "end_line": 6564, "section": "Emphasis and strong emphasis" }, { "markdown": "_(bar)_.\n", "html": "

(bar).

\n", "example": 377, "start_line": 6571, "end_line": 6575, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo bar**\n", "html": "

foo bar

\n", "example": 378, "start_line": 6580, "end_line": 6584, "section": "Emphasis and strong emphasis" }, { "markdown": "** foo bar**\n", "html": "

** foo bar**

\n", "example": 379, "start_line": 6590, "end_line": 6594, "section": "Emphasis and strong emphasis" }, { "markdown": "a**\"foo\"**\n", "html": "

a**"foo"**

\n", "example": 380, "start_line": 6601, "end_line": 6605, "section": "Emphasis and strong emphasis" }, { "markdown": "foo**bar**\n", "html": "

foobar

\n", "example": 381, "start_line": 6610, "end_line": 6614, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo bar__\n", "html": "

foo bar

\n", "example": 382, "start_line": 6619, "end_line": 6623, "section": "Emphasis and strong emphasis" }, { "markdown": "__ foo bar__\n", "html": "

__ foo bar__

\n", "example": 383, "start_line": 6629, "end_line": 6633, "section": "Emphasis and strong emphasis" }, { "markdown": "__\nfoo bar__\n", "html": "

__\nfoo bar__

\n", "example": 384, "start_line": 6637, "end_line": 6643, "section": "Emphasis and strong emphasis" }, { "markdown": "a__\"foo\"__\n", "html": "

a__"foo"__

\n", "example": 385, "start_line": 6649, "end_line": 6653, "section": "Emphasis and strong emphasis" }, { "markdown": "foo__bar__\n", "html": "

foo__bar__

\n", "example": 386, "start_line": 6658, "end_line": 6662, "section": "Emphasis and strong emphasis" }, { "markdown": "5__6__78\n", "html": "

5__6__78

\n", "example": 387, "start_line": 6665, "end_line": 6669, "section": "Emphasis and strong emphasis" }, { "markdown": "пристаням__стремятся__\n", "html": "

пристаням__стремятся__

\n", "example": 388, "start_line": 6672, "end_line": 6676, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo, __bar__, baz__\n", "html": "

foo, bar, baz

\n", "example": 389, "start_line": 6679, "end_line": 6683, "section": "Emphasis and strong emphasis" }, { "markdown": "foo-__(bar)__\n", "html": "

foo-(bar)

\n", "example": 390, "start_line": 6690, "end_line": 6694, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo bar **\n", "html": "

**foo bar **

\n", "example": 391, "start_line": 6703, "end_line": 6707, "section": "Emphasis and strong emphasis" }, { "markdown": "**(**foo)\n", "html": "

**(**foo)

\n", "example": 392, "start_line": 6716, "end_line": 6720, "section": "Emphasis and strong emphasis" }, { "markdown": "*(**foo**)*\n", "html": "

(foo)

\n", "example": 393, "start_line": 6726, "end_line": 6730, "section": "Emphasis and strong emphasis" }, { "markdown": "**Gomphocarpus (*Gomphocarpus physocarpus*, syn.\n*Asclepias physocarpa*)**\n", "html": "

Gomphocarpus (Gomphocarpus physocarpus, syn.\nAsclepias physocarpa)

\n", "example": 394, "start_line": 6733, "end_line": 6739, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo \"*bar*\" foo**\n", "html": "

foo "bar" foo

\n", "example": 395, "start_line": 6742, "end_line": 6746, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo**bar\n", "html": "

foobar

\n", "example": 396, "start_line": 6751, "end_line": 6755, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo bar __\n", "html": "

__foo bar __

\n", "example": 397, "start_line": 6763, "end_line": 6767, "section": "Emphasis and strong emphasis" }, { "markdown": "__(__foo)\n", "html": "

__(__foo)

\n", "example": 398, "start_line": 6773, "end_line": 6777, "section": "Emphasis and strong emphasis" }, { "markdown": "_(__foo__)_\n", "html": "

(foo)

\n", "example": 399, "start_line": 6783, "end_line": 6787, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo__bar\n", "html": "

__foo__bar

\n", "example": 400, "start_line": 6792, "end_line": 6796, "section": "Emphasis and strong emphasis" }, { "markdown": "__пристаням__стремятся\n", "html": "

__пристаням__стремятся

\n", "example": 401, "start_line": 6799, "end_line": 6803, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo__bar__baz__\n", "html": "

foo__bar__baz

\n", "example": 402, "start_line": 6806, "end_line": 6810, "section": "Emphasis and strong emphasis" }, { "markdown": "__(bar)__.\n", "html": "

(bar).

\n", "example": 403, "start_line": 6817, "end_line": 6821, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo [bar](/url)*\n", "html": "

foo bar

\n", "example": 404, "start_line": 6829, "end_line": 6833, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo\nbar*\n", "html": "

foo\nbar

\n", "example": 405, "start_line": 6836, "end_line": 6842, "section": "Emphasis and strong emphasis" }, { "markdown": "_foo __bar__ baz_\n", "html": "

foo bar baz

\n", "example": 406, "start_line": 6848, "end_line": 6852, "section": "Emphasis and strong emphasis" }, { "markdown": "_foo _bar_ baz_\n", "html": "

foo bar baz

\n", "example": 407, "start_line": 6855, "end_line": 6859, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo_ bar_\n", "html": "

foo bar

\n", "example": 408, "start_line": 6862, "end_line": 6866, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo *bar**\n", "html": "

foo bar

\n", "example": 409, "start_line": 6869, "end_line": 6873, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo **bar** baz*\n", "html": "

foo bar baz

\n", "example": 410, "start_line": 6876, "end_line": 6880, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo**bar**baz*\n", "html": "

foobarbaz

\n", "example": 411, "start_line": 6882, "end_line": 6886, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo**bar*\n", "html": "

foo**bar

\n", "example": 412, "start_line": 6906, "end_line": 6910, "section": "Emphasis and strong emphasis" }, { "markdown": "***foo** bar*\n", "html": "

foo bar

\n", "example": 413, "start_line": 6919, "end_line": 6923, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo **bar***\n", "html": "

foo bar

\n", "example": 414, "start_line": 6926, "end_line": 6930, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo**bar***\n", "html": "

foobar

\n", "example": 415, "start_line": 6933, "end_line": 6937, "section": "Emphasis and strong emphasis" }, { "markdown": "foo***bar***baz\n", "html": "

foobarbaz

\n", "example": 416, "start_line": 6944, "end_line": 6948, "section": "Emphasis and strong emphasis" }, { "markdown": "foo******bar*********baz\n", "html": "

foobar***baz

\n", "example": 417, "start_line": 6950, "end_line": 6954, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo **bar *baz* bim** bop*\n", "html": "

foo bar baz bim bop

\n", "example": 418, "start_line": 6959, "end_line": 6963, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo [*bar*](/url)*\n", "html": "

foo bar

\n", "example": 419, "start_line": 6966, "end_line": 6970, "section": "Emphasis and strong emphasis" }, { "markdown": "** is not an empty emphasis\n", "html": "

** is not an empty emphasis

\n", "example": 420, "start_line": 6975, "end_line": 6979, "section": "Emphasis and strong emphasis" }, { "markdown": "**** is not an empty strong emphasis\n", "html": "

**** is not an empty strong emphasis

\n", "example": 421, "start_line": 6982, "end_line": 6986, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo [bar](/url)**\n", "html": "

foo bar

\n", "example": 422, "start_line": 6995, "end_line": 6999, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo\nbar**\n", "html": "

foo\nbar

\n", "example": 423, "start_line": 7002, "end_line": 7008, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo _bar_ baz__\n", "html": "

foo bar baz

\n", "example": 424, "start_line": 7014, "end_line": 7018, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo __bar__ baz__\n", "html": "

foo bar baz

\n", "example": 425, "start_line": 7021, "end_line": 7025, "section": "Emphasis and strong emphasis" }, { "markdown": "____foo__ bar__\n", "html": "

foo bar

\n", "example": 426, "start_line": 7028, "end_line": 7032, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo **bar****\n", "html": "

foo bar

\n", "example": 427, "start_line": 7035, "end_line": 7039, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo *bar* baz**\n", "html": "

foo bar baz

\n", "example": 428, "start_line": 7042, "end_line": 7046, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo*bar*baz**\n", "html": "

foobarbaz

\n", "example": 429, "start_line": 7049, "end_line": 7053, "section": "Emphasis and strong emphasis" }, { "markdown": "***foo* bar**\n", "html": "

foo bar

\n", "example": 430, "start_line": 7056, "end_line": 7060, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo *bar***\n", "html": "

foo bar

\n", "example": 431, "start_line": 7063, "end_line": 7067, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo *bar **baz**\nbim* bop**\n", "html": "

foo bar baz\nbim bop

\n", "example": 432, "start_line": 7072, "end_line": 7078, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo [*bar*](/url)**\n", "html": "

foo bar

\n", "example": 433, "start_line": 7081, "end_line": 7085, "section": "Emphasis and strong emphasis" }, { "markdown": "__ is not an empty emphasis\n", "html": "

__ is not an empty emphasis

\n", "example": 434, "start_line": 7090, "end_line": 7094, "section": "Emphasis and strong emphasis" }, { "markdown": "____ is not an empty strong emphasis\n", "html": "

____ is not an empty strong emphasis

\n", "example": 435, "start_line": 7097, "end_line": 7101, "section": "Emphasis and strong emphasis" }, { "markdown": "foo ***\n", "html": "

foo ***

\n", "example": 436, "start_line": 7107, "end_line": 7111, "section": "Emphasis and strong emphasis" }, { "markdown": "foo *\\**\n", "html": "

foo *

\n", "example": 437, "start_line": 7114, "end_line": 7118, "section": "Emphasis and strong emphasis" }, { "markdown": "foo *_*\n", "html": "

foo _

\n", "example": 438, "start_line": 7121, "end_line": 7125, "section": "Emphasis and strong emphasis" }, { "markdown": "foo *****\n", "html": "

foo *****

\n", "example": 439, "start_line": 7128, "end_line": 7132, "section": "Emphasis and strong emphasis" }, { "markdown": "foo **\\***\n", "html": "

foo *

\n", "example": 440, "start_line": 7135, "end_line": 7139, "section": "Emphasis and strong emphasis" }, { "markdown": "foo **_**\n", "html": "

foo _

\n", "example": 441, "start_line": 7142, "end_line": 7146, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo*\n", "html": "

*foo

\n", "example": 442, "start_line": 7153, "end_line": 7157, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo**\n", "html": "

foo*

\n", "example": 443, "start_line": 7160, "end_line": 7164, "section": "Emphasis and strong emphasis" }, { "markdown": "***foo**\n", "html": "

*foo

\n", "example": 444, "start_line": 7167, "end_line": 7171, "section": "Emphasis and strong emphasis" }, { "markdown": "****foo*\n", "html": "

***foo

\n", "example": 445, "start_line": 7174, "end_line": 7178, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo***\n", "html": "

foo*

\n", "example": 446, "start_line": 7181, "end_line": 7185, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo****\n", "html": "

foo***

\n", "example": 447, "start_line": 7188, "end_line": 7192, "section": "Emphasis and strong emphasis" }, { "markdown": "foo ___\n", "html": "

foo ___

\n", "example": 448, "start_line": 7198, "end_line": 7202, "section": "Emphasis and strong emphasis" }, { "markdown": "foo _\\__\n", "html": "

foo _

\n", "example": 449, "start_line": 7205, "end_line": 7209, "section": "Emphasis and strong emphasis" }, { "markdown": "foo _*_\n", "html": "

foo *

\n", "example": 450, "start_line": 7212, "end_line": 7216, "section": "Emphasis and strong emphasis" }, { "markdown": "foo _____\n", "html": "

foo _____

\n", "example": 451, "start_line": 7219, "end_line": 7223, "section": "Emphasis and strong emphasis" }, { "markdown": "foo __\\___\n", "html": "

foo _

\n", "example": 452, "start_line": 7226, "end_line": 7230, "section": "Emphasis and strong emphasis" }, { "markdown": "foo __*__\n", "html": "

foo *

\n", "example": 453, "start_line": 7233, "end_line": 7237, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo_\n", "html": "

_foo

\n", "example": 454, "start_line": 7240, "end_line": 7244, "section": "Emphasis and strong emphasis" }, { "markdown": "_foo__\n", "html": "

foo_

\n", "example": 455, "start_line": 7251, "end_line": 7255, "section": "Emphasis and strong emphasis" }, { "markdown": "___foo__\n", "html": "

_foo

\n", "example": 456, "start_line": 7258, "end_line": 7262, "section": "Emphasis and strong emphasis" }, { "markdown": "____foo_\n", "html": "

___foo

\n", "example": 457, "start_line": 7265, "end_line": 7269, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo___\n", "html": "

foo_

\n", "example": 458, "start_line": 7272, "end_line": 7276, "section": "Emphasis and strong emphasis" }, { "markdown": "_foo____\n", "html": "

foo___

\n", "example": 459, "start_line": 7279, "end_line": 7283, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo**\n", "html": "

foo

\n", "example": 460, "start_line": 7289, "end_line": 7293, "section": "Emphasis and strong emphasis" }, { "markdown": "*_foo_*\n", "html": "

foo

\n", "example": 461, "start_line": 7296, "end_line": 7300, "section": "Emphasis and strong emphasis" }, { "markdown": "__foo__\n", "html": "

foo

\n", "example": 462, "start_line": 7303, "end_line": 7307, "section": "Emphasis and strong emphasis" }, { "markdown": "_*foo*_\n", "html": "

foo

\n", "example": 463, "start_line": 7310, "end_line": 7314, "section": "Emphasis and strong emphasis" }, { "markdown": "****foo****\n", "html": "

foo

\n", "example": 464, "start_line": 7320, "end_line": 7324, "section": "Emphasis and strong emphasis" }, { "markdown": "____foo____\n", "html": "

foo

\n", "example": 465, "start_line": 7327, "end_line": 7331, "section": "Emphasis and strong emphasis" }, { "markdown": "******foo******\n", "html": "

foo

\n", "example": 466, "start_line": 7338, "end_line": 7342, "section": "Emphasis and strong emphasis" }, { "markdown": "***foo***\n", "html": "

foo

\n", "example": 467, "start_line": 7347, "end_line": 7351, "section": "Emphasis and strong emphasis" }, { "markdown": "_____foo_____\n", "html": "

foo

\n", "example": 468, "start_line": 7354, "end_line": 7358, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo _bar* baz_\n", "html": "

foo _bar baz_

\n", "example": 469, "start_line": 7363, "end_line": 7367, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo __bar *baz bim__ bam*\n", "html": "

foo bar *baz bim bam

\n", "example": 470, "start_line": 7370, "end_line": 7374, "section": "Emphasis and strong emphasis" }, { "markdown": "**foo **bar baz**\n", "html": "

**foo bar baz

\n", "example": 471, "start_line": 7379, "end_line": 7383, "section": "Emphasis and strong emphasis" }, { "markdown": "*foo *bar baz*\n", "html": "

*foo bar baz

\n", "example": 472, "start_line": 7386, "end_line": 7390, "section": "Emphasis and strong emphasis" }, { "markdown": "*[bar*](/url)\n", "html": "

*bar*

\n", "example": 473, "start_line": 7395, "end_line": 7399, "section": "Emphasis and strong emphasis" }, { "markdown": "_foo [bar_](/url)\n", "html": "

_foo bar_

\n", "example": 474, "start_line": 7402, "end_line": 7406, "section": "Emphasis and strong emphasis" }, { "markdown": "*\n", "html": "

*

\n", "example": 475, "start_line": 7409, "end_line": 7413, "section": "Emphasis and strong emphasis" }, { "markdown": "**\n", "html": "

**

\n", "example": 476, "start_line": 7416, "end_line": 7420, "section": "Emphasis and strong emphasis" }, { "markdown": "__\n", "html": "

__

\n", "example": 477, "start_line": 7423, "end_line": 7427, "section": "Emphasis and strong emphasis" }, { "markdown": "*a `*`*\n", "html": "

a *

\n", "example": 478, "start_line": 7430, "end_line": 7434, "section": "Emphasis and strong emphasis" }, { "markdown": "_a `_`_\n", "html": "

a _

\n", "example": 479, "start_line": 7437, "end_line": 7441, "section": "Emphasis and strong emphasis" }, { "markdown": "**a\n", "html": "

**ahttps://foo.bar/?q=**

\n", "example": 480, "start_line": 7444, "end_line": 7448, "section": "Emphasis and strong emphasis" }, { "markdown": "__a\n", "html": "

__ahttps://foo.bar/?q=__

\n", "example": 481, "start_line": 7451, "end_line": 7455, "section": "Emphasis and strong emphasis" }, { "markdown": "[link](/uri \"title\")\n", "html": "

link

\n", "example": 482, "start_line": 7539, "end_line": 7543, "section": "Links" }, { "markdown": "[link](/uri)\n", "html": "

link

\n", "example": 483, "start_line": 7549, "end_line": 7553, "section": "Links" }, { "markdown": "[](./target.md)\n", "html": "

\n", "example": 484, "start_line": 7555, "end_line": 7559, "section": "Links" }, { "markdown": "[link]()\n", "html": "

link

\n", "example": 485, "start_line": 7562, "end_line": 7566, "section": "Links" }, { "markdown": "[link](<>)\n", "html": "

link

\n", "example": 486, "start_line": 7569, "end_line": 7573, "section": "Links" }, { "markdown": "[]()\n", "html": "

\n", "example": 487, "start_line": 7576, "end_line": 7580, "section": "Links" }, { "markdown": "[link](/my uri)\n", "html": "

[link](/my uri)

\n", "example": 488, "start_line": 7585, "end_line": 7589, "section": "Links" }, { "markdown": "[link](
)\n", "html": "

link

\n", "example": 489, "start_line": 7591, "end_line": 7595, "section": "Links" }, { "markdown": "[link](foo\nbar)\n", "html": "

[link](foo\nbar)

\n", "example": 490, "start_line": 7600, "end_line": 7606, "section": "Links" }, { "markdown": "[link]()\n", "html": "

[link]()

\n", "example": 491, "start_line": 7608, "end_line": 7614, "section": "Links" }, { "markdown": "[a]()\n", "html": "

a

\n", "example": 492, "start_line": 7619, "end_line": 7623, "section": "Links" }, { "markdown": "[link]()\n", "html": "

[link](<foo>)

\n", "example": 493, "start_line": 7627, "end_line": 7631, "section": "Links" }, { "markdown": "[a](\n[a](c)\n", "html": "

[a](<b)c\n[a](<b)c>\n[a](c)

\n", "example": 494, "start_line": 7636, "end_line": 7644, "section": "Links" }, { "markdown": "[link](\\(foo\\))\n", "html": "

link

\n", "example": 495, "start_line": 7648, "end_line": 7652, "section": "Links" }, { "markdown": "[link](foo(and(bar)))\n", "html": "

link

\n", "example": 496, "start_line": 7657, "end_line": 7661, "section": "Links" }, { "markdown": "[link](foo(and(bar))\n", "html": "

[link](foo(and(bar))

\n", "example": 497, "start_line": 7666, "end_line": 7670, "section": "Links" }, { "markdown": "[link](foo\\(and\\(bar\\))\n", "html": "

link

\n", "example": 498, "start_line": 7673, "end_line": 7677, "section": "Links" }, { "markdown": "[link]()\n", "html": "

link

\n", "example": 499, "start_line": 7680, "end_line": 7684, "section": "Links" }, { "markdown": "[link](foo\\)\\:)\n", "html": "

link

\n", "example": 500, "start_line": 7690, "end_line": 7694, "section": "Links" }, { "markdown": "[link](#fragment)\n\n[link](https://example.com#fragment)\n\n[link](https://example.com?foo=3#frag)\n", "html": "

link

\n

link

\n

link

\n", "example": 501, "start_line": 7699, "end_line": 7709, "section": "Links" }, { "markdown": "[link](foo\\bar)\n", "html": "

link

\n", "example": 502, "start_line": 7715, "end_line": 7719, "section": "Links" }, { "markdown": "[link](foo%20bä)\n", "html": "

link

\n", "example": 503, "start_line": 7731, "end_line": 7735, "section": "Links" }, { "markdown": "[link](\"title\")\n", "html": "

link

\n", "example": 504, "start_line": 7742, "end_line": 7746, "section": "Links" }, { "markdown": "[link](/url \"title\")\n[link](/url 'title')\n[link](/url (title))\n", "html": "

link\nlink\nlink

\n", "example": 505, "start_line": 7751, "end_line": 7759, "section": "Links" }, { "markdown": "[link](/url \"title \\\""\")\n", "html": "

link

\n", "example": 506, "start_line": 7765, "end_line": 7769, "section": "Links" }, { "markdown": "[link](/url \"title\")\n", "html": "

link

\n", "example": 507, "start_line": 7776, "end_line": 7780, "section": "Links" }, { "markdown": "[link](/url \"title \"and\" title\")\n", "html": "

[link](/url "title "and" title")

\n", "example": 508, "start_line": 7785, "end_line": 7789, "section": "Links" }, { "markdown": "[link](/url 'title \"and\" title')\n", "html": "

link

\n", "example": 509, "start_line": 7794, "end_line": 7798, "section": "Links" }, { "markdown": "[link]( /uri\n \"title\" )\n", "html": "

link

\n", "example": 510, "start_line": 7819, "end_line": 7824, "section": "Links" }, { "markdown": "[link] (/uri)\n", "html": "

[link] (/uri)

\n", "example": 511, "start_line": 7830, "end_line": 7834, "section": "Links" }, { "markdown": "[link [foo [bar]]](/uri)\n", "html": "

link [foo [bar]]

\n", "example": 512, "start_line": 7840, "end_line": 7844, "section": "Links" }, { "markdown": "[link] bar](/uri)\n", "html": "

[link] bar](/uri)

\n", "example": 513, "start_line": 7847, "end_line": 7851, "section": "Links" }, { "markdown": "[link [bar](/uri)\n", "html": "

[link bar

\n", "example": 514, "start_line": 7854, "end_line": 7858, "section": "Links" }, { "markdown": "[link \\[bar](/uri)\n", "html": "

link [bar

\n", "example": 515, "start_line": 7861, "end_line": 7865, "section": "Links" }, { "markdown": "[link *foo **bar** `#`*](/uri)\n", "html": "

link foo bar #

\n", "example": 516, "start_line": 7870, "end_line": 7874, "section": "Links" }, { "markdown": "[![moon](moon.jpg)](/uri)\n", "html": "

\"moon\"

\n", "example": 517, "start_line": 7877, "end_line": 7881, "section": "Links" }, { "markdown": "[foo [bar](/uri)](/uri)\n", "html": "

[foo bar](/uri)

\n", "example": 518, "start_line": 7886, "end_line": 7890, "section": "Links" }, { "markdown": "[foo *[bar [baz](/uri)](/uri)*](/uri)\n", "html": "

[foo [bar baz](/uri)](/uri)

\n", "example": 519, "start_line": 7893, "end_line": 7897, "section": "Links" }, { "markdown": "![[[foo](uri1)](uri2)](uri3)\n", "html": "

\"[foo](uri2)\"

\n", "example": 520, "start_line": 7900, "end_line": 7904, "section": "Links" }, { "markdown": "*[foo*](/uri)\n", "html": "

*foo*

\n", "example": 521, "start_line": 7910, "end_line": 7914, "section": "Links" }, { "markdown": "[foo *bar](baz*)\n", "html": "

foo *bar

\n", "example": 522, "start_line": 7917, "end_line": 7921, "section": "Links" }, { "markdown": "*foo [bar* baz]\n", "html": "

foo [bar baz]

\n", "example": 523, "start_line": 7927, "end_line": 7931, "section": "Links" }, { "markdown": "[foo \n", "html": "

[foo

\n", "example": 524, "start_line": 7937, "end_line": 7941, "section": "Links" }, { "markdown": "[foo`](/uri)`\n", "html": "

[foo](/uri)

\n", "example": 525, "start_line": 7944, "end_line": 7948, "section": "Links" }, { "markdown": "[foo\n", "html": "

[foohttps://example.com/?search=](uri)

\n", "example": 526, "start_line": 7951, "end_line": 7955, "section": "Links" }, { "markdown": "[foo][bar]\n\n[bar]: /url \"title\"\n", "html": "

foo

\n", "example": 527, "start_line": 7989, "end_line": 7995, "section": "Links" }, { "markdown": "[link [foo [bar]]][ref]\n\n[ref]: /uri\n", "html": "

link [foo [bar]]

\n", "example": 528, "start_line": 8004, "end_line": 8010, "section": "Links" }, { "markdown": "[link \\[bar][ref]\n\n[ref]: /uri\n", "html": "

link [bar

\n", "example": 529, "start_line": 8013, "end_line": 8019, "section": "Links" }, { "markdown": "[link *foo **bar** `#`*][ref]\n\n[ref]: /uri\n", "html": "

link foo bar #

\n", "example": 530, "start_line": 8024, "end_line": 8030, "section": "Links" }, { "markdown": "[![moon](moon.jpg)][ref]\n\n[ref]: /uri\n", "html": "

\"moon\"

\n", "example": 531, "start_line": 8033, "end_line": 8039, "section": "Links" }, { "markdown": "[foo [bar](/uri)][ref]\n\n[ref]: /uri\n", "html": "

[foo bar]ref

\n", "example": 532, "start_line": 8044, "end_line": 8050, "section": "Links" }, { "markdown": "[foo *bar [baz][ref]*][ref]\n\n[ref]: /uri\n", "html": "

[foo bar baz]ref

\n", "example": 533, "start_line": 8053, "end_line": 8059, "section": "Links" }, { "markdown": "*[foo*][ref]\n\n[ref]: /uri\n", "html": "

*foo*

\n", "example": 534, "start_line": 8068, "end_line": 8074, "section": "Links" }, { "markdown": "[foo *bar][ref]*\n\n[ref]: /uri\n", "html": "

foo *bar*

\n", "example": 535, "start_line": 8077, "end_line": 8083, "section": "Links" }, { "markdown": "[foo \n\n[ref]: /uri\n", "html": "

[foo

\n", "example": 536, "start_line": 8089, "end_line": 8095, "section": "Links" }, { "markdown": "[foo`][ref]`\n\n[ref]: /uri\n", "html": "

[foo][ref]

\n", "example": 537, "start_line": 8098, "end_line": 8104, "section": "Links" }, { "markdown": "[foo\n\n[ref]: /uri\n", "html": "

[foohttps://example.com/?search=][ref]

\n", "example": 538, "start_line": 8107, "end_line": 8113, "section": "Links" }, { "markdown": "[foo][BaR]\n\n[bar]: /url \"title\"\n", "html": "

foo

\n", "example": 539, "start_line": 8118, "end_line": 8124, "section": "Links" }, { "markdown": "[ẞ]\n\n[SS]: /url\n", "html": "

\n", "example": 540, "start_line": 8129, "end_line": 8135, "section": "Links" }, { "markdown": "[Foo\n bar]: /url\n\n[Baz][Foo bar]\n", "html": "

Baz

\n", "example": 541, "start_line": 8141, "end_line": 8148, "section": "Links" }, { "markdown": "[foo] [bar]\n\n[bar]: /url \"title\"\n", "html": "

[foo] bar

\n", "example": 542, "start_line": 8154, "end_line": 8160, "section": "Links" }, { "markdown": "[foo]\n[bar]\n\n[bar]: /url \"title\"\n", "html": "

[foo]\nbar

\n", "example": 543, "start_line": 8163, "end_line": 8171, "section": "Links" }, { "markdown": "[foo]: /url1\n\n[foo]: /url2\n\n[bar][foo]\n", "html": "

bar

\n", "example": 544, "start_line": 8204, "end_line": 8212, "section": "Links" }, { "markdown": "[bar][foo\\!]\n\n[foo!]: /url\n", "html": "

[bar][foo!]

\n", "example": 545, "start_line": 8219, "end_line": 8225, "section": "Links" }, { "markdown": "[foo][ref[]\n\n[ref[]: /uri\n", "html": "

[foo][ref[]

\n

[ref[]: /uri

\n", "example": 546, "start_line": 8231, "end_line": 8238, "section": "Links" }, { "markdown": "[foo][ref[bar]]\n\n[ref[bar]]: /uri\n", "html": "

[foo][ref[bar]]

\n

[ref[bar]]: /uri

\n", "example": 547, "start_line": 8241, "end_line": 8248, "section": "Links" }, { "markdown": "[[[foo]]]\n\n[[[foo]]]: /url\n", "html": "

[[[foo]]]

\n

[[[foo]]]: /url

\n", "example": 548, "start_line": 8251, "end_line": 8258, "section": "Links" }, { "markdown": "[foo][ref\\[]\n\n[ref\\[]: /uri\n", "html": "

foo

\n", "example": 549, "start_line": 8261, "end_line": 8267, "section": "Links" }, { "markdown": "[bar\\\\]: /uri\n\n[bar\\\\]\n", "html": "

bar\\

\n", "example": 550, "start_line": 8272, "end_line": 8278, "section": "Links" }, { "markdown": "[]\n\n[]: /uri\n", "html": "

[]

\n

[]: /uri

\n", "example": 551, "start_line": 8284, "end_line": 8291, "section": "Links" }, { "markdown": "[\n ]\n\n[\n ]: /uri\n", "html": "

[\n]

\n

[\n]: /uri

\n", "example": 552, "start_line": 8294, "end_line": 8305, "section": "Links" }, { "markdown": "[foo][]\n\n[foo]: /url \"title\"\n", "html": "

foo

\n", "example": 553, "start_line": 8317, "end_line": 8323, "section": "Links" }, { "markdown": "[*foo* bar][]\n\n[*foo* bar]: /url \"title\"\n", "html": "

foo bar

\n", "example": 554, "start_line": 8326, "end_line": 8332, "section": "Links" }, { "markdown": "[Foo][]\n\n[foo]: /url \"title\"\n", "html": "

Foo

\n", "example": 555, "start_line": 8337, "end_line": 8343, "section": "Links" }, { "markdown": "[foo] \n[]\n\n[foo]: /url \"title\"\n", "html": "

foo\n[]

\n", "example": 556, "start_line": 8350, "end_line": 8358, "section": "Links" }, { "markdown": "[foo]\n\n[foo]: /url \"title\"\n", "html": "

foo

\n", "example": 557, "start_line": 8370, "end_line": 8376, "section": "Links" }, { "markdown": "[*foo* bar]\n\n[*foo* bar]: /url \"title\"\n", "html": "

foo bar

\n", "example": 558, "start_line": 8379, "end_line": 8385, "section": "Links" }, { "markdown": "[[*foo* bar]]\n\n[*foo* bar]: /url \"title\"\n", "html": "

[foo bar]

\n", "example": 559, "start_line": 8388, "end_line": 8394, "section": "Links" }, { "markdown": "[[bar [foo]\n\n[foo]: /url\n", "html": "

[[bar foo

\n", "example": 560, "start_line": 8397, "end_line": 8403, "section": "Links" }, { "markdown": "[Foo]\n\n[foo]: /url \"title\"\n", "html": "

Foo

\n", "example": 561, "start_line": 8408, "end_line": 8414, "section": "Links" }, { "markdown": "[foo] bar\n\n[foo]: /url\n", "html": "

foo bar

\n", "example": 562, "start_line": 8419, "end_line": 8425, "section": "Links" }, { "markdown": "\\[foo]\n\n[foo]: /url \"title\"\n", "html": "

[foo]

\n", "example": 563, "start_line": 8431, "end_line": 8437, "section": "Links" }, { "markdown": "[foo*]: /url\n\n*[foo*]\n", "html": "

*foo*

\n", "example": 564, "start_line": 8443, "end_line": 8449, "section": "Links" }, { "markdown": "[foo][bar]\n\n[foo]: /url1\n[bar]: /url2\n", "html": "

foo

\n", "example": 565, "start_line": 8455, "end_line": 8462, "section": "Links" }, { "markdown": "[foo][]\n\n[foo]: /url1\n", "html": "

foo

\n", "example": 566, "start_line": 8464, "end_line": 8470, "section": "Links" }, { "markdown": "[foo]()\n\n[foo]: /url1\n", "html": "

foo

\n", "example": 567, "start_line": 8474, "end_line": 8480, "section": "Links" }, { "markdown": "[foo](not a link)\n\n[foo]: /url1\n", "html": "

foo(not a link)

\n", "example": 568, "start_line": 8482, "end_line": 8488, "section": "Links" }, { "markdown": "[foo][bar][baz]\n\n[baz]: /url\n", "html": "

[foo]bar

\n", "example": 569, "start_line": 8493, "end_line": 8499, "section": "Links" }, { "markdown": "[foo][bar][baz]\n\n[baz]: /url1\n[bar]: /url2\n", "html": "

foobaz

\n", "example": 570, "start_line": 8505, "end_line": 8512, "section": "Links" }, { "markdown": "[foo][bar][baz]\n\n[baz]: /url1\n[foo]: /url2\n", "html": "

[foo]bar

\n", "example": 571, "start_line": 8518, "end_line": 8525, "section": "Links" }, { "markdown": "![foo](/url \"title\")\n", "html": "

\"foo\"

\n", "example": 572, "start_line": 8541, "end_line": 8545, "section": "Images" }, { "markdown": "![foo *bar*]\n\n[foo *bar*]: train.jpg \"train & tracks\"\n", "html": "

\"foo

\n", "example": 573, "start_line": 8548, "end_line": 8554, "section": "Images" }, { "markdown": "![foo ![bar](/url)](/url2)\n", "html": "

\"foo

\n", "example": 574, "start_line": 8557, "end_line": 8561, "section": "Images" }, { "markdown": "![foo [bar](/url)](/url2)\n", "html": "

\"foo

\n", "example": 575, "start_line": 8564, "end_line": 8568, "section": "Images" }, { "markdown": "![foo *bar*][]\n\n[foo *bar*]: train.jpg \"train & tracks\"\n", "html": "

\"foo

\n", "example": 576, "start_line": 8578, "end_line": 8584, "section": "Images" }, { "markdown": "![foo *bar*][foobar]\n\n[FOOBAR]: train.jpg \"train & tracks\"\n", "html": "

\"foo

\n", "example": 577, "start_line": 8587, "end_line": 8593, "section": "Images" }, { "markdown": "![foo](train.jpg)\n", "html": "

\"foo\"

\n", "example": 578, "start_line": 8596, "end_line": 8600, "section": "Images" }, { "markdown": "My ![foo bar](/path/to/train.jpg \"title\" )\n", "html": "

My \"foo

\n", "example": 579, "start_line": 8603, "end_line": 8607, "section": "Images" }, { "markdown": "![foo]()\n", "html": "

\"foo\"

\n", "example": 580, "start_line": 8610, "end_line": 8614, "section": "Images" }, { "markdown": "![](/url)\n", "html": "

\"\"

\n", "example": 581, "start_line": 8617, "end_line": 8621, "section": "Images" }, { "markdown": "![foo][bar]\n\n[bar]: /url\n", "html": "

\"foo\"

\n", "example": 582, "start_line": 8626, "end_line": 8632, "section": "Images" }, { "markdown": "![foo][bar]\n\n[BAR]: /url\n", "html": "

\"foo\"

\n", "example": 583, "start_line": 8635, "end_line": 8641, "section": "Images" }, { "markdown": "![foo][]\n\n[foo]: /url \"title\"\n", "html": "

\"foo\"

\n", "example": 584, "start_line": 8646, "end_line": 8652, "section": "Images" }, { "markdown": "![*foo* bar][]\n\n[*foo* bar]: /url \"title\"\n", "html": "

\"foo

\n", "example": 585, "start_line": 8655, "end_line": 8661, "section": "Images" }, { "markdown": "![Foo][]\n\n[foo]: /url \"title\"\n", "html": "

\"Foo\"

\n", "example": 586, "start_line": 8666, "end_line": 8672, "section": "Images" }, { "markdown": "![foo] \n[]\n\n[foo]: /url \"title\"\n", "html": "

\"foo\"\n[]

\n", "example": 587, "start_line": 8678, "end_line": 8686, "section": "Images" }, { "markdown": "![foo]\n\n[foo]: /url \"title\"\n", "html": "

\"foo\"

\n", "example": 588, "start_line": 8691, "end_line": 8697, "section": "Images" }, { "markdown": "![*foo* bar]\n\n[*foo* bar]: /url \"title\"\n", "html": "

\"foo

\n", "example": 589, "start_line": 8700, "end_line": 8706, "section": "Images" }, { "markdown": "![[foo]]\n\n[[foo]]: /url \"title\"\n", "html": "

![[foo]]

\n

[[foo]]: /url "title"

\n", "example": 590, "start_line": 8711, "end_line": 8718, "section": "Images" }, { "markdown": "![Foo]\n\n[foo]: /url \"title\"\n", "html": "

\"Foo\"

\n", "example": 591, "start_line": 8723, "end_line": 8729, "section": "Images" }, { "markdown": "!\\[foo]\n\n[foo]: /url \"title\"\n", "html": "

![foo]

\n", "example": 592, "start_line": 8735, "end_line": 8741, "section": "Images" }, { "markdown": "\\![foo]\n\n[foo]: /url \"title\"\n", "html": "

!foo

\n", "example": 593, "start_line": 8747, "end_line": 8753, "section": "Images" }, { "markdown": "\n", "html": "

http://foo.bar.baz

\n", "example": 594, "start_line": 8780, "end_line": 8784, "section": "Autolinks" }, { "markdown": "\n", "html": "

https://foo.bar.baz/test?q=hello&id=22&boolean

\n", "example": 595, "start_line": 8787, "end_line": 8791, "section": "Autolinks" }, { "markdown": "\n", "html": "

irc://foo.bar:2233/baz

\n", "example": 596, "start_line": 8794, "end_line": 8798, "section": "Autolinks" }, { "markdown": "\n", "html": "

MAILTO:FOO@BAR.BAZ

\n", "example": 597, "start_line": 8803, "end_line": 8807, "section": "Autolinks" }, { "markdown": "\n", "html": "

a+b+c:d

\n", "example": 598, "start_line": 8815, "end_line": 8819, "section": "Autolinks" }, { "markdown": "\n", "html": "

made-up-scheme://foo,bar

\n", "example": 599, "start_line": 8822, "end_line": 8826, "section": "Autolinks" }, { "markdown": "\n", "html": "

https://../

\n", "example": 600, "start_line": 8829, "end_line": 8833, "section": "Autolinks" }, { "markdown": "\n", "html": "

localhost:5001/foo

\n", "example": 601, "start_line": 8836, "end_line": 8840, "section": "Autolinks" }, { "markdown": "\n", "html": "

<https://foo.bar/baz bim>

\n", "example": 602, "start_line": 8845, "end_line": 8849, "section": "Autolinks" }, { "markdown": "\n", "html": "

https://example.com/\\[\\

\n", "example": 603, "start_line": 8854, "end_line": 8858, "section": "Autolinks" }, { "markdown": "\n", "html": "

foo@bar.example.com

\n", "example": 604, "start_line": 8876, "end_line": 8880, "section": "Autolinks" }, { "markdown": "\n", "html": "

foo+special@Bar.baz-bar0.com

\n", "example": 605, "start_line": 8883, "end_line": 8887, "section": "Autolinks" }, { "markdown": "\n", "html": "

<foo+@bar.example.com>

\n", "example": 606, "start_line": 8892, "end_line": 8896, "section": "Autolinks" }, { "markdown": "<>\n", "html": "

<>

\n", "example": 607, "start_line": 8901, "end_line": 8905, "section": "Autolinks" }, { "markdown": "< https://foo.bar >\n", "html": "

< https://foo.bar >

\n", "example": 608, "start_line": 8908, "end_line": 8912, "section": "Autolinks" }, { "markdown": "\n", "html": "

<m:abc>

\n", "example": 609, "start_line": 8915, "end_line": 8919, "section": "Autolinks" }, { "markdown": "\n", "html": "

<foo.bar.baz>

\n", "example": 610, "start_line": 8922, "end_line": 8926, "section": "Autolinks" }, { "markdown": "https://example.com\n", "html": "

https://example.com

\n", "example": 611, "start_line": 8929, "end_line": 8933, "section": "Autolinks" }, { "markdown": "foo@bar.example.com\n", "html": "

foo@bar.example.com

\n", "example": 612, "start_line": 8936, "end_line": 8940, "section": "Autolinks" }, { "markdown": "\n", "html": "

\n", "example": 613, "start_line": 9016, "end_line": 9020, "section": "Raw HTML" }, { "markdown": "\n", "html": "

\n", "example": 614, "start_line": 9025, "end_line": 9029, "section": "Raw HTML" }, { "markdown": "\n", "html": "

\n", "example": 615, "start_line": 9034, "end_line": 9040, "section": "Raw HTML" }, { "markdown": "\n", "html": "

\n", "example": 616, "start_line": 9045, "end_line": 9051, "section": "Raw HTML" }, { "markdown": "Foo \n", "html": "

Foo

\n", "example": 617, "start_line": 9056, "end_line": 9060, "section": "Raw HTML" }, { "markdown": "<33> <__>\n", "html": "

<33> <__>

\n", "example": 618, "start_line": 9065, "end_line": 9069, "section": "Raw HTML" }, { "markdown": "
\n", "html": "

<a h*#ref="hi">

\n", "example": 619, "start_line": 9074, "end_line": 9078, "section": "Raw HTML" }, { "markdown": "
\n", "html": "

<a href="hi'> <a href=hi'>

\n", "example": 620, "start_line": 9083, "end_line": 9087, "section": "Raw HTML" }, { "markdown": "< a><\nfoo>\n\n", "html": "

< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop />

\n", "example": 621, "start_line": 9092, "end_line": 9102, "section": "Raw HTML" }, { "markdown": "
\n", "html": "

<a href='bar'title=title>

\n", "example": 622, "start_line": 9107, "end_line": 9111, "section": "Raw HTML" }, { "markdown": "
\n", "html": "

\n", "example": 623, "start_line": 9116, "end_line": 9120, "section": "Raw HTML" }, { "markdown": "\n", "html": "

</a href="foo">

\n", "example": 624, "start_line": 9125, "end_line": 9129, "section": "Raw HTML" }, { "markdown": "foo \n", "html": "

foo

\n", "example": 625, "start_line": 9134, "end_line": 9140, "section": "Raw HTML" }, { "markdown": "foo foo -->\n\nfoo foo -->\n", "html": "

foo foo -->

\n

foo foo -->

\n", "example": 626, "start_line": 9142, "end_line": 9149, "section": "Raw HTML" }, { "markdown": "foo \n", "html": "

foo

\n", "example": 627, "start_line": 9154, "end_line": 9158, "section": "Raw HTML" }, { "markdown": "foo \n", "html": "

foo

\n", "example": 628, "start_line": 9163, "end_line": 9167, "section": "Raw HTML" }, { "markdown": "foo &<]]>\n", "html": "

foo &<]]>

\n", "example": 629, "start_line": 9172, "end_line": 9176, "section": "Raw HTML" }, { "markdown": "foo \n", "html": "

foo

\n", "example": 630, "start_line": 9182, "end_line": 9186, "section": "Raw HTML" }, { "markdown": "foo \n", "html": "

foo

\n", "example": 631, "start_line": 9191, "end_line": 9195, "section": "Raw HTML" }, { "markdown": "\n", "html": "

<a href=""">

\n", "example": 632, "start_line": 9198, "end_line": 9202, "section": "Raw HTML" }, { "markdown": "foo \nbaz\n", "html": "

foo
\nbaz

\n", "example": 633, "start_line": 9212, "end_line": 9218, "section": "Hard line breaks" }, { "markdown": "foo\\\nbaz\n", "html": "

foo
\nbaz

\n", "example": 634, "start_line": 9224, "end_line": 9230, "section": "Hard line breaks" }, { "markdown": "foo \nbaz\n", "html": "

foo
\nbaz

\n", "example": 635, "start_line": 9235, "end_line": 9241, "section": "Hard line breaks" }, { "markdown": "foo \n bar\n", "html": "

foo
\nbar

\n", "example": 636, "start_line": 9246, "end_line": 9252, "section": "Hard line breaks" }, { "markdown": "foo\\\n bar\n", "html": "

foo
\nbar

\n", "example": 637, "start_line": 9255, "end_line": 9261, "section": "Hard line breaks" }, { "markdown": "*foo \nbar*\n", "html": "

foo
\nbar

\n", "example": 638, "start_line": 9267, "end_line": 9273, "section": "Hard line breaks" }, { "markdown": "*foo\\\nbar*\n", "html": "

foo
\nbar

\n", "example": 639, "start_line": 9276, "end_line": 9282, "section": "Hard line breaks" }, { "markdown": "`code \nspan`\n", "html": "

code span

\n", "example": 640, "start_line": 9287, "end_line": 9292, "section": "Hard line breaks" }, { "markdown": "`code\\\nspan`\n", "html": "

code\\ span

\n", "example": 641, "start_line": 9295, "end_line": 9300, "section": "Hard line breaks" }, { "markdown": "
\n", "html": "

\n", "example": 642, "start_line": 9305, "end_line": 9311, "section": "Hard line breaks" }, { "markdown": "\n", "html": "

\n", "example": 643, "start_line": 9314, "end_line": 9320, "section": "Hard line breaks" }, { "markdown": "foo\\\n", "html": "

foo\\

\n", "example": 644, "start_line": 9327, "end_line": 9331, "section": "Hard line breaks" }, { "markdown": "foo \n", "html": "

foo

\n", "example": 645, "start_line": 9334, "end_line": 9338, "section": "Hard line breaks" }, { "markdown": "### foo\\\n", "html": "

foo\\

\n", "example": 646, "start_line": 9341, "end_line": 9345, "section": "Hard line breaks" }, { "markdown": "### foo \n", "html": "

foo

\n", "example": 647, "start_line": 9348, "end_line": 9352, "section": "Hard line breaks" }, { "markdown": "foo\nbaz\n", "html": "

foo\nbaz

\n", "example": 648, "start_line": 9363, "end_line": 9369, "section": "Soft line breaks" }, { "markdown": "foo \n baz\n", "html": "

foo\nbaz

\n", "example": 649, "start_line": 9375, "end_line": 9381, "section": "Soft line breaks" }, { "markdown": "hello $.;'there\n", "html": "

hello $.;'there

\n", "example": 650, "start_line": 9395, "end_line": 9399, "section": "Textual content" }, { "markdown": "Foo χρῆν\n", "html": "

Foo χρῆν

\n", "example": 651, "start_line": 9402, "end_line": 9406, "section": "Textual content" }, { "markdown": "Multiple spaces\n", "html": "

Multiple spaces

\n", "example": 652, "start_line": 9411, "end_line": 9415, "section": "Textual content" } ]goldmark-1.7.4/_tools/000077500000000000000000000000001463655211100146265ustar00rootroot00000000000000goldmark-1.7.4/_tools/build-oss-fuzz-corpus.go000066400000000000000000000022401463655211100213610ustar00rootroot00000000000000package main import ( "archive/zip" "encoding/json" "io/ioutil" "log" "os" "strconv" "strings" ) type TestCase struct { Example int `json:"example"` Markdown string `json:"markdown"` } func main() { corpus_out := os.Args[1] if !strings.HasSuffix(corpus_out, ".zip") { log.Fatalln("Expected command line:", os.Args[0], ".zip") } zip_file, err := os.Create(corpus_out) zip_writer := zip.NewWriter(zip_file) if err != nil { log.Fatalln("Failed creating file:", err) } json_corpus := "_test/spec.json" bs, err := ioutil.ReadFile(json_corpus) if err != nil { log.Fatalln("Could not open file:", json_corpus) panic(err) } var testCases []TestCase if err := json.Unmarshal(bs, &testCases); err != nil { panic(err) } for _, c := range testCases { file_in_zip := "example-" + strconv.Itoa(c.Example) f, err := zip_writer.Create(file_in_zip) if err != nil { log.Fatal(err) } _, err = f.Write([]byte(c.Markdown)) if err != nil { log.Fatalf("Failed to write file: %s into zip file", file_in_zip) } } err = zip_writer.Close() if err != nil { log.Fatal("Failed to close zip writer", err) } zip_file.Close() }goldmark-1.7.4/_tools/gen-unicode-case-folding-map.go000066400000000000000000000030221463655211100224530ustar00rootroot00000000000000package main import ( "bufio" "bytes" "fmt" "io/ioutil" "net/http" "os" "strconv" "strings" ) const outPath = "../util/unicode_case_folding.go" type caseFolding struct { Class byte From rune To []rune } func main() { url := "http://www.unicode.org/Public/14.0.0/ucd/CaseFolding.txt" resp, err := http.Get(url) if err != nil { fmt.Printf("Failed to get CaseFolding.txt: %v\n", err) os.Exit(1) } defer resp.Body.Close() bs, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Printf("Failed to get CaseFolding.txt: %v\n", err) os.Exit(1) } buf := bytes.NewBuffer(bs) scanner := bufio.NewScanner(buf) f, err := os.Create(outPath) if err != nil { fmt.Printf("Failed to open %s: %v\n", outPath, err) os.Exit(1) } defer f.Close() _, _ = f.WriteString("package util\n\n") _, _ = f.WriteString("var unicodeCaseFoldings = map[rune][]rune {\n") for scanner.Scan() { line := scanner.Text() if strings.HasPrefix(line, "#") || len(strings.TrimSpace(line)) == 0 { continue } line = strings.Split(line, "#")[0] parts := strings.Split(line, ";") for i, p := range parts { parts[i] = strings.TrimSpace(p) } cf := caseFolding{} v, _ := strconv.ParseInt(parts[0], 16, 32) cf.From = rune(int32(v)) cf.Class = parts[1][0] for _, v := range strings.Split(parts[2], " ") { c, _ := strconv.ParseInt(v, 16, 32) cf.To = append(cf.To, rune(int32(c))) } if cf.Class != 'C' && cf.Class != 'F' { continue } fmt.Fprintf(f, " %#x : %#v,\n", cf.From, cf.To) } fmt.Fprintf(f, "}\n") } goldmark-1.7.4/ast/000077500000000000000000000000001463655211100141165ustar00rootroot00000000000000goldmark-1.7.4/ast/ast.go000066400000000000000000000314241463655211100152400ustar00rootroot00000000000000// Package ast defines AST nodes that represent markdown elements. package ast import ( "bytes" "fmt" "strings" textm "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) // A NodeType indicates what type a node belongs to. type NodeType int const ( // TypeBlock indicates that a node is kind of block nodes. TypeBlock NodeType = iota + 1 // TypeInline indicates that a node is kind of inline nodes. TypeInline // TypeDocument indicates that a node is kind of document nodes. TypeDocument ) // NodeKind indicates more specific type than NodeType. type NodeKind int func (k NodeKind) String() string { return kindNames[k] } var kindMax NodeKind var kindNames = []string{""} // NewNodeKind returns a new Kind value. func NewNodeKind(name string) NodeKind { kindMax++ kindNames = append(kindNames, name) return kindMax } // An Attribute is an attribute of the Node. type Attribute struct { Name []byte Value interface{} } // A Node interface defines basic AST node functionalities. type Node interface { // Type returns a type of this node. Type() NodeType // Kind returns a kind of this node. Kind() NodeKind // NextSibling returns a next sibling node of this node. NextSibling() Node // PreviousSibling returns a previous sibling node of this node. PreviousSibling() Node // Parent returns a parent node of this node. Parent() Node // SetParent sets a parent node to this node. SetParent(Node) // SetPreviousSibling sets a previous sibling node to this node. SetPreviousSibling(Node) // SetNextSibling sets a next sibling node to this node. SetNextSibling(Node) // HasChildren returns true if this node has any children, otherwise false. HasChildren() bool // ChildCount returns a total number of children. ChildCount() int // FirstChild returns a first child of this node. FirstChild() Node // LastChild returns a last child of this node. LastChild() Node // AppendChild append a node child to the tail of the children. AppendChild(self, child Node) // RemoveChild removes a node child from this node. // If a node child is not children of this node, RemoveChild nothing to do. RemoveChild(self, child Node) // RemoveChildren removes all children from this node. RemoveChildren(self Node) // SortChildren sorts childrens by comparator. SortChildren(comparator func(n1, n2 Node) int) // ReplaceChild replace a node v1 with a node insertee. // If v1 is not children of this node, ReplaceChild append a insetee to the // tail of the children. ReplaceChild(self, v1, insertee Node) // InsertBefore inserts a node insertee before a node v1. // If v1 is not children of this node, InsertBefore append a insetee to the // tail of the children. InsertBefore(self, v1, insertee Node) // InsertAfterinserts a node insertee after a node v1. // If v1 is not children of this node, InsertBefore append a insetee to the // tail of the children. InsertAfter(self, v1, insertee Node) // OwnerDocument returns this node's owner document. // If this node is not a child of the Document node, OwnerDocument // returns nil. OwnerDocument() *Document // Dump dumps an AST tree structure to stdout. // This function completely aimed for debugging. // level is a indent level. Implementer should indent informations with // 2 * level spaces. Dump(source []byte, level int) // Text returns text values of this node. Text(source []byte) []byte // HasBlankPreviousLines returns true if the row before this node is blank, // otherwise false. // This method is valid only for block nodes. HasBlankPreviousLines() bool // SetBlankPreviousLines sets whether the row before this node is blank. // This method is valid only for block nodes. SetBlankPreviousLines(v bool) // Lines returns text segments that hold positions in a source. // This method is valid only for block nodes. Lines() *textm.Segments // SetLines sets text segments that hold positions in a source. // This method is valid only for block nodes. SetLines(*textm.Segments) // IsRaw returns true if contents should be rendered as 'raw' contents. IsRaw() bool // SetAttribute sets the given value to the attributes. SetAttribute(name []byte, value interface{}) // SetAttributeString sets the given value to the attributes. SetAttributeString(name string, value interface{}) // Attribute returns a (attribute value, true) if an attribute // associated with the given name is found, otherwise // (nil, false) Attribute(name []byte) (interface{}, bool) // AttributeString returns a (attribute value, true) if an attribute // associated with the given name is found, otherwise // (nil, false) AttributeString(name string) (interface{}, bool) // Attributes returns a list of attributes. // This may be a nil if there are no attributes. Attributes() []Attribute // RemoveAttributes removes all attributes from this node. RemoveAttributes() } // A BaseNode struct implements the Node interface partialliy. type BaseNode struct { firstChild Node lastChild Node parent Node next Node prev Node childCount int attributes []Attribute } func ensureIsolated(v Node) { if p := v.Parent(); p != nil { p.RemoveChild(p, v) } } // HasChildren implements Node.HasChildren . func (n *BaseNode) HasChildren() bool { return n.firstChild != nil } // SetPreviousSibling implements Node.SetPreviousSibling . func (n *BaseNode) SetPreviousSibling(v Node) { n.prev = v } // SetNextSibling implements Node.SetNextSibling . func (n *BaseNode) SetNextSibling(v Node) { n.next = v } // PreviousSibling implements Node.PreviousSibling . func (n *BaseNode) PreviousSibling() Node { return n.prev } // NextSibling implements Node.NextSibling . func (n *BaseNode) NextSibling() Node { return n.next } // RemoveChild implements Node.RemoveChild . func (n *BaseNode) RemoveChild(self, v Node) { if v.Parent() != self { return } n.childCount-- prev := v.PreviousSibling() next := v.NextSibling() if prev != nil { prev.SetNextSibling(next) } else { n.firstChild = next } if next != nil { next.SetPreviousSibling(prev) } else { n.lastChild = prev } v.SetParent(nil) v.SetPreviousSibling(nil) v.SetNextSibling(nil) } // RemoveChildren implements Node.RemoveChildren . func (n *BaseNode) RemoveChildren(self Node) { for c := n.firstChild; c != nil; { c.SetParent(nil) c.SetPreviousSibling(nil) next := c.NextSibling() c.SetNextSibling(nil) c = next } n.firstChild = nil n.lastChild = nil n.childCount = 0 } // SortChildren implements Node.SortChildren. func (n *BaseNode) SortChildren(comparator func(n1, n2 Node) int) { var sorted Node current := n.firstChild for current != nil { next := current.NextSibling() if sorted == nil || comparator(sorted, current) >= 0 { current.SetNextSibling(sorted) if sorted != nil { sorted.SetPreviousSibling(current) } sorted = current sorted.SetPreviousSibling(nil) } else { c := sorted for c.NextSibling() != nil && comparator(c.NextSibling(), current) < 0 { c = c.NextSibling() } current.SetNextSibling(c.NextSibling()) current.SetPreviousSibling(c) if c.NextSibling() != nil { c.NextSibling().SetPreviousSibling(current) } c.SetNextSibling(current) } current = next } n.firstChild = sorted for c := n.firstChild; c != nil; c = c.NextSibling() { n.lastChild = c } } // FirstChild implements Node.FirstChild . func (n *BaseNode) FirstChild() Node { return n.firstChild } // LastChild implements Node.LastChild . func (n *BaseNode) LastChild() Node { return n.lastChild } // ChildCount implements Node.ChildCount . func (n *BaseNode) ChildCount() int { return n.childCount } // Parent implements Node.Parent . func (n *BaseNode) Parent() Node { return n.parent } // SetParent implements Node.SetParent . func (n *BaseNode) SetParent(v Node) { n.parent = v } // AppendChild implements Node.AppendChild . func (n *BaseNode) AppendChild(self, v Node) { ensureIsolated(v) if n.firstChild == nil { n.firstChild = v v.SetNextSibling(nil) v.SetPreviousSibling(nil) } else { last := n.lastChild last.SetNextSibling(v) v.SetPreviousSibling(last) } v.SetParent(self) n.lastChild = v n.childCount++ } // ReplaceChild implements Node.ReplaceChild . func (n *BaseNode) ReplaceChild(self, v1, insertee Node) { n.InsertBefore(self, v1, insertee) n.RemoveChild(self, v1) } // InsertAfter implements Node.InsertAfter . func (n *BaseNode) InsertAfter(self, v1, insertee Node) { n.InsertBefore(self, v1.NextSibling(), insertee) } // InsertBefore implements Node.InsertBefore . func (n *BaseNode) InsertBefore(self, v1, insertee Node) { n.childCount++ if v1 == nil { n.AppendChild(self, insertee) return } ensureIsolated(insertee) if v1.Parent() == self { c := v1 prev := c.PreviousSibling() if prev != nil { prev.SetNextSibling(insertee) insertee.SetPreviousSibling(prev) } else { n.firstChild = insertee insertee.SetPreviousSibling(nil) } insertee.SetNextSibling(c) c.SetPreviousSibling(insertee) insertee.SetParent(self) } } // OwnerDocument implements Node.OwnerDocument. func (n *BaseNode) OwnerDocument() *Document { d := n.Parent() for { p := d.Parent() if p == nil { if v, ok := d.(*Document); ok { return v } break } d = p } return nil } // Text implements Node.Text . func (n *BaseNode) Text(source []byte) []byte { var buf bytes.Buffer for c := n.firstChild; c != nil; c = c.NextSibling() { buf.Write(c.Text(source)) } return buf.Bytes() } // SetAttribute implements Node.SetAttribute. func (n *BaseNode) SetAttribute(name []byte, value interface{}) { if n.attributes == nil { n.attributes = make([]Attribute, 0, 10) } else { for i, a := range n.attributes { if bytes.Equal(a.Name, name) { n.attributes[i].Name = name n.attributes[i].Value = value return } } } n.attributes = append(n.attributes, Attribute{name, value}) } // SetAttributeString implements Node.SetAttributeString. func (n *BaseNode) SetAttributeString(name string, value interface{}) { n.SetAttribute(util.StringToReadOnlyBytes(name), value) } // Attribute implements Node.Attribute. func (n *BaseNode) Attribute(name []byte) (interface{}, bool) { if n.attributes == nil { return nil, false } for i, a := range n.attributes { if bytes.Equal(a.Name, name) { return n.attributes[i].Value, true } } return nil, false } // AttributeString implements Node.AttributeString. func (n *BaseNode) AttributeString(s string) (interface{}, bool) { return n.Attribute(util.StringToReadOnlyBytes(s)) } // Attributes implements Node.Attributes. func (n *BaseNode) Attributes() []Attribute { return n.attributes } // RemoveAttributes implements Node.RemoveAttributes. func (n *BaseNode) RemoveAttributes() { n.attributes = nil } // DumpHelper is a helper function to implement Node.Dump. // kv is pairs of an attribute name and an attribute value. // cb is a function called after wrote a name and attributes. func DumpHelper(v Node, source []byte, level int, kv map[string]string, cb func(int)) { name := v.Kind().String() indent := strings.Repeat(" ", level) fmt.Printf("%s%s {\n", indent, name) indent2 := strings.Repeat(" ", level+1) if v.Type() == TypeBlock { fmt.Printf("%sRawText: \"", indent2) for i := 0; i < v.Lines().Len(); i++ { line := v.Lines().At(i) fmt.Printf("%s", line.Value(source)) } fmt.Printf("\"\n") fmt.Printf("%sHasBlankPreviousLines: %v\n", indent2, v.HasBlankPreviousLines()) } for name, value := range kv { fmt.Printf("%s%s: %s\n", indent2, name, value) } if cb != nil { cb(level + 1) } for c := v.FirstChild(); c != nil; c = c.NextSibling() { c.Dump(source, level+1) } fmt.Printf("%s}\n", indent) } // WalkStatus represents a current status of the Walk function. type WalkStatus int const ( // WalkStop indicates no more walking needed. WalkStop WalkStatus = iota + 1 // WalkSkipChildren indicates that Walk wont walk on children of current // node. WalkSkipChildren // WalkContinue indicates that Walk can continue to walk. WalkContinue ) // Walker is a function that will be called when Walk find a // new node. // entering is set true before walks children, false after walked children. // If Walker returns error, Walk function immediately stop walking. type Walker func(n Node, entering bool) (WalkStatus, error) // Walk walks a AST tree by the depth first search algorithm. func Walk(n Node, walker Walker) error { _, err := walkHelper(n, walker) return err } func walkHelper(n Node, walker Walker) (WalkStatus, error) { status, err := walker(n, true) if err != nil || status == WalkStop { return status, err } if status != WalkSkipChildren { for c := n.FirstChild(); c != nil; c = c.NextSibling() { if st, err := walkHelper(c, walker); err != nil || st == WalkStop { return WalkStop, err } } } status, err = walker(n, false) if err != nil || status == WalkStop { return WalkStop, err } return WalkContinue, nil } goldmark-1.7.4/ast/ast_test.go000066400000000000000000000032421463655211100162740ustar00rootroot00000000000000package ast import ( "reflect" "testing" ) func TestRemoveChildren(t *testing.T) { root := NewDocument() node1 := NewDocument() node2 := NewDocument() root.AppendChild(root, node1) root.AppendChild(root, node2) root.RemoveChildren(root) t.Logf("%+v", node2.PreviousSibling()) } func TestWalk(t *testing.T) { tests := []struct { name string node Node want []NodeKind action map[NodeKind]WalkStatus }{ { "visits all in depth first order", node(NewDocument(), node(NewHeading(1), NewText()), NewLink()), []NodeKind{KindDocument, KindHeading, KindText, KindLink}, map[NodeKind]WalkStatus{}, }, { "stops after heading", node(NewDocument(), node(NewHeading(1), NewText()), NewLink()), []NodeKind{KindDocument, KindHeading}, map[NodeKind]WalkStatus{KindHeading: WalkStop}, }, { "skip children", node(NewDocument(), node(NewHeading(1), NewText()), NewLink()), []NodeKind{KindDocument, KindHeading, KindLink}, map[NodeKind]WalkStatus{KindHeading: WalkSkipChildren}, }, } for _, tt := range tests { var kinds []NodeKind collectKinds := func(n Node, entering bool) (WalkStatus, error) { if entering { kinds = append(kinds, n.Kind()) } if status, ok := tt.action[n.Kind()]; ok { return status, nil } return WalkContinue, nil } t.Run(tt.name, func(t *testing.T) { if err := Walk(tt.node, collectKinds); err != nil { t.Errorf("Walk() error = %v", err) } else if !reflect.DeepEqual(kinds, tt.want) { t.Errorf("Walk() expected = %v, got = %v", tt.want, kinds) } }) } } func node(n Node, children ...Node) Node { for _, c := range children { n.AppendChild(n, c) } return n } goldmark-1.7.4/ast/block.go000066400000000000000000000271241463655211100155450ustar00rootroot00000000000000package ast import ( "fmt" "strings" textm "github.com/yuin/goldmark/text" ) // A BaseBlock struct implements the Node interface partialliy. type BaseBlock struct { BaseNode blankPreviousLines bool lines *textm.Segments } // Type implements Node.Type. func (b *BaseBlock) Type() NodeType { return TypeBlock } // IsRaw implements Node.IsRaw. func (b *BaseBlock) IsRaw() bool { return false } // HasBlankPreviousLines implements Node.HasBlankPreviousLines. func (b *BaseBlock) HasBlankPreviousLines() bool { return b.blankPreviousLines } // SetBlankPreviousLines implements Node.SetBlankPreviousLines. func (b *BaseBlock) SetBlankPreviousLines(v bool) { b.blankPreviousLines = v } // Lines implements Node.Lines. func (b *BaseBlock) Lines() *textm.Segments { if b.lines == nil { b.lines = textm.NewSegments() } return b.lines } // SetLines implements Node.SetLines. func (b *BaseBlock) SetLines(v *textm.Segments) { b.lines = v } // A Document struct is a root node of Markdown text. type Document struct { BaseBlock meta map[string]interface{} } // KindDocument is a NodeKind of the Document node. var KindDocument = NewNodeKind("Document") // Dump implements Node.Dump . func (n *Document) Dump(source []byte, level int) { DumpHelper(n, source, level, nil, nil) } // Type implements Node.Type . func (n *Document) Type() NodeType { return TypeDocument } // Kind implements Node.Kind. func (n *Document) Kind() NodeKind { return KindDocument } // OwnerDocument implements Node.OwnerDocument. func (n *Document) OwnerDocument() *Document { return n } // Meta returns metadata of this document. func (n *Document) Meta() map[string]interface{} { if n.meta == nil { n.meta = map[string]interface{}{} } return n.meta } // SetMeta sets given metadata to this document. func (n *Document) SetMeta(meta map[string]interface{}) { if n.meta == nil { n.meta = map[string]interface{}{} } for k, v := range meta { n.meta[k] = v } } // AddMeta adds given metadata to this document. func (n *Document) AddMeta(key string, value interface{}) { if n.meta == nil { n.meta = map[string]interface{}{} } n.meta[key] = value } // NewDocument returns a new Document node. func NewDocument() *Document { return &Document{ BaseBlock: BaseBlock{}, meta: nil, } } // A TextBlock struct is a node whose lines // should be rendered without any containers. type TextBlock struct { BaseBlock } // Dump implements Node.Dump . func (n *TextBlock) Dump(source []byte, level int) { DumpHelper(n, source, level, nil, nil) } // KindTextBlock is a NodeKind of the TextBlock node. var KindTextBlock = NewNodeKind("TextBlock") // Kind implements Node.Kind. func (n *TextBlock) Kind() NodeKind { return KindTextBlock } // NewTextBlock returns a new TextBlock node. func NewTextBlock() *TextBlock { return &TextBlock{ BaseBlock: BaseBlock{}, } } // A Paragraph struct represents a paragraph of Markdown text. type Paragraph struct { BaseBlock } // Dump implements Node.Dump . func (n *Paragraph) Dump(source []byte, level int) { DumpHelper(n, source, level, nil, nil) } // KindParagraph is a NodeKind of the Paragraph node. var KindParagraph = NewNodeKind("Paragraph") // Kind implements Node.Kind. func (n *Paragraph) Kind() NodeKind { return KindParagraph } // NewParagraph returns a new Paragraph node. func NewParagraph() *Paragraph { return &Paragraph{ BaseBlock: BaseBlock{}, } } // IsParagraph returns true if the given node implements the Paragraph interface, // otherwise false. func IsParagraph(node Node) bool { _, ok := node.(*Paragraph) return ok } // A Heading struct represents headings like SetextHeading and ATXHeading. type Heading struct { BaseBlock // Level returns a level of this heading. // This value is between 1 and 6. Level int } // Dump implements Node.Dump . func (n *Heading) Dump(source []byte, level int) { m := map[string]string{ "Level": fmt.Sprintf("%d", n.Level), } DumpHelper(n, source, level, m, nil) } // KindHeading is a NodeKind of the Heading node. var KindHeading = NewNodeKind("Heading") // Kind implements Node.Kind. func (n *Heading) Kind() NodeKind { return KindHeading } // NewHeading returns a new Heading node. func NewHeading(level int) *Heading { return &Heading{ BaseBlock: BaseBlock{}, Level: level, } } // A ThematicBreak struct represents a thematic break of Markdown text. type ThematicBreak struct { BaseBlock } // Dump implements Node.Dump . func (n *ThematicBreak) Dump(source []byte, level int) { DumpHelper(n, source, level, nil, nil) } // KindThematicBreak is a NodeKind of the ThematicBreak node. var KindThematicBreak = NewNodeKind("ThematicBreak") // Kind implements Node.Kind. func (n *ThematicBreak) Kind() NodeKind { return KindThematicBreak } // NewThematicBreak returns a new ThematicBreak node. func NewThematicBreak() *ThematicBreak { return &ThematicBreak{ BaseBlock: BaseBlock{}, } } // A CodeBlock interface represents an indented code block of Markdown text. type CodeBlock struct { BaseBlock } // IsRaw implements Node.IsRaw. func (n *CodeBlock) IsRaw() bool { return true } // Dump implements Node.Dump . func (n *CodeBlock) Dump(source []byte, level int) { DumpHelper(n, source, level, nil, nil) } // KindCodeBlock is a NodeKind of the CodeBlock node. var KindCodeBlock = NewNodeKind("CodeBlock") // Kind implements Node.Kind. func (n *CodeBlock) Kind() NodeKind { return KindCodeBlock } // NewCodeBlock returns a new CodeBlock node. func NewCodeBlock() *CodeBlock { return &CodeBlock{ BaseBlock: BaseBlock{}, } } // A FencedCodeBlock struct represents a fenced code block of Markdown text. type FencedCodeBlock struct { BaseBlock // Info returns a info text of this fenced code block. Info *Text language []byte } // Language returns an language in an info string. // Language returns nil if this node does not have an info string. func (n *FencedCodeBlock) Language(source []byte) []byte { if n.language == nil && n.Info != nil { segment := n.Info.Segment info := segment.Value(source) i := 0 for ; i < len(info); i++ { if info[i] == ' ' { break } } n.language = info[:i] } return n.language } // IsRaw implements Node.IsRaw. func (n *FencedCodeBlock) IsRaw() bool { return true } // Dump implements Node.Dump . func (n *FencedCodeBlock) Dump(source []byte, level int) { m := map[string]string{} if n.Info != nil { m["Info"] = fmt.Sprintf("\"%s\"", n.Info.Text(source)) } DumpHelper(n, source, level, m, nil) } // KindFencedCodeBlock is a NodeKind of the FencedCodeBlock node. var KindFencedCodeBlock = NewNodeKind("FencedCodeBlock") // Kind implements Node.Kind. func (n *FencedCodeBlock) Kind() NodeKind { return KindFencedCodeBlock } // NewFencedCodeBlock return a new FencedCodeBlock node. func NewFencedCodeBlock(info *Text) *FencedCodeBlock { return &FencedCodeBlock{ BaseBlock: BaseBlock{}, Info: info, } } // A Blockquote struct represents an blockquote block of Markdown text. type Blockquote struct { BaseBlock } // Dump implements Node.Dump . func (n *Blockquote) Dump(source []byte, level int) { DumpHelper(n, source, level, nil, nil) } // KindBlockquote is a NodeKind of the Blockquote node. var KindBlockquote = NewNodeKind("Blockquote") // Kind implements Node.Kind. func (n *Blockquote) Kind() NodeKind { return KindBlockquote } // NewBlockquote returns a new Blockquote node. func NewBlockquote() *Blockquote { return &Blockquote{ BaseBlock: BaseBlock{}, } } // A List struct represents a list of Markdown text. type List struct { BaseBlock // Marker is a marker character like '-', '+', ')' and '.'. Marker byte // IsTight is a true if this list is a 'tight' list. // See https://spec.commonmark.org/0.30/#loose for details. IsTight bool // Start is an initial number of this ordered list. // If this list is not an ordered list, Start is 0. Start int } // IsOrdered returns true if this list is an ordered list, otherwise false. func (l *List) IsOrdered() bool { return l.Marker == '.' || l.Marker == ')' } // CanContinue returns true if this list can continue with // the given mark and a list type, otherwise false. func (l *List) CanContinue(marker byte, isOrdered bool) bool { return marker == l.Marker && isOrdered == l.IsOrdered() } // Dump implements Node.Dump. func (l *List) Dump(source []byte, level int) { m := map[string]string{ "Ordered": fmt.Sprintf("%v", l.IsOrdered()), "Marker": fmt.Sprintf("%c", l.Marker), "Tight": fmt.Sprintf("%v", l.IsTight), } if l.IsOrdered() { m["Start"] = fmt.Sprintf("%d", l.Start) } DumpHelper(l, source, level, m, nil) } // KindList is a NodeKind of the List node. var KindList = NewNodeKind("List") // Kind implements Node.Kind. func (l *List) Kind() NodeKind { return KindList } // NewList returns a new List node. func NewList(marker byte) *List { return &List{ BaseBlock: BaseBlock{}, Marker: marker, IsTight: true, } } // A ListItem struct represents a list item of Markdown text. type ListItem struct { BaseBlock // Offset is an offset position of this item. Offset int } // Dump implements Node.Dump. func (n *ListItem) Dump(source []byte, level int) { m := map[string]string{ "Offset": fmt.Sprintf("%d", n.Offset), } DumpHelper(n, source, level, m, nil) } // KindListItem is a NodeKind of the ListItem node. var KindListItem = NewNodeKind("ListItem") // Kind implements Node.Kind. func (n *ListItem) Kind() NodeKind { return KindListItem } // NewListItem returns a new ListItem node. func NewListItem(offset int) *ListItem { return &ListItem{ BaseBlock: BaseBlock{}, Offset: offset, } } // HTMLBlockType represents kinds of an html blocks. // See https://spec.commonmark.org/0.30/#html-blocks type HTMLBlockType int const ( // HTMLBlockType1 represents type 1 html blocks. HTMLBlockType1 HTMLBlockType = iota + 1 // HTMLBlockType2 represents type 2 html blocks. HTMLBlockType2 // HTMLBlockType3 represents type 3 html blocks. HTMLBlockType3 // HTMLBlockType4 represents type 4 html blocks. HTMLBlockType4 // HTMLBlockType5 represents type 5 html blocks. HTMLBlockType5 // HTMLBlockType6 represents type 6 html blocks. HTMLBlockType6 // HTMLBlockType7 represents type 7 html blocks. HTMLBlockType7 ) // An HTMLBlock struct represents an html block of Markdown text. type HTMLBlock struct { BaseBlock // Type is a type of this html block. HTMLBlockType HTMLBlockType // ClosureLine is a line that closes this html block. ClosureLine textm.Segment } // IsRaw implements Node.IsRaw. func (n *HTMLBlock) IsRaw() bool { return true } // HasClosure returns true if this html block has a closure line, // otherwise false. func (n *HTMLBlock) HasClosure() bool { return n.ClosureLine.Start >= 0 } // Dump implements Node.Dump. func (n *HTMLBlock) Dump(source []byte, level int) { indent := strings.Repeat(" ", level) fmt.Printf("%s%s {\n", indent, "HTMLBlock") indent2 := strings.Repeat(" ", level+1) fmt.Printf("%sRawText: \"", indent2) for i := 0; i < n.Lines().Len(); i++ { s := n.Lines().At(i) fmt.Print(string(source[s.Start:s.Stop])) } fmt.Printf("\"\n") for c := n.FirstChild(); c != nil; c = c.NextSibling() { c.Dump(source, level+1) } if n.HasClosure() { cl := n.ClosureLine fmt.Printf("%sClosure: \"%s\"\n", indent2, string(cl.Value(source))) } fmt.Printf("%s}\n", indent) } // KindHTMLBlock is a NodeKind of the HTMLBlock node. var KindHTMLBlock = NewNodeKind("HTMLBlock") // Kind implements Node.Kind. func (n *HTMLBlock) Kind() NodeKind { return KindHTMLBlock } // NewHTMLBlock returns a new HTMLBlock node. func NewHTMLBlock(typ HTMLBlockType) *HTMLBlock { return &HTMLBlock{ BaseBlock: BaseBlock{}, HTMLBlockType: typ, ClosureLine: textm.NewSegment(-1, -1), } } goldmark-1.7.4/ast/inline.go000066400000000000000000000306271463655211100157330ustar00rootroot00000000000000package ast import ( "fmt" "strings" textm "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) // A BaseInline struct implements the Node interface partialliy. type BaseInline struct { BaseNode } // Type implements Node.Type. func (b *BaseInline) Type() NodeType { return TypeInline } // IsRaw implements Node.IsRaw. func (b *BaseInline) IsRaw() bool { return false } // HasBlankPreviousLines implements Node.HasBlankPreviousLines. func (b *BaseInline) HasBlankPreviousLines() bool { panic("can not call with inline nodes.") } // SetBlankPreviousLines implements Node.SetBlankPreviousLines. func (b *BaseInline) SetBlankPreviousLines(v bool) { panic("can not call with inline nodes.") } // Lines implements Node.Lines. func (b *BaseInline) Lines() *textm.Segments { panic("can not call with inline nodes.") } // SetLines implements Node.SetLines. func (b *BaseInline) SetLines(v *textm.Segments) { panic("can not call with inline nodes.") } // A Text struct represents a textual content of the Markdown text. type Text struct { BaseInline // Segment is a position in a source text. Segment textm.Segment flags uint8 } const ( textSoftLineBreak = 1 << iota textHardLineBreak textRaw textCode ) func textFlagsString(flags uint8) string { buf := []string{} if flags&textSoftLineBreak != 0 { buf = append(buf, "SoftLineBreak") } if flags&textHardLineBreak != 0 { buf = append(buf, "HardLineBreak") } if flags&textRaw != 0 { buf = append(buf, "Raw") } if flags&textCode != 0 { buf = append(buf, "Code") } return strings.Join(buf, ", ") } // Inline implements Inline.Inline. func (n *Text) Inline() { } // SoftLineBreak returns true if this node ends with a new line, // otherwise false. func (n *Text) SoftLineBreak() bool { return n.flags&textSoftLineBreak != 0 } // SetSoftLineBreak sets whether this node ends with a new line. func (n *Text) SetSoftLineBreak(v bool) { if v { n.flags |= textSoftLineBreak } else { n.flags = n.flags &^ textSoftLineBreak } } // IsRaw returns true if this text should be rendered without unescaping // back slash escapes and resolving references. func (n *Text) IsRaw() bool { return n.flags&textRaw != 0 } // SetRaw sets whether this text should be rendered as raw contents. func (n *Text) SetRaw(v bool) { if v { n.flags |= textRaw } else { n.flags = n.flags &^ textRaw } } // HardLineBreak returns true if this node ends with a hard line break. // See https://spec.commonmark.org/0.30/#hard-line-breaks for details. func (n *Text) HardLineBreak() bool { return n.flags&textHardLineBreak != 0 } // SetHardLineBreak sets whether this node ends with a hard line break. func (n *Text) SetHardLineBreak(v bool) { if v { n.flags |= textHardLineBreak } else { n.flags = n.flags &^ textHardLineBreak } } // Merge merges a Node n into this node. // Merge returns true if the given node has been merged, otherwise false. func (n *Text) Merge(node Node, source []byte) bool { t, ok := node.(*Text) if !ok { return false } if n.Segment.Stop != t.Segment.Start || t.Segment.Padding != 0 || source[n.Segment.Stop-1] == '\n' || t.IsRaw() != n.IsRaw() { return false } n.Segment.Stop = t.Segment.Stop n.SetSoftLineBreak(t.SoftLineBreak()) n.SetHardLineBreak(t.HardLineBreak()) return true } // Text implements Node.Text. func (n *Text) Text(source []byte) []byte { return n.Segment.Value(source) } // Dump implements Node.Dump. func (n *Text) Dump(source []byte, level int) { fs := textFlagsString(n.flags) if len(fs) != 0 { fs = "(" + fs + ")" } fmt.Printf("%sText%s: \"%s\"\n", strings.Repeat(" ", level), fs, strings.TrimRight(string(n.Text(source)), "\n")) } // KindText is a NodeKind of the Text node. var KindText = NewNodeKind("Text") // Kind implements Node.Kind. func (n *Text) Kind() NodeKind { return KindText } // NewText returns a new Text node. func NewText() *Text { return &Text{ BaseInline: BaseInline{}, } } // NewTextSegment returns a new Text node with the given source position. func NewTextSegment(v textm.Segment) *Text { return &Text{ BaseInline: BaseInline{}, Segment: v, } } // NewRawTextSegment returns a new Text node with the given source position. // The new node should be rendered as raw contents. func NewRawTextSegment(v textm.Segment) *Text { t := &Text{ BaseInline: BaseInline{}, Segment: v, } t.SetRaw(true) return t } // MergeOrAppendTextSegment merges a given s into the last child of the parent if // it can be merged, otherwise creates a new Text node and appends it to after current // last child. func MergeOrAppendTextSegment(parent Node, s textm.Segment) { last := parent.LastChild() t, ok := last.(*Text) if ok && t.Segment.Stop == s.Start && !t.SoftLineBreak() { t.Segment = t.Segment.WithStop(s.Stop) } else { parent.AppendChild(parent, NewTextSegment(s)) } } // MergeOrReplaceTextSegment merges a given s into a previous sibling of the node n // if a previous sibling of the node n is *Text, otherwise replaces Node n with s. func MergeOrReplaceTextSegment(parent Node, n Node, s textm.Segment) { prev := n.PreviousSibling() if t, ok := prev.(*Text); ok && t.Segment.Stop == s.Start && !t.SoftLineBreak() { t.Segment = t.Segment.WithStop(s.Stop) parent.RemoveChild(parent, n) } else { parent.ReplaceChild(parent, n, NewTextSegment(s)) } } // A String struct is a textual content that has a concrete value. type String struct { BaseInline Value []byte flags uint8 } // Inline implements Inline.Inline. func (n *String) Inline() { } // IsRaw returns true if this text should be rendered without unescaping // back slash escapes and resolving references. func (n *String) IsRaw() bool { return n.flags&textRaw != 0 } // SetRaw sets whether this text should be rendered as raw contents. func (n *String) SetRaw(v bool) { if v { n.flags |= textRaw } else { n.flags = n.flags &^ textRaw } } // IsCode returns true if this text should be rendered without any // modifications. func (n *String) IsCode() bool { return n.flags&textCode != 0 } // SetCode sets whether this text should be rendered without any modifications. func (n *String) SetCode(v bool) { if v { n.flags |= textCode } else { n.flags = n.flags &^ textCode } } // Text implements Node.Text. func (n *String) Text(source []byte) []byte { return n.Value } // Dump implements Node.Dump. func (n *String) Dump(source []byte, level int) { fs := textFlagsString(n.flags) if len(fs) != 0 { fs = "(" + fs + ")" } fmt.Printf("%sString%s: \"%s\"\n", strings.Repeat(" ", level), fs, strings.TrimRight(string(n.Value), "\n")) } // KindString is a NodeKind of the String node. var KindString = NewNodeKind("String") // Kind implements Node.Kind. func (n *String) Kind() NodeKind { return KindString } // NewString returns a new String node. func NewString(v []byte) *String { return &String{ Value: v, } } // A CodeSpan struct represents a code span of Markdown text. type CodeSpan struct { BaseInline } // Inline implements Inline.Inline . func (n *CodeSpan) Inline() { } // IsBlank returns true if this node consists of spaces, otherwise false. func (n *CodeSpan) IsBlank(source []byte) bool { for c := n.FirstChild(); c != nil; c = c.NextSibling() { text := c.(*Text).Segment if !util.IsBlank(text.Value(source)) { return false } } return true } // Dump implements Node.Dump. func (n *CodeSpan) Dump(source []byte, level int) { DumpHelper(n, source, level, nil, nil) } // KindCodeSpan is a NodeKind of the CodeSpan node. var KindCodeSpan = NewNodeKind("CodeSpan") // Kind implements Node.Kind. func (n *CodeSpan) Kind() NodeKind { return KindCodeSpan } // NewCodeSpan returns a new CodeSpan node. func NewCodeSpan() *CodeSpan { return &CodeSpan{ BaseInline: BaseInline{}, } } // An Emphasis struct represents an emphasis of Markdown text. type Emphasis struct { BaseInline // Level is a level of the emphasis. Level int } // Dump implements Node.Dump. func (n *Emphasis) Dump(source []byte, level int) { m := map[string]string{ "Level": fmt.Sprintf("%v", n.Level), } DumpHelper(n, source, level, m, nil) } // KindEmphasis is a NodeKind of the Emphasis node. var KindEmphasis = NewNodeKind("Emphasis") // Kind implements Node.Kind. func (n *Emphasis) Kind() NodeKind { return KindEmphasis } // NewEmphasis returns a new Emphasis node with the given level. func NewEmphasis(level int) *Emphasis { return &Emphasis{ BaseInline: BaseInline{}, Level: level, } } type baseLink struct { BaseInline // Destination is a destination(URL) of this link. Destination []byte // Title is a title of this link. Title []byte } // Inline implements Inline.Inline. func (n *baseLink) Inline() { } // A Link struct represents a link of the Markdown text. type Link struct { baseLink } // Dump implements Node.Dump. func (n *Link) Dump(source []byte, level int) { m := map[string]string{} m["Destination"] = string(n.Destination) m["Title"] = string(n.Title) DumpHelper(n, source, level, m, nil) } // KindLink is a NodeKind of the Link node. var KindLink = NewNodeKind("Link") // Kind implements Node.Kind. func (n *Link) Kind() NodeKind { return KindLink } // NewLink returns a new Link node. func NewLink() *Link { c := &Link{ baseLink: baseLink{ BaseInline: BaseInline{}, }, } return c } // An Image struct represents an image of the Markdown text. type Image struct { baseLink } // Dump implements Node.Dump. func (n *Image) Dump(source []byte, level int) { m := map[string]string{} m["Destination"] = string(n.Destination) m["Title"] = string(n.Title) DumpHelper(n, source, level, m, nil) } // KindImage is a NodeKind of the Image node. var KindImage = NewNodeKind("Image") // Kind implements Node.Kind. func (n *Image) Kind() NodeKind { return KindImage } // NewImage returns a new Image node. func NewImage(link *Link) *Image { c := &Image{ baseLink: baseLink{ BaseInline: BaseInline{}, }, } c.Destination = link.Destination c.Title = link.Title for n := link.FirstChild(); n != nil; { next := n.NextSibling() link.RemoveChild(link, n) c.AppendChild(c, n) n = next } return c } // AutoLinkType defines kind of auto links. type AutoLinkType int const ( // AutoLinkEmail indicates that an autolink is an email address. AutoLinkEmail AutoLinkType = iota + 1 // AutoLinkURL indicates that an autolink is a generic URL. AutoLinkURL ) // An AutoLink struct represents an autolink of the Markdown text. type AutoLink struct { BaseInline // Type is a type of this autolink. AutoLinkType AutoLinkType // Protocol specified a protocol of the link. Protocol []byte value *Text } // Inline implements Inline.Inline. func (n *AutoLink) Inline() {} // Dump implements Node.Dump. func (n *AutoLink) Dump(source []byte, level int) { segment := n.value.Segment m := map[string]string{ "Value": string(segment.Value(source)), } DumpHelper(n, source, level, m, nil) } // KindAutoLink is a NodeKind of the AutoLink node. var KindAutoLink = NewNodeKind("AutoLink") // Kind implements Node.Kind. func (n *AutoLink) Kind() NodeKind { return KindAutoLink } // URL returns an url of this node. func (n *AutoLink) URL(source []byte) []byte { if n.Protocol != nil { s := n.value.Segment ret := make([]byte, 0, len(n.Protocol)+s.Len()+3) ret = append(ret, n.Protocol...) ret = append(ret, ':', '/', '/') ret = append(ret, n.value.Text(source)...) return ret } return n.value.Text(source) } // Label returns a label of this node. func (n *AutoLink) Label(source []byte) []byte { return n.value.Text(source) } // NewAutoLink returns a new AutoLink node. func NewAutoLink(typ AutoLinkType, value *Text) *AutoLink { return &AutoLink{ BaseInline: BaseInline{}, value: value, AutoLinkType: typ, } } // A RawHTML struct represents an inline raw HTML of the Markdown text. type RawHTML struct { BaseInline Segments *textm.Segments } // Inline implements Inline.Inline. func (n *RawHTML) Inline() {} // Dump implements Node.Dump. func (n *RawHTML) Dump(source []byte, level int) { m := map[string]string{} t := []string{} for i := 0; i < n.Segments.Len(); i++ { segment := n.Segments.At(i) t = append(t, string(segment.Value(source))) } m["RawText"] = strings.Join(t, "") DumpHelper(n, source, level, m, nil) } // KindRawHTML is a NodeKind of the RawHTML node. var KindRawHTML = NewNodeKind("RawHTML") // Kind implements Node.Kind. func (n *RawHTML) Kind() NodeKind { return KindRawHTML } // NewRawHTML returns a new RawHTML node. func NewRawHTML() *RawHTML { return &RawHTML{ Segments: textm.NewSegments(), } } goldmark-1.7.4/commonmark_test.go000066400000000000000000000022421463655211100170600ustar00rootroot00000000000000package goldmark_test import ( "encoding/json" "os" "testing" . "github.com/yuin/goldmark" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" ) type commonmarkSpecTestCase struct { Markdown string `json:"markdown"` HTML string `json:"html"` Example int `json:"example"` StartLine int `json:"start_line"` EndLine int `json:"end_line"` Section string `json:"section"` } func TestSpec(t *testing.T) { bs, err := os.ReadFile("_test/spec.json") if err != nil { panic(err) } var testCases []commonmarkSpecTestCase if err := json.Unmarshal(bs, &testCases); err != nil { panic(err) } cases := []testutil.MarkdownTestCase{} nos := testutil.ParseCliCaseArg() for _, c := range testCases { shouldAdd := len(nos) == 0 if !shouldAdd { for _, no := range nos { if c.Example == no { shouldAdd = true break } } } if shouldAdd { cases = append(cases, testutil.MarkdownTestCase{ No: c.Example, Markdown: c.Markdown, Expected: c.HTML, }) } } markdown := New(WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) testutil.DoTestCases(markdown, cases, t) } goldmark-1.7.4/extension/000077500000000000000000000000001463655211100153435ustar00rootroot00000000000000goldmark-1.7.4/extension/_test/000077500000000000000000000000001463655211100164615ustar00rootroot00000000000000goldmark-1.7.4/extension/_test/definition_list.txt000066400000000000000000000060351463655211100224110ustar00rootroot000000000000001 //- - - - - - - - -// Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. Orange : The fruit of an evergreen tree of the genus Citrus. //- - - - - - - - -//
Apple
Pomaceous fruit of plants of the genus Malus in the family Rosaceae.
Orange
The fruit of an evergreen tree of the genus Citrus.
//= = = = = = = = = = = = = = = = = = = = = = = =// 2 //- - - - - - - - -// Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. : An American computer company. Orange : The fruit of an evergreen tree of the genus Citrus. //- - - - - - - - -//
Apple
Pomaceous fruit of plants of the genus Malus in the family Rosaceae.
An American computer company.
Orange
The fruit of an evergreen tree of the genus Citrus.
//= = = = = = = = = = = = = = = = = = = = = = = =// 3 //- - - - - - - - -// Term 1 Term 2 : Definition a Term 3 : Definition b //- - - - - - - - -//
Term 1
Term 2
Definition a
Term 3
Definition b
//= = = = = = = = = = = = = = = = = = = = = = = =// 4 //- - - - - - - - -// Apple : Pomaceous fruit of plants of the genus Malus in the family Rosaceae. Orange : The fruit of an evergreen tree of the genus Citrus. //- - - - - - - - -//
Apple

Pomaceous fruit of plants of the genus Malus in the family Rosaceae.

Orange

The fruit of an evergreen tree of the genus Citrus.

//= = = = = = = = = = = = = = = = = = = = = = = =// 5 //- - - - - - - - -// Term 1 : This is a definition with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus. : Second definition for term 1, also wrapped in a paragraph because of the blank line preceding it. Term 2 : This definition has a code block, a blockquote and a list. code block. > block quote > on two lines. 1. first list item 2. second list item //- - - - - - - - -//
Term 1

This is a definition with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.

Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

Second definition for term 1, also wrapped in a paragraph because of the blank line preceding it.

Term 2

This definition has a code block, a blockquote and a list.

code block.

block quote on two lines.

  1. first list item
  2. second list item
//= = = = = = = = = = = = = = = = = = = = = = = =// 6: Definition lists indented with tabs //- - - - - - - - -// 0 : ``` 0 //- - - - - - - - -//
0
	0
//= = = = = = = = = = = = = = = = = = = = = = = =// goldmark-1.7.4/extension/_test/footnote.txt000066400000000000000000000056601463655211100210660ustar00rootroot000000000000001 //- - - - - - - - -// That's some text with a footnote.[^1] [^1]: And that's the footnote. That's the second paragraph. //- - - - - - - - -//

That's some text with a footnote.1


  1. And that's the footnote.

    That's the second paragraph. ↩︎

//= = = = = = = = = = = = = = = = = = = = = = = =// 3 //- - - - - - - - -// [^000]:0 [^]: //- - - - - - - - -// //= = = = = = = = = = = = = = = = = = = = = = = =// 4 //- - - - - - - - -// This[^3] is[^1] text with footnotes[^2]. [^1]: Footnote one [^2]: Footnote two [^3]: Footnote three //- - - - - - - - -//

This1 is2 text with footnotes3.


  1. Footnote three ↩︎

  2. Footnote one ↩︎

  3. Footnote two ↩︎

//= = = = = = = = = = = = = = = = = = = = = = = =// 5 //- - - - - - - - -// test![^1] [^1]: footnote //- - - - - - - - -//

test!1


  1. footnote ↩︎

//= = = = = = = = = = = = = = = = = = = = = = = =// 6: Multiple references to the same footnotes should have different ids //- - - - - - - - -// something[^fn:1] something[^fn:1] something[^fn:1] [^fn:1]: footnote text //- - - - - - - - -//

something1

something1

something1


  1. footnote text ↩︎ ↩︎ ↩︎

//= = = = = = = = = = = = = = = = = = = = = = = =// goldmark-1.7.4/extension/_test/linkify.txt000066400000000000000000000126031463655211100206710ustar00rootroot000000000000001 //- - - - - - - - -// www.commonmark.org //- - - - - - - - -//

www.commonmark.org

//= = = = = = = = = = = = = = = = = = = = = = = =// 2 //- - - - - - - - -// Visit www.commonmark.org/help for more information. //- - - - - - - - -//

Visit www.commonmark.org/help for more information.

//= = = = = = = = = = = = = = = = = = = = = = = =// 3 //- - - - - - - - -// www.google.com/search?q=Markup+(business) www.google.com/search?q=Markup+(business))) (www.google.com/search?q=Markup+(business)) (www.google.com/search?q=Markup+(business) //- - - - - - - - -//

www.google.com/search?q=Markup+(business)

www.google.com/search?q=Markup+(business)))

(www.google.com/search?q=Markup+(business))

(www.google.com/search?q=Markup+(business)

//= = = = = = = = = = = = = = = = = = = = = = = =// 4 //- - - - - - - - -// www.google.com/search?q=(business))+ok //- - - - - - - - -//

www.google.com/search?q=(business))+ok

//= = = = = = = = = = = = = = = = = = = = = = = =// 5 //- - - - - - - - -// www.google.com/search?q=commonmark&hl=en www.google.com/search?q=commonmark&hl; //- - - - - - - - -//

www.google.com/search?q=commonmark&hl=en

www.google.com/search?q=commonmark&hl;

//= = = = = = = = = = = = = = = = = = = = = = = =// 6 //- - - - - - - - -// www.commonmark.org/hewww.commonmark.org/he<lp

//= = = = = = = = = = = = = = = = = = = = = = = =// 7 //- - - - - - - - -// http://commonmark.org (Visit https://encrypted.google.com/search?q=Markup+(business)) Anonymous FTP is available at ftp://foo.bar.baz. //- - - - - - - - -//

http://commonmark.org

(Visit https://encrypted.google.com/search?q=Markup+(business))

Anonymous FTP is available at ftp://foo.bar.baz.

//= = = = = = = = = = = = = = = = = = = = = = = =// 8 //- - - - - - - - -// foo@bar.baz //- - - - - - - - -//

foo@bar.baz

//= = = = = = = = = = = = = = = = = = = = = = = =// 9 //- - - - - - - - -// hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is. //- - - - - - - - -//

hello@mail+xyz.example isn't valid, but hello+xyz@mail.example is.

//= = = = = = = = = = = = = = = = = = = = = = = =// 10 //- - - - - - - - -// a.b-c_d@a.b a.b-c_d@a.b. a.b-c_d@a.b- a.b-c_d@a.b_ //- - - - - - - - -//

a.b-c_d@a.b

a.b-c_d@a.b.

a.b-c_d@a.b-

a.b-c_d@a.b_

//= = = = = = = = = = = = = = = = = = = = = = = =// 11 //- - - - - - - - -// https://github.com#sun,mon //- - - - - - - - -//

https://github.com#sun,mon

//= = = = = = = = = = = = = = = = = = = = = = = =// 12 //- - - - - - - - -// https://github.com/sunday's //- - - - - - - - -//

https://github.com/sunday's

//= = = = = = = = = = = = = = = = = = = = = = = =// 13 //- - - - - - - - -// https://github.com?q=stars:>1 //- - - - - - - - -//

https://github.com?q=stars:>1

//= = = = = = = = = = = = = = = = = = = = = = = =// 14 //- - - - - - - - -// [https://google.com](https://google.com) //- - - - - - - - -//

https://google.com

//= = = = = = = = = = = = = = = = = = = = = = = =// 15 //- - - - - - - - -// This is a `git@github.com:vim/vim` //- - - - - - - - -//

This is a git@github.com:vim/vim

//= = = = = = = = = = = = = = = = = = = = = = = =// 16 //- - - - - - - - -// https://nic.college //- - - - - - - - -//

https://nic.college

//= = = = = = = = = = = = = = = = = = = = = = = =// 17 //- - - - - - - - -// http://server.intranet.acme.com:1313 //- - - - - - - - -//

http://server.intranet.acme.com:1313

//= = = = = = = = = = = = = = = = = = = = = = = =// 18 //- - - - - - - - -// https://g.page/foo //- - - - - - - - -//

https://g.page/foo

//= = = = = = = = = = = = = = = = = = = = = = = =// 19: Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink //- - - - - - - - -// __http://test.com/~/a__ __http://test.com/~/__ __http://test.com/~__ __http://test.com/a/~__ //- - - - - - - - -//

http://test.com/~/a http://test.com/~/ http://test.com/~ http://test.com/a/~

//= = = = = = = = = = = = = = = = = = = = = = = =// goldmark-1.7.4/extension/_test/strikethrough.txt000066400000000000000000000016641463655211100221330ustar00rootroot000000000000001 //- - - - - - - - -// ~~Hi~~ Hello, world! //- - - - - - - - -//

Hi Hello, world!

//= = = = = = = = = = = = = = = = = = = = = = = =// 2 //- - - - - - - - -// This ~~has a new paragraph~~. //- - - - - - - - -//

This ~~has a

new paragraph~~.

//= = = = = = = = = = = = = = = = = = = = = = = =// 3 //- - - - - - - - -// ~Hi~ Hello, world! //- - - - - - - - -//

Hi Hello, world!

//= = = = = = = = = = = = = = = = = = = = = = = =// 4: Three or more tildes do not create a strikethrough //- - - - - - - - -// This will ~~~not~~~ strike. //- - - - - - - - -//

This will ~~~not~~~ strike.

//= = = = = = = = = = = = = = = = = = = = = = = =// 5: Leading three or more tildes do not create a strikethrough, create a code block //- - - - - - - - -// ~~~Hi~~~ Hello, world! //- - - - - - - - -//
//= = = = = = = = = = = = = = = = = = = = = = = =// goldmark-1.7.4/extension/_test/table.txt000066400000000000000000000067151463655211100203220ustar00rootroot000000000000001 //- - - - - - - - -// | foo | bar | | --- | --- | | baz | bim | //- - - - - - - - -//
foo bar
baz bim
//= = = = = = = = = = = = = = = = = = = = = = = =// 2 //- - - - - - - - -// | abc | defghi | :-: | -----------: bar | baz //- - - - - - - - -//
abc defghi
bar baz
//= = = = = = = = = = = = = = = = = = = = = = = =// 3 //- - - - - - - - -// | f\|oo | | ------ | | b `\|` az | | b **\|** im | //- - - - - - - - -//
f|oo
b | az
b | im
//= = = = = = = = = = = = = = = = = = = = = = = =// 4 //- - - - - - - - -// | abc | def | | --- | --- | | bar | baz | > bar //- - - - - - - - -//
abc def
bar baz

bar

//= = = = = = = = = = = = = = = = = = = = = = = =// 5 //- - - - - - - - -// | abc | def | | --- | --- | | bar | baz | bar bar //- - - - - - - - -//
abc def
bar baz
bar

bar

//= = = = = = = = = = = = = = = = = = = = = = = =// 6 //- - - - - - - - -// | abc | def | | --- | | bar | //- - - - - - - - -//

| abc | def | | --- | | bar |

//= = = = = = = = = = = = = = = = = = = = = = = =// 7 //- - - - - - - - -// | abc | def | | --- | --- | | bar | | bar | baz | boo | //- - - - - - - - -//
abc def
bar
bar baz
//= = = = = = = = = = = = = = = = = = = = = = = =// 8 //- - - - - - - - -// | abc | def | | --- | --- | //- - - - - - - - -//
abc def
//= = = = = = = = = = = = = = = = = = = = = = = =// 9 //- - - - - - - - -// Foo|Bar ---|--- `Yoyo`|Dyne //- - - - - - - - -//
Foo Bar
Yoyo Dyne
//= = = = = = = = = = = = = = = = = = = = = = = =// 10 //- - - - - - - - -// foo|bar ---|--- `\` | second column //- - - - - - - - -//
foo bar
\ second column
//= = = = = = = = = = = = = = = = = = = = = = = =// 11: Tables can interrupt paragraph //- - - - - - - - -// **xxx** | hello | hi | | :----: | :----:| //- - - - - - - - -//

xxx

hello hi
//= = = = = = = = = = = = = = = = = = = = = = = =// 12: A delimiter can not start with more than 3 spaces //- - - - - - - - -// Foo --- //- - - - - - - - -//

Foo ---

//= = = = = = = = = = = = = = = = = = = = = = = =// 13: A delimiter can not start with more than 3 spaces(w/ tabs) OPTIONS: {"enableEscape": true} //- - - - - - - - -// - aaa Foo \t\t--- //- - - - - - - - -//
  • aaa

    Foo ---

//= = = = = = = = = = = = = = = = = = = = = = = =// goldmark-1.7.4/extension/_test/tasklist.txt000066400000000000000000000016701463655211100210640ustar00rootroot000000000000001 //- - - - - - - - -// - [ ] foo - [x] bar //- - - - - - - - -//
  • foo
  • bar
//= = = = = = = = = = = = = = = = = = = = = = = =// 2 //- - - - - - - - -// - [x] foo - [ ] bar - [x] baz - [ ] bim //- - - - - - - - -//
  • foo
    • bar
    • baz
  • bim
//= = = = = = = = = = = = = = = = = = = = = = = =// 3 //- - - - - - - - -// - test[x]=[x] //- - - - - - - - -//
  • test[x]=[x]
//= = = = = = = = = = = = = = = = = = = = = = = =// 4 //- - - - - - - - -// + [x] [x] //- - - - - - - - -//
  • [x]
//= = = = = = = = = = = = = = = = = = = = = = = =// goldmark-1.7.4/extension/_test/typographer.txt000066400000000000000000000123251463655211100215710ustar00rootroot000000000000001 //- - - - - - - - -// This should 'be' replaced //- - - - - - - - -//

This should ‘be’ replaced

//= = = = = = = = = = = = = = = = = = = = = = = =// 2 //- - - - - - - - -// This should "be" replaced //- - - - - - - - -//

This should “be” replaced

//= = = = = = = = = = = = = = = = = = = = = = = =// 3 //- - - - - - - - -// **--** *---* a...<< b>> //- - - - - - - - -//

a…« b»

//= = = = = = = = = = = = = = = = = = = = = = = =// 4 //- - - - - - - - -// Some say '90s, others say 90's, but I can't say which is best. //- - - - - - - - -//

Some say ’90s, others say 90’s, but I can’t say which is best.

//= = = = = = = = = = = = = = = = = = = = = = = =// 5: contractions //- - - - - - - - -// Alice's, I'm ,Don't, You'd I've, I'll, You're [Cat][]'s Pajamas Yahoo!'s [Cat]: http://example.com //- - - - - - - - -//

Alice’s, I’m ,Don’t, You’d

I’ve, I’ll, You’re

Cat’s Pajamas

Yahoo!’s

//= = = = = = = = = = = = = = = = = = = = = = = =// 6: "" after digits are an inch //- - - - - - - - -// My height is 5'6"". //- - - - - - - - -//

My height is 5'6"".

//= = = = = = = = = = = = = = = = = = = = = = = =// 7: quote followed by ,.?! and spaces maybe a closer //- - - - - - - - -// reported "issue 1 (IE-only)", "issue 2", 'issue3 (FF-only)', 'issue4' //- - - - - - - - -//

reported “issue 1 (IE-only)”, “issue 2”, ‘issue3 (FF-only)’, ‘issue4’

//= = = = = = = = = = = = = = = = = = = = = = = =// 8: handle inches in qoutes //- - - - - - - - -// "Monitor 21"" and "Monitor"" //- - - - - - - - -//

“Monitor 21"” and “Monitor”"

//= = = = = = = = = = = = = = = = = = = = = = = =// 9: Closing quotation marks within italics //- - - - - - - - -// *"At first, things were not clear."* //- - - - - - - - -//

“At first, things were not clear.”

//= = = = = = = = = = = = = = = = = = = = = = = =// 10: Closing quotation marks within boldfacing //- - - - - - - - -// **"At first, things were not clear."** //- - - - - - - - -//

“At first, things were not clear.”

//= = = = = = = = = = = = = = = = = = = = = = = =// 11: Closing quotation marks within boldfacing and italics //- - - - - - - - -// ***"At first, things were not clear."*** //- - - - - - - - -//

“At first, things were not clear.”

//= = = = = = = = = = = = = = = = = = = = = = = =// 12: Closing quotation marks within boldfacing and italics //- - - - - - - - -// ***"At first, things were not clear."*** //- - - - - - - - -//

“At first, things were not clear.”

//= = = = = = = = = = = = = = = = = = = = = = = =// 13: Plural possessives //- - - - - - - - -// John's dog is named Sam. The Smiths' dog is named Rover. //- - - - - - - - -//

John’s dog is named Sam. The Smiths’ dog is named Rover.

//= = = = = = = = = = = = = = = = = = = = = = = =// 14: Links within quotation marks and parenthetical phrases //- - - - - - - - -// This is not difficult (see "[Introduction to Hugo Templating](https://gohugo.io/templates/introduction/)"). //- - - - - - - - -//

This is not difficult (see “Introduction to Hugo Templating”).

//= = = = = = = = = = = = = = = = = = = = = = = =// 15: Quotation marks within links //- - - - - - - - -// Apple's early Cairo font gave us ["moof" and the "dogcow."](https://www.macworld.com/article/2926184/we-miss-you-clarus-the-dogcow.html) //- - - - - - - - -//

Apple’s early Cairo font gave us “moof” and the “dogcow.”

//= = = = = = = = = = = = = = = = = = = = = = = =// 16: Single closing quotation marks with slang/informalities //- - - - - - - - -// "I'm not doin' that," Bill said with emphasis. //- - - - - - - - -//

“I’m not doin’ that,” Bill said with emphasis.

//= = = = = = = = = = = = = = = = = = = = = = = =// 17: Closing single quotation marks in quotations-within-quotations //- - - - - - - - -// Janet said, "When everything is 'breaking news,' nothing is 'breaking news.'" //- - - - - - - - -//

Janet said, “When everything is ‘breaking news,’ nothing is ‘breaking news.’”

//= = = = = = = = = = = = = = = = = = = = = = = =// 18: Opening single quotation marks for abbreviations //- - - - - - - - -// We're talking about the internet --- 'net for short. Let's rock 'n roll! //- - - - - - - - -//

We’re talking about the internet — ’net for short. Let’s rock ’n roll!

//= = = = = = = = = = = = = = = = = = = = = = = =// 19: Quotes in alt text //- - - - - - - - -// ![Nice & day, **isn't** it?](https://example.com/image.jpg) //- - - - - - - - -//

Nice & day, isn’t it?

//= = = = = = = = = = = = = = = = = = = = = = = =// goldmark-1.7.4/extension/ast/000077500000000000000000000000001463655211100161325ustar00rootroot00000000000000goldmark-1.7.4/extension/ast/definition_list.go000066400000000000000000000043311463655211100216450ustar00rootroot00000000000000package ast import ( gast "github.com/yuin/goldmark/ast" ) // A DefinitionList struct represents a definition list of Markdown // (PHPMarkdownExtra) text. type DefinitionList struct { gast.BaseBlock Offset int TemporaryParagraph *gast.Paragraph } // Dump implements Node.Dump. func (n *DefinitionList) Dump(source []byte, level int) { gast.DumpHelper(n, source, level, nil, nil) } // KindDefinitionList is a NodeKind of the DefinitionList node. var KindDefinitionList = gast.NewNodeKind("DefinitionList") // Kind implements Node.Kind. func (n *DefinitionList) Kind() gast.NodeKind { return KindDefinitionList } // NewDefinitionList returns a new DefinitionList node. func NewDefinitionList(offset int, para *gast.Paragraph) *DefinitionList { return &DefinitionList{ Offset: offset, TemporaryParagraph: para, } } // A DefinitionTerm struct represents a definition list term of Markdown // (PHPMarkdownExtra) text. type DefinitionTerm struct { gast.BaseBlock } // Dump implements Node.Dump. func (n *DefinitionTerm) Dump(source []byte, level int) { gast.DumpHelper(n, source, level, nil, nil) } // KindDefinitionTerm is a NodeKind of the DefinitionTerm node. var KindDefinitionTerm = gast.NewNodeKind("DefinitionTerm") // Kind implements Node.Kind. func (n *DefinitionTerm) Kind() gast.NodeKind { return KindDefinitionTerm } // NewDefinitionTerm returns a new DefinitionTerm node. func NewDefinitionTerm() *DefinitionTerm { return &DefinitionTerm{} } // A DefinitionDescription struct represents a definition list description of Markdown // (PHPMarkdownExtra) text. type DefinitionDescription struct { gast.BaseBlock IsTight bool } // Dump implements Node.Dump. func (n *DefinitionDescription) Dump(source []byte, level int) { gast.DumpHelper(n, source, level, nil, nil) } // KindDefinitionDescription is a NodeKind of the DefinitionDescription node. var KindDefinitionDescription = gast.NewNodeKind("DefinitionDescription") // Kind implements Node.Kind. func (n *DefinitionDescription) Kind() gast.NodeKind { return KindDefinitionDescription } // NewDefinitionDescription returns a new DefinitionDescription node. func NewDefinitionDescription() *DefinitionDescription { return &DefinitionDescription{} } goldmark-1.7.4/extension/ast/footnote.go000066400000000000000000000063311463655211100203210ustar00rootroot00000000000000package ast import ( "fmt" gast "github.com/yuin/goldmark/ast" ) // A FootnoteLink struct represents a link to a footnote of Markdown // (PHP Markdown Extra) text. type FootnoteLink struct { gast.BaseInline Index int RefCount int RefIndex int } // Dump implements Node.Dump. func (n *FootnoteLink) Dump(source []byte, level int) { m := map[string]string{} m["Index"] = fmt.Sprintf("%v", n.Index) m["RefCount"] = fmt.Sprintf("%v", n.RefCount) m["RefIndex"] = fmt.Sprintf("%v", n.RefIndex) gast.DumpHelper(n, source, level, m, nil) } // KindFootnoteLink is a NodeKind of the FootnoteLink node. var KindFootnoteLink = gast.NewNodeKind("FootnoteLink") // Kind implements Node.Kind. func (n *FootnoteLink) Kind() gast.NodeKind { return KindFootnoteLink } // NewFootnoteLink returns a new FootnoteLink node. func NewFootnoteLink(index int) *FootnoteLink { return &FootnoteLink{ Index: index, RefCount: 0, RefIndex: 0, } } // A FootnoteBacklink struct represents a link to a footnote of Markdown // (PHP Markdown Extra) text. type FootnoteBacklink struct { gast.BaseInline Index int RefCount int RefIndex int } // Dump implements Node.Dump. func (n *FootnoteBacklink) Dump(source []byte, level int) { m := map[string]string{} m["Index"] = fmt.Sprintf("%v", n.Index) m["RefCount"] = fmt.Sprintf("%v", n.RefCount) m["RefIndex"] = fmt.Sprintf("%v", n.RefIndex) gast.DumpHelper(n, source, level, m, nil) } // KindFootnoteBacklink is a NodeKind of the FootnoteBacklink node. var KindFootnoteBacklink = gast.NewNodeKind("FootnoteBacklink") // Kind implements Node.Kind. func (n *FootnoteBacklink) Kind() gast.NodeKind { return KindFootnoteBacklink } // NewFootnoteBacklink returns a new FootnoteBacklink node. func NewFootnoteBacklink(index int) *FootnoteBacklink { return &FootnoteBacklink{ Index: index, RefCount: 0, RefIndex: 0, } } // A Footnote struct represents a footnote of Markdown // (PHP Markdown Extra) text. type Footnote struct { gast.BaseBlock Ref []byte Index int } // Dump implements Node.Dump. func (n *Footnote) Dump(source []byte, level int) { m := map[string]string{} m["Index"] = fmt.Sprintf("%v", n.Index) m["Ref"] = string(n.Ref) gast.DumpHelper(n, source, level, m, nil) } // KindFootnote is a NodeKind of the Footnote node. var KindFootnote = gast.NewNodeKind("Footnote") // Kind implements Node.Kind. func (n *Footnote) Kind() gast.NodeKind { return KindFootnote } // NewFootnote returns a new Footnote node. func NewFootnote(ref []byte) *Footnote { return &Footnote{ Ref: ref, Index: -1, } } // A FootnoteList struct represents footnotes of Markdown // (PHP Markdown Extra) text. type FootnoteList struct { gast.BaseBlock Count int } // Dump implements Node.Dump. func (n *FootnoteList) Dump(source []byte, level int) { m := map[string]string{} m["Count"] = fmt.Sprintf("%v", n.Count) gast.DumpHelper(n, source, level, m, nil) } // KindFootnoteList is a NodeKind of the FootnoteList node. var KindFootnoteList = gast.NewNodeKind("FootnoteList") // Kind implements Node.Kind. func (n *FootnoteList) Kind() gast.NodeKind { return KindFootnoteList } // NewFootnoteList returns a new FootnoteList node. func NewFootnoteList() *FootnoteList { return &FootnoteList{ Count: 0, } } goldmark-1.7.4/extension/ast/strikethrough.go000066400000000000000000000013321463655211100213620ustar00rootroot00000000000000// Package ast defines AST nodes that represents extension's elements package ast import ( gast "github.com/yuin/goldmark/ast" ) // A Strikethrough struct represents a strikethrough of GFM text. type Strikethrough struct { gast.BaseInline } // Dump implements Node.Dump. func (n *Strikethrough) Dump(source []byte, level int) { gast.DumpHelper(n, source, level, nil, nil) } // KindStrikethrough is a NodeKind of the Strikethrough node. var KindStrikethrough = gast.NewNodeKind("Strikethrough") // Kind implements Node.Kind. func (n *Strikethrough) Kind() gast.NodeKind { return KindStrikethrough } // NewStrikethrough returns a new Strikethrough node. func NewStrikethrough() *Strikethrough { return &Strikethrough{} } goldmark-1.7.4/extension/ast/table.go000066400000000000000000000066761463655211100175670ustar00rootroot00000000000000package ast import ( "fmt" "strings" gast "github.com/yuin/goldmark/ast" ) // Alignment is a text alignment of table cells. type Alignment int const ( // AlignLeft indicates text should be left justified. AlignLeft Alignment = iota + 1 // AlignRight indicates text should be right justified. AlignRight // AlignCenter indicates text should be centered. AlignCenter // AlignNone indicates text should be aligned by default manner. AlignNone ) func (a Alignment) String() string { switch a { case AlignLeft: return "left" case AlignRight: return "right" case AlignCenter: return "center" case AlignNone: return "none" } return "" } // A Table struct represents a table of Markdown(GFM) text. type Table struct { gast.BaseBlock // Alignments returns alignments of the columns. Alignments []Alignment } // Dump implements Node.Dump. func (n *Table) Dump(source []byte, level int) { gast.DumpHelper(n, source, level, nil, func(level int) { indent := strings.Repeat(" ", level) fmt.Printf("%sAlignments {\n", indent) for i, alignment := range n.Alignments { indent2 := strings.Repeat(" ", level+1) fmt.Printf("%s%s", indent2, alignment.String()) if i != len(n.Alignments)-1 { fmt.Println("") } } fmt.Printf("\n%s}\n", indent) }) } // KindTable is a NodeKind of the Table node. var KindTable = gast.NewNodeKind("Table") // Kind implements Node.Kind. func (n *Table) Kind() gast.NodeKind { return KindTable } // NewTable returns a new Table node. func NewTable() *Table { return &Table{ Alignments: []Alignment{}, } } // A TableRow struct represents a table row of Markdown(GFM) text. type TableRow struct { gast.BaseBlock Alignments []Alignment } // Dump implements Node.Dump. func (n *TableRow) Dump(source []byte, level int) { gast.DumpHelper(n, source, level, nil, nil) } // KindTableRow is a NodeKind of the TableRow node. var KindTableRow = gast.NewNodeKind("TableRow") // Kind implements Node.Kind. func (n *TableRow) Kind() gast.NodeKind { return KindTableRow } // NewTableRow returns a new TableRow node. func NewTableRow(alignments []Alignment) *TableRow { return &TableRow{Alignments: alignments} } // A TableHeader struct represents a table header of Markdown(GFM) text. type TableHeader struct { gast.BaseBlock Alignments []Alignment } // KindTableHeader is a NodeKind of the TableHeader node. var KindTableHeader = gast.NewNodeKind("TableHeader") // Kind implements Node.Kind. func (n *TableHeader) Kind() gast.NodeKind { return KindTableHeader } // Dump implements Node.Dump. func (n *TableHeader) Dump(source []byte, level int) { gast.DumpHelper(n, source, level, nil, nil) } // NewTableHeader returns a new TableHeader node. func NewTableHeader(row *TableRow) *TableHeader { n := &TableHeader{} for c := row.FirstChild(); c != nil; { next := c.NextSibling() n.AppendChild(n, c) c = next } return n } // A TableCell struct represents a table cell of a Markdown(GFM) text. type TableCell struct { gast.BaseBlock Alignment Alignment } // Dump implements Node.Dump. func (n *TableCell) Dump(source []byte, level int) { gast.DumpHelper(n, source, level, nil, nil) } // KindTableCell is a NodeKind of the TableCell node. var KindTableCell = gast.NewNodeKind("TableCell") // Kind implements Node.Kind. func (n *TableCell) Kind() gast.NodeKind { return KindTableCell } // NewTableCell returns a new TableCell node. func NewTableCell() *TableCell { return &TableCell{ Alignment: AlignNone, } } goldmark-1.7.4/extension/ast/tasklist.go000066400000000000000000000014061463655211100203200ustar00rootroot00000000000000package ast import ( "fmt" gast "github.com/yuin/goldmark/ast" ) // A TaskCheckBox struct represents a checkbox of a task list. type TaskCheckBox struct { gast.BaseInline IsChecked bool } // Dump implements Node.Dump. func (n *TaskCheckBox) Dump(source []byte, level int) { m := map[string]string{ "Checked": fmt.Sprintf("%v", n.IsChecked), } gast.DumpHelper(n, source, level, m, nil) } // KindTaskCheckBox is a NodeKind of the TaskCheckBox node. var KindTaskCheckBox = gast.NewNodeKind("TaskCheckBox") // Kind implements Node.Kind. func (n *TaskCheckBox) Kind() gast.NodeKind { return KindTaskCheckBox } // NewTaskCheckBox returns a new TaskCheckBox node. func NewTaskCheckBox(checked bool) *TaskCheckBox { return &TaskCheckBox{ IsChecked: checked, } } goldmark-1.7.4/extension/cjk.go000066400000000000000000000042221463655211100164410ustar00rootroot00000000000000package extension import ( "github.com/yuin/goldmark" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer/html" ) // A CJKOption sets options for CJK support mostly for HTML based renderers. type CJKOption func(*cjk) // A EastAsianLineBreaks is a style of east asian line breaks. type EastAsianLineBreaks int const ( //EastAsianLineBreaksNone renders line breaks as it is. EastAsianLineBreaksNone EastAsianLineBreaks = iota // EastAsianLineBreaksSimple is a style where soft line breaks are ignored // if both sides of the break are east asian wide characters. EastAsianLineBreaksSimple // EastAsianLineBreaksCSS3Draft is a style where soft line breaks are ignored // even if only one side of the break is an east asian wide character. EastAsianLineBreaksCSS3Draft ) // WithEastAsianLineBreaks is a functional option that indicates whether softline breaks // between east asian wide characters should be ignored. // style defauts to [EastAsianLineBreaksSimple] . func WithEastAsianLineBreaks(style ...EastAsianLineBreaks) CJKOption { return func(c *cjk) { if len(style) == 0 { c.EastAsianLineBreaks = EastAsianLineBreaksSimple return } c.EastAsianLineBreaks = style[0] } } // WithEscapedSpace is a functional option that indicates that a '\' escaped half-space(0x20) should not be rendered. func WithEscapedSpace() CJKOption { return func(c *cjk) { c.EscapedSpace = true } } type cjk struct { EastAsianLineBreaks EastAsianLineBreaks EscapedSpace bool } // CJK is a goldmark extension that provides functionalities for CJK languages. var CJK = NewCJK(WithEastAsianLineBreaks(), WithEscapedSpace()) // NewCJK returns a new extension with given options. func NewCJK(opts ...CJKOption) goldmark.Extender { e := &cjk{ EastAsianLineBreaks: EastAsianLineBreaksNone, } for _, opt := range opts { opt(e) } return e } func (e *cjk) Extend(m goldmark.Markdown) { m.Renderer().AddOptions(html.WithEastAsianLineBreaks( html.EastAsianLineBreaks(e.EastAsianLineBreaks))) if e.EscapedSpace { m.Renderer().AddOptions(html.WithWriter(html.NewWriter(html.WithEscapedSpace()))) m.Parser().AddOptions(parser.WithEscapedSpace()) } } goldmark-1.7.4/extension/cjk_test.go000066400000000000000000000203551463655211100175050ustar00rootroot00000000000000package extension import ( "testing" "github.com/yuin/goldmark" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" ) func TestEscapedSpace(t *testing.T) { markdown := goldmark.New(goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) no := 1 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Without spaces around an emphasis started with east asian punctuations, it is not interpreted as an emphasis(as defined in CommonMark spec)", Markdown: "太郎は**「こんにちわ」**と言った\nんです", Expected: "

太郎は**「こんにちわ」**と言った\nんです

", }, t, ) no = 2 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "With spaces around an emphasis started with east asian punctuations, it is interpreted as an emphasis(but remains unnecessary spaces)", Markdown: "太郎は **「こんにちわ」** と言った\nんです", Expected: "

太郎は 「こんにちわ」 と言った\nんです

", }, t, ) // Enables EscapedSpace markdown = goldmark.New(goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions(NewCJK(WithEscapedSpace())), ) no = 3 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "With spaces around an emphasis started with east asian punctuations,it is interpreted as an emphasis", Markdown: "太郎は\\ **「こんにちわ」**\\ と言った\nんです", Expected: "

太郎は「こんにちわ」と言った\nんです

", }, t, ) // ' ' triggers Linkify extension inline parser. // Escaped spaces should not trigger the inline parser. markdown = goldmark.New(goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( NewCJK(WithEscapedSpace()), Linkify, ), ) no = 4 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Escaped space and linkfy extension", Markdown: "太郎は\\ **「こんにちわ」**\\ と言った\nんです", Expected: "

太郎は「こんにちわ」と言った\nんです

", }, t, ) } func TestEastAsianLineBreaks(t *testing.T) { markdown := goldmark.New(goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) no := 1 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Soft line breaks are rendered as a newline, so some asian users will see it as an unnecessary space", Markdown: "太郎は\\ **「こんにちわ」**\\ と言った\nんです", Expected: "

太郎は\\ 「こんにちわ」\\ と言った\nんです

", }, t, ) // Enables EastAsianLineBreaks markdown = goldmark.New(goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions(NewCJK(WithEastAsianLineBreaks())), ) no = 2 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Soft line breaks between east asian wide characters are ignored", Markdown: "太郎は\\ **「こんにちわ」**\\ と言った\nんです", Expected: "

太郎は\\ 「こんにちわ」\\ と言ったんです

", }, t, ) no = 3 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Soft line breaks between western characters are rendered as a newline", Markdown: "太郎は\\ **「こんにちわ」**\\ と言ったa\nbんです", Expected: "

太郎は\\ 「こんにちわ」\\ と言ったa\nbんです

", }, t, ) no = 4 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Soft line breaks between a western character and an east asian wide character are rendered as a newline", Markdown: "太郎は\\ **「こんにちわ」**\\ と言ったa\nんです", Expected: "

太郎は\\ 「こんにちわ」\\ と言ったa\nんです

", }, t, ) no = 5 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Soft line breaks between an east asian wide character and a western character are rendered as a newline", Markdown: "太郎は\\ **「こんにちわ」**\\ と言った\nbんです", Expected: "

太郎は\\ 「こんにちわ」\\ と言った\nbんです

", }, t, ) // WithHardWraps take precedence over WithEastAsianLineBreaks markdown = goldmark.New(goldmark.WithRendererOptions( html.WithHardWraps(), html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions(NewCJK(WithEastAsianLineBreaks())), ) no = 6 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "WithHardWraps take precedence over WithEastAsianLineBreaks", Markdown: "太郎は\\ **「こんにちわ」**\\ と言った\nんです", Expected: "

太郎は\\ 「こんにちわ」\\ と言った
\nんです

", }, t, ) // Tests with EastAsianLineBreaksStyleSimple markdown = goldmark.New(goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( NewCJK(WithEastAsianLineBreaks()), Linkify, ), ) no = 7 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "WithEastAsianLineBreaks and linkfy extension", Markdown: "太郎は\\ **「こんにちわ」**\\ と言った\r\nんです", Expected: "

太郎は\\ 「こんにちわ」\\ と言ったんです

", }, t, ) no = 8 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Soft line breaks between east asian wide characters or punctuations are ignored", Markdown: "太郎は\\ **「こんにちわ」**\\ と、\r\n言った\r\nんです", Expected: "

太郎は\\ 「こんにちわ」\\ と、言ったんです

", }, t, ) no = 9 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Soft line breaks between an east asian wide character and a western character are ignored", Markdown: "私はプログラマーです。\n東京の会社に勤めています。\nGoでWebアプリケーションを開発しています。", Expected: "

私はプログラマーです。東京の会社に勤めています。\nGoでWebアプリケーションを開発しています。

", }, t, ) // Tests with EastAsianLineBreaksCSS3Draft markdown = goldmark.New(goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( NewCJK(WithEastAsianLineBreaks(EastAsianLineBreaksCSS3Draft)), ), ) no = 10 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Soft line breaks between a western character and an east asian wide character are ignored", Markdown: "太郎は\\ **「こんにちわ」**\\ と言ったa\nんです", Expected: "

太郎は\\ 「こんにちわ」\\ と言ったaんです

", }, t, ) no = 11 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Soft line breaks between an east asian wide character and a western character are ignored", Markdown: "太郎は\\ **「こんにちわ」**\\ と言った\nbんです", Expected: "

太郎は\\ 「こんにちわ」\\ と言ったbんです

", }, t, ) no = 12 testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: no, Description: "Soft line breaks between an east asian wide character and a western character are ignored", Markdown: "私はプログラマーです。\n東京の会社に勤めています。\nGoでWebアプリケーションを開発しています。", Expected: "

私はプログラマーです。東京の会社に勤めています。GoでWebアプリケーションを開発しています。

", }, t, ) } goldmark-1.7.4/extension/definition_list.go000066400000000000000000000177341463655211100210710ustar00rootroot00000000000000package extension import ( "github.com/yuin/goldmark" gast "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/extension/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) type definitionListParser struct { } var defaultDefinitionListParser = &definitionListParser{} // NewDefinitionListParser return a new parser.BlockParser that // can parse PHP Markdown Extra Definition lists. func NewDefinitionListParser() parser.BlockParser { return defaultDefinitionListParser } func (b *definitionListParser) Trigger() []byte { return []byte{':'} } func (b *definitionListParser) Open(parent gast.Node, reader text.Reader, pc parser.Context) (gast.Node, parser.State) { if _, ok := parent.(*ast.DefinitionList); ok { return nil, parser.NoChildren } line, _ := reader.PeekLine() pos := pc.BlockOffset() indent := pc.BlockIndent() if pos < 0 || line[pos] != ':' || indent != 0 { return nil, parser.NoChildren } last := parent.LastChild() // need 1 or more spaces after ':' w, _ := util.IndentWidth(line[pos+1:], pos+1) if w < 1 { return nil, parser.NoChildren } if w >= 8 { // starts with indented code w = 5 } w += pos + 1 /* 1 = ':' */ para, lastIsParagraph := last.(*gast.Paragraph) var list *ast.DefinitionList status := parser.HasChildren var ok bool if lastIsParagraph { list, ok = last.PreviousSibling().(*ast.DefinitionList) if ok { // is not first item list.Offset = w list.TemporaryParagraph = para } else { // is first item list = ast.NewDefinitionList(w, para) status |= parser.RequireParagraph } } else if list, ok = last.(*ast.DefinitionList); ok { // multiple description list.Offset = w list.TemporaryParagraph = nil } else { return nil, parser.NoChildren } return list, status } func (b *definitionListParser) Continue(node gast.Node, reader text.Reader, pc parser.Context) parser.State { line, _ := reader.PeekLine() if util.IsBlank(line) { return parser.Continue | parser.HasChildren } list, _ := node.(*ast.DefinitionList) w, _ := util.IndentWidth(line, reader.LineOffset()) if w < list.Offset { return parser.Close } pos, padding := util.IndentPosition(line, reader.LineOffset(), list.Offset) reader.AdvanceAndSetPadding(pos, padding) return parser.Continue | parser.HasChildren } func (b *definitionListParser) Close(node gast.Node, reader text.Reader, pc parser.Context) { // nothing to do } func (b *definitionListParser) CanInterruptParagraph() bool { return true } func (b *definitionListParser) CanAcceptIndentedLine() bool { return false } type definitionDescriptionParser struct { } var defaultDefinitionDescriptionParser = &definitionDescriptionParser{} // NewDefinitionDescriptionParser return a new parser.BlockParser that // can parse definition description starts with ':'. func NewDefinitionDescriptionParser() parser.BlockParser { return defaultDefinitionDescriptionParser } func (b *definitionDescriptionParser) Trigger() []byte { return []byte{':'} } func (b *definitionDescriptionParser) Open( parent gast.Node, reader text.Reader, pc parser.Context) (gast.Node, parser.State) { line, _ := reader.PeekLine() pos := pc.BlockOffset() indent := pc.BlockIndent() if pos < 0 || line[pos] != ':' || indent != 0 { return nil, parser.NoChildren } list, _ := parent.(*ast.DefinitionList) if list == nil { return nil, parser.NoChildren } para := list.TemporaryParagraph list.TemporaryParagraph = nil if para != nil { lines := para.Lines() l := lines.Len() for i := 0; i < l; i++ { term := ast.NewDefinitionTerm() segment := lines.At(i) term.Lines().Append(segment.TrimRightSpace(reader.Source())) list.AppendChild(list, term) } para.Parent().RemoveChild(para.Parent(), para) } cpos, padding := util.IndentPosition(line[pos+1:], pos+1, list.Offset-pos-1) reader.AdvanceAndSetPadding(cpos+1, padding) return ast.NewDefinitionDescription(), parser.HasChildren } func (b *definitionDescriptionParser) Continue(node gast.Node, reader text.Reader, pc parser.Context) parser.State { // definitionListParser detects end of the description. // so this method will never be called. return parser.Continue | parser.HasChildren } func (b *definitionDescriptionParser) Close(node gast.Node, reader text.Reader, pc parser.Context) { desc := node.(*ast.DefinitionDescription) desc.IsTight = !desc.HasBlankPreviousLines() if desc.IsTight { for gc := desc.FirstChild(); gc != nil; gc = gc.NextSibling() { paragraph, ok := gc.(*gast.Paragraph) if ok { textBlock := gast.NewTextBlock() textBlock.SetLines(paragraph.Lines()) desc.ReplaceChild(desc, paragraph, textBlock) } } } } func (b *definitionDescriptionParser) CanInterruptParagraph() bool { return true } func (b *definitionDescriptionParser) CanAcceptIndentedLine() bool { return false } // DefinitionListHTMLRenderer is a renderer.NodeRenderer implementation that // renders DefinitionList nodes. type DefinitionListHTMLRenderer struct { html.Config } // NewDefinitionListHTMLRenderer returns a new DefinitionListHTMLRenderer. func NewDefinitionListHTMLRenderer(opts ...html.Option) renderer.NodeRenderer { r := &DefinitionListHTMLRenderer{ Config: html.NewConfig(), } for _, opt := range opts { opt.SetHTMLOption(&r.Config) } return r } // RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs. func (r *DefinitionListHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { reg.Register(ast.KindDefinitionList, r.renderDefinitionList) reg.Register(ast.KindDefinitionTerm, r.renderDefinitionTerm) reg.Register(ast.KindDefinitionDescription, r.renderDefinitionDescription) } // DefinitionListAttributeFilter defines attribute names which dl elements can have. var DefinitionListAttributeFilter = html.GlobalAttributeFilter func (r *DefinitionListHTMLRenderer) renderDefinitionList( w util.BufWriter, source []byte, n gast.Node, entering bool) (gast.WalkStatus, error) { if entering { if n.Attributes() != nil { _, _ = w.WriteString("\n") } else { _, _ = w.WriteString("
\n") } } else { _, _ = w.WriteString("
\n") } return gast.WalkContinue, nil } // DefinitionTermAttributeFilter defines attribute names which dd elements can have. var DefinitionTermAttributeFilter = html.GlobalAttributeFilter func (r *DefinitionListHTMLRenderer) renderDefinitionTerm( w util.BufWriter, source []byte, n gast.Node, entering bool) (gast.WalkStatus, error) { if entering { if n.Attributes() != nil { _, _ = w.WriteString("') } else { _, _ = w.WriteString("
") } } else { _, _ = w.WriteString("
\n") } return gast.WalkContinue, nil } // DefinitionDescriptionAttributeFilter defines attribute names which dd elements can have. var DefinitionDescriptionAttributeFilter = html.GlobalAttributeFilter func (r *DefinitionListHTMLRenderer) renderDefinitionDescription( w util.BufWriter, source []byte, node gast.Node, entering bool) (gast.WalkStatus, error) { if entering { n := node.(*ast.DefinitionDescription) _, _ = w.WriteString("") } else { _, _ = w.WriteString(">\n") } } else { _, _ = w.WriteString("\n") } return gast.WalkContinue, nil } type definitionList struct { } // DefinitionList is an extension that allow you to use PHP Markdown Extra Definition lists. var DefinitionList = &definitionList{} func (e *definitionList) Extend(m goldmark.Markdown) { m.Parser().AddOptions(parser.WithBlockParsers( util.Prioritized(NewDefinitionListParser(), 101), util.Prioritized(NewDefinitionDescriptionParser(), 102), )) m.Renderer().AddOptions(renderer.WithNodeRenderers( util.Prioritized(NewDefinitionListHTMLRenderer(), 500), )) } goldmark-1.7.4/extension/definition_list_test.go000066400000000000000000000006561463655211100221230ustar00rootroot00000000000000package extension import ( "testing" "github.com/yuin/goldmark" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" ) func TestDefinitionList(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( DefinitionList, ), ) testutil.DoTestCaseFile(markdown, "_test/definition_list.txt", t, testutil.ParseCliCaseArg()...) } goldmark-1.7.4/extension/footnote.go000066400000000000000000000457121463655211100175400ustar00rootroot00000000000000package extension import ( "bytes" "fmt" "strconv" "github.com/yuin/goldmark" gast "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/extension/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) var footnoteListKey = parser.NewContextKey() var footnoteLinkListKey = parser.NewContextKey() type footnoteBlockParser struct { } var defaultFootnoteBlockParser = &footnoteBlockParser{} // NewFootnoteBlockParser returns a new parser.BlockParser that can parse // footnotes of the Markdown(PHP Markdown Extra) text. func NewFootnoteBlockParser() parser.BlockParser { return defaultFootnoteBlockParser } func (b *footnoteBlockParser) Trigger() []byte { return []byte{'['} } func (b *footnoteBlockParser) Open(parent gast.Node, reader text.Reader, pc parser.Context) (gast.Node, parser.State) { line, segment := reader.PeekLine() pos := pc.BlockOffset() if pos < 0 || line[pos] != '[' { return nil, parser.NoChildren } pos++ if pos > len(line)-1 || line[pos] != '^' { return nil, parser.NoChildren } open := pos + 1 var closes int closure := util.FindClosure(line[pos+1:], '[', ']', false, false) //nolint:staticcheck closes = pos + 1 + closure next := closes + 1 if closure > -1 { if next >= len(line) || line[next] != ':' { return nil, parser.NoChildren } } else { return nil, parser.NoChildren } padding := segment.Padding label := reader.Value(text.NewSegment(segment.Start+open-padding, segment.Start+closes-padding)) if util.IsBlank(label) { return nil, parser.NoChildren } item := ast.NewFootnote(label) pos = next + 1 - padding if pos >= len(line) { reader.Advance(pos) return item, parser.NoChildren } reader.AdvanceAndSetPadding(pos, padding) return item, parser.HasChildren } func (b *footnoteBlockParser) Continue(node gast.Node, reader text.Reader, pc parser.Context) parser.State { line, _ := reader.PeekLine() if util.IsBlank(line) { return parser.Continue | parser.HasChildren } childpos, padding := util.IndentPosition(line, reader.LineOffset(), 4) if childpos < 0 { return parser.Close } reader.AdvanceAndSetPadding(childpos, padding) return parser.Continue | parser.HasChildren } func (b *footnoteBlockParser) Close(node gast.Node, reader text.Reader, pc parser.Context) { var list *ast.FootnoteList if tlist := pc.Get(footnoteListKey); tlist != nil { list = tlist.(*ast.FootnoteList) } else { list = ast.NewFootnoteList() pc.Set(footnoteListKey, list) node.Parent().InsertBefore(node.Parent(), node, list) } node.Parent().RemoveChild(node.Parent(), node) list.AppendChild(list, node) } func (b *footnoteBlockParser) CanInterruptParagraph() bool { return true } func (b *footnoteBlockParser) CanAcceptIndentedLine() bool { return false } type footnoteParser struct { } var defaultFootnoteParser = &footnoteParser{} // NewFootnoteParser returns a new parser.InlineParser that can parse // footnote links of the Markdown(PHP Markdown Extra) text. func NewFootnoteParser() parser.InlineParser { return defaultFootnoteParser } func (s *footnoteParser) Trigger() []byte { // footnote syntax probably conflict with the image syntax. // So we need trigger this parser with '!'. return []byte{'!', '['} } func (s *footnoteParser) Parse(parent gast.Node, block text.Reader, pc parser.Context) gast.Node { line, segment := block.PeekLine() pos := 1 if len(line) > 0 && line[0] == '!' { pos++ } if pos >= len(line) || line[pos] != '^' { return nil } pos++ if pos >= len(line) { return nil } open := pos closure := util.FindClosure(line[pos:], '[', ']', false, false) //nolint:staticcheck if closure < 0 { return nil } closes := pos + closure value := block.Value(text.NewSegment(segment.Start+open, segment.Start+closes)) block.Advance(closes + 1) var list *ast.FootnoteList if tlist := pc.Get(footnoteListKey); tlist != nil { list = tlist.(*ast.FootnoteList) } if list == nil { return nil } index := 0 for def := list.FirstChild(); def != nil; def = def.NextSibling() { d := def.(*ast.Footnote) if bytes.Equal(d.Ref, value) { if d.Index < 0 { list.Count++ d.Index = list.Count } index = d.Index break } } if index == 0 { return nil } fnlink := ast.NewFootnoteLink(index) var fnlist []*ast.FootnoteLink if tmp := pc.Get(footnoteLinkListKey); tmp != nil { fnlist = tmp.([]*ast.FootnoteLink) } else { fnlist = []*ast.FootnoteLink{} pc.Set(footnoteLinkListKey, fnlist) } pc.Set(footnoteLinkListKey, append(fnlist, fnlink)) if line[0] == '!' { parent.AppendChild(parent, gast.NewTextSegment(text.NewSegment(segment.Start, segment.Start+1))) } return fnlink } type footnoteASTTransformer struct { } var defaultFootnoteASTTransformer = &footnoteASTTransformer{} // NewFootnoteASTTransformer returns a new parser.ASTTransformer that // insert a footnote list to the last of the document. func NewFootnoteASTTransformer() parser.ASTTransformer { return defaultFootnoteASTTransformer } func (a *footnoteASTTransformer) Transform(node *gast.Document, reader text.Reader, pc parser.Context) { var list *ast.FootnoteList var fnlist []*ast.FootnoteLink if tmp := pc.Get(footnoteListKey); tmp != nil { list = tmp.(*ast.FootnoteList) } if tmp := pc.Get(footnoteLinkListKey); tmp != nil { fnlist = tmp.([]*ast.FootnoteLink) } pc.Set(footnoteListKey, nil) pc.Set(footnoteLinkListKey, nil) if list == nil { return } counter := map[int]int{} if fnlist != nil { for _, fnlink := range fnlist { if fnlink.Index >= 0 { counter[fnlink.Index]++ } } refCounter := map[int]int{} for _, fnlink := range fnlist { fnlink.RefCount = counter[fnlink.Index] if _, ok := refCounter[fnlink.Index]; !ok { refCounter[fnlink.Index] = 0 } fnlink.RefIndex = refCounter[fnlink.Index] refCounter[fnlink.Index]++ } } for footnote := list.FirstChild(); footnote != nil; { var container gast.Node = footnote next := footnote.NextSibling() if fc := container.LastChild(); fc != nil && gast.IsParagraph(fc) { container = fc } fn := footnote.(*ast.Footnote) index := fn.Index if index < 0 { list.RemoveChild(list, footnote) } else { refCount := counter[index] backLink := ast.NewFootnoteBacklink(index) backLink.RefCount = refCount backLink.RefIndex = 0 container.AppendChild(container, backLink) if refCount > 1 { for i := 1; i < refCount; i++ { backLink := ast.NewFootnoteBacklink(index) backLink.RefCount = refCount backLink.RefIndex = i container.AppendChild(container, backLink) } } } footnote = next } list.SortChildren(func(n1, n2 gast.Node) int { if n1.(*ast.Footnote).Index < n2.(*ast.Footnote).Index { return -1 } return 1 }) if list.Count <= 0 { list.Parent().RemoveChild(list.Parent(), list) return } node.AppendChild(node, list) } // FootnoteConfig holds configuration values for the footnote extension. // // Link* and Backlink* configurations have some variables: // Occurrences of “^^” in the string will be replaced by the // corresponding footnote number in the HTML output. // Occurrences of “%%” will be replaced by a number for the // reference (footnotes can have multiple references). type FootnoteConfig struct { html.Config // IDPrefix is a prefix for the id attributes generated by footnotes. IDPrefix []byte // IDPrefix is a function that determines the id attribute for given Node. IDPrefixFunction func(gast.Node) []byte // LinkTitle is an optional title attribute for footnote links. LinkTitle []byte // BacklinkTitle is an optional title attribute for footnote backlinks. BacklinkTitle []byte // LinkClass is a class for footnote links. LinkClass []byte // BacklinkClass is a class for footnote backlinks. BacklinkClass []byte // BacklinkHTML is an HTML content for footnote backlinks. BacklinkHTML []byte } // FootnoteOption interface is a functional option interface for the extension. type FootnoteOption interface { renderer.Option // SetFootnoteOption sets given option to the extension. SetFootnoteOption(*FootnoteConfig) } // NewFootnoteConfig returns a new Config with defaults. func NewFootnoteConfig() FootnoteConfig { return FootnoteConfig{ Config: html.NewConfig(), LinkTitle: []byte(""), BacklinkTitle: []byte(""), LinkClass: []byte("footnote-ref"), BacklinkClass: []byte("footnote-backref"), BacklinkHTML: []byte("↩︎"), } } // SetOption implements renderer.SetOptioner. func (c *FootnoteConfig) SetOption(name renderer.OptionName, value interface{}) { switch name { case optFootnoteIDPrefixFunction: c.IDPrefixFunction = value.(func(gast.Node) []byte) case optFootnoteIDPrefix: c.IDPrefix = value.([]byte) case optFootnoteLinkTitle: c.LinkTitle = value.([]byte) case optFootnoteBacklinkTitle: c.BacklinkTitle = value.([]byte) case optFootnoteLinkClass: c.LinkClass = value.([]byte) case optFootnoteBacklinkClass: c.BacklinkClass = value.([]byte) case optFootnoteBacklinkHTML: c.BacklinkHTML = value.([]byte) default: c.Config.SetOption(name, value) } } type withFootnoteHTMLOptions struct { value []html.Option } func (o *withFootnoteHTMLOptions) SetConfig(c *renderer.Config) { if o.value != nil { for _, v := range o.value { v.(renderer.Option).SetConfig(c) } } } func (o *withFootnoteHTMLOptions) SetFootnoteOption(c *FootnoteConfig) { if o.value != nil { for _, v := range o.value { v.SetHTMLOption(&c.Config) } } } // WithFootnoteHTMLOptions is functional option that wraps goldmark HTMLRenderer options. func WithFootnoteHTMLOptions(opts ...html.Option) FootnoteOption { return &withFootnoteHTMLOptions{opts} } const optFootnoteIDPrefix renderer.OptionName = "FootnoteIDPrefix" type withFootnoteIDPrefix struct { value []byte } func (o *withFootnoteIDPrefix) SetConfig(c *renderer.Config) { c.Options[optFootnoteIDPrefix] = o.value } func (o *withFootnoteIDPrefix) SetFootnoteOption(c *FootnoteConfig) { c.IDPrefix = o.value } // WithFootnoteIDPrefix is a functional option that is a prefix for the id attributes generated by footnotes. func WithFootnoteIDPrefix[T []byte | string](a T) FootnoteOption { return &withFootnoteIDPrefix{[]byte(a)} } const optFootnoteIDPrefixFunction renderer.OptionName = "FootnoteIDPrefixFunction" type withFootnoteIDPrefixFunction struct { value func(gast.Node) []byte } func (o *withFootnoteIDPrefixFunction) SetConfig(c *renderer.Config) { c.Options[optFootnoteIDPrefixFunction] = o.value } func (o *withFootnoteIDPrefixFunction) SetFootnoteOption(c *FootnoteConfig) { c.IDPrefixFunction = o.value } // WithFootnoteIDPrefixFunction is a functional option that is a prefix for the id attributes generated by footnotes. func WithFootnoteIDPrefixFunction(a func(gast.Node) []byte) FootnoteOption { return &withFootnoteIDPrefixFunction{a} } const optFootnoteLinkTitle renderer.OptionName = "FootnoteLinkTitle" type withFootnoteLinkTitle struct { value []byte } func (o *withFootnoteLinkTitle) SetConfig(c *renderer.Config) { c.Options[optFootnoteLinkTitle] = o.value } func (o *withFootnoteLinkTitle) SetFootnoteOption(c *FootnoteConfig) { c.LinkTitle = o.value } // WithFootnoteLinkTitle is a functional option that is an optional title attribute for footnote links. func WithFootnoteLinkTitle[T []byte | string](a T) FootnoteOption { return &withFootnoteLinkTitle{[]byte(a)} } const optFootnoteBacklinkTitle renderer.OptionName = "FootnoteBacklinkTitle" type withFootnoteBacklinkTitle struct { value []byte } func (o *withFootnoteBacklinkTitle) SetConfig(c *renderer.Config) { c.Options[optFootnoteBacklinkTitle] = o.value } func (o *withFootnoteBacklinkTitle) SetFootnoteOption(c *FootnoteConfig) { c.BacklinkTitle = o.value } // WithFootnoteBacklinkTitle is a functional option that is an optional title attribute for footnote backlinks. func WithFootnoteBacklinkTitle[T []byte | string](a T) FootnoteOption { return &withFootnoteBacklinkTitle{[]byte(a)} } const optFootnoteLinkClass renderer.OptionName = "FootnoteLinkClass" type withFootnoteLinkClass struct { value []byte } func (o *withFootnoteLinkClass) SetConfig(c *renderer.Config) { c.Options[optFootnoteLinkClass] = o.value } func (o *withFootnoteLinkClass) SetFootnoteOption(c *FootnoteConfig) { c.LinkClass = o.value } // WithFootnoteLinkClass is a functional option that is a class for footnote links. func WithFootnoteLinkClass[T []byte | string](a T) FootnoteOption { return &withFootnoteLinkClass{[]byte(a)} } const optFootnoteBacklinkClass renderer.OptionName = "FootnoteBacklinkClass" type withFootnoteBacklinkClass struct { value []byte } func (o *withFootnoteBacklinkClass) SetConfig(c *renderer.Config) { c.Options[optFootnoteBacklinkClass] = o.value } func (o *withFootnoteBacklinkClass) SetFootnoteOption(c *FootnoteConfig) { c.BacklinkClass = o.value } // WithFootnoteBacklinkClass is a functional option that is a class for footnote backlinks. func WithFootnoteBacklinkClass[T []byte | string](a T) FootnoteOption { return &withFootnoteBacklinkClass{[]byte(a)} } const optFootnoteBacklinkHTML renderer.OptionName = "FootnoteBacklinkHTML" type withFootnoteBacklinkHTML struct { value []byte } func (o *withFootnoteBacklinkHTML) SetConfig(c *renderer.Config) { c.Options[optFootnoteBacklinkHTML] = o.value } func (o *withFootnoteBacklinkHTML) SetFootnoteOption(c *FootnoteConfig) { c.BacklinkHTML = o.value } // WithFootnoteBacklinkHTML is an HTML content for footnote backlinks. func WithFootnoteBacklinkHTML[T []byte | string](a T) FootnoteOption { return &withFootnoteBacklinkHTML{[]byte(a)} } // FootnoteHTMLRenderer is a renderer.NodeRenderer implementation that // renders FootnoteLink nodes. type FootnoteHTMLRenderer struct { FootnoteConfig } // NewFootnoteHTMLRenderer returns a new FootnoteHTMLRenderer. func NewFootnoteHTMLRenderer(opts ...FootnoteOption) renderer.NodeRenderer { r := &FootnoteHTMLRenderer{ FootnoteConfig: NewFootnoteConfig(), } for _, opt := range opts { opt.SetFootnoteOption(&r.FootnoteConfig) } return r } // RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs. func (r *FootnoteHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { reg.Register(ast.KindFootnoteLink, r.renderFootnoteLink) reg.Register(ast.KindFootnoteBacklink, r.renderFootnoteBacklink) reg.Register(ast.KindFootnote, r.renderFootnote) reg.Register(ast.KindFootnoteList, r.renderFootnoteList) } func (r *FootnoteHTMLRenderer) renderFootnoteLink( w util.BufWriter, source []byte, node gast.Node, entering bool) (gast.WalkStatus, error) { if entering { n := node.(*ast.FootnoteLink) is := strconv.Itoa(n.Index) _, _ = w.WriteString(``) _, _ = w.WriteString(is) _, _ = w.WriteString(``) } return gast.WalkContinue, nil } func (r *FootnoteHTMLRenderer) renderFootnoteBacklink( w util.BufWriter, source []byte, node gast.Node, entering bool) (gast.WalkStatus, error) { if entering { n := node.(*ast.FootnoteBacklink) is := strconv.Itoa(n.Index) _, _ = w.WriteString(` `) _, _ = w.Write(applyFootnoteTemplate(r.FootnoteConfig.BacklinkHTML, n.Index, n.RefCount)) _, _ = w.WriteString(``) } return gast.WalkContinue, nil } func (r *FootnoteHTMLRenderer) renderFootnote( w util.BufWriter, source []byte, node gast.Node, entering bool) (gast.WalkStatus, error) { n := node.(*ast.Footnote) is := strconv.Itoa(n.Index) if entering { _, _ = w.WriteString(`
  • \n") } else { _, _ = w.WriteString("
  • \n") } return gast.WalkContinue, nil } func (r *FootnoteHTMLRenderer) renderFootnoteList( w util.BufWriter, source []byte, node gast.Node, entering bool) (gast.WalkStatus, error) { if entering { _, _ = w.WriteString(`
    ') if r.Config.XHTML { _, _ = w.WriteString("\n
    \n") } else { _, _ = w.WriteString("\n
    \n") } _, _ = w.WriteString("
      \n") } else { _, _ = w.WriteString("
    \n") _, _ = w.WriteString("
    \n") } return gast.WalkContinue, nil } func (r *FootnoteHTMLRenderer) idPrefix(node gast.Node) []byte { if r.FootnoteConfig.IDPrefix != nil { return r.FootnoteConfig.IDPrefix } if r.FootnoteConfig.IDPrefixFunction != nil { return r.FootnoteConfig.IDPrefixFunction(node) } return []byte("") } func applyFootnoteTemplate(b []byte, index, refCount int) []byte { fast := true for i, c := range b { if i != 0 { if b[i-1] == '^' && c == '^' { fast = false break } if b[i-1] == '%' && c == '%' { fast = false break } } } if fast { return b } is := []byte(strconv.Itoa(index)) rs := []byte(strconv.Itoa(refCount)) ret := bytes.Replace(b, []byte("^^"), is, -1) return bytes.Replace(ret, []byte("%%"), rs, -1) } type footnote struct { options []FootnoteOption } // Footnote is an extension that allow you to use PHP Markdown Extra Footnotes. var Footnote = &footnote{ options: []FootnoteOption{}, } // NewFootnote returns a new extension with given options. func NewFootnote(opts ...FootnoteOption) goldmark.Extender { return &footnote{ options: opts, } } func (e *footnote) Extend(m goldmark.Markdown) { m.Parser().AddOptions( parser.WithBlockParsers( util.Prioritized(NewFootnoteBlockParser(), 999), ), parser.WithInlineParsers( util.Prioritized(NewFootnoteParser(), 101), ), parser.WithASTTransformers( util.Prioritized(NewFootnoteASTTransformer(), 999), ), ) m.Renderer().AddOptions(renderer.WithNodeRenderers( util.Prioritized(NewFootnoteHTMLRenderer(e.options...), 500), )) } goldmark-1.7.4/extension/footnote_test.go000066400000000000000000000105441463655211100205720ustar00rootroot00000000000000package extension import ( "testing" "github.com/yuin/goldmark" gast "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) func TestFootnote(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( Footnote, ), ) testutil.DoTestCaseFile(markdown, "_test/footnote.txt", t, testutil.ParseCliCaseArg()...) } type footnoteID struct { } func (a *footnoteID) Transform(node *gast.Document, reader text.Reader, pc parser.Context) { node.Meta()["footnote-prefix"] = "article12-" } func TestFootnoteOptions(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( NewFootnote( WithFootnoteIDPrefix("article12-"), WithFootnoteLinkClass("link-class"), WithFootnoteBacklinkClass("backlink-class"), WithFootnoteLinkTitle("link-title-%%-^^"), WithFootnoteBacklinkTitle("backlink-title"), WithFootnoteBacklinkHTML("^"), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 1, Description: "Footnote with options", Markdown: `That's some text with a footnote.[^1] Same footnote.[^1] Another one.[^2] [^1]: And that's the footnote. [^2]: Another footnote. `, Expected: `

    That's some text with a footnote.1

    Same footnote.1

    Another one.2


    1. And that's the footnote. ^ ^

    2. Another footnote. ^

    `, }, t, ) markdown = goldmark.New( goldmark.WithParserOptions( parser.WithASTTransformers( util.Prioritized(&footnoteID{}, 100), ), ), goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( NewFootnote( WithFootnoteIDPrefixFunction(func(n gast.Node) []byte { v, ok := n.OwnerDocument().Meta()["footnote-prefix"] if ok { return util.StringToReadOnlyBytes(v.(string)) } return nil }), WithFootnoteLinkClass([]byte("link-class")), WithFootnoteBacklinkClass([]byte("backlink-class")), WithFootnoteLinkTitle([]byte("link-title-%%-^^")), WithFootnoteBacklinkTitle([]byte("backlink-title")), WithFootnoteBacklinkHTML([]byte("^")), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 2, Description: "Footnote with an id prefix function", Markdown: `That's some text with a footnote.[^1] Same footnote.[^1] Another one.[^2] [^1]: And that's the footnote. [^2]: Another footnote. `, Expected: `

    That's some text with a footnote.1

    Same footnote.1

    Another one.2


    1. And that's the footnote. ^ ^

    2. Another footnote. ^

    `, }, t, ) } goldmark-1.7.4/extension/gfm.go000066400000000000000000000004601463655211100164430ustar00rootroot00000000000000package extension import ( "github.com/yuin/goldmark" ) type gfm struct { } // GFM is an extension that provides Github Flavored markdown functionalities. var GFM = &gfm{} func (e *gfm) Extend(m goldmark.Markdown) { Linkify.Extend(m) Table.Extend(m) Strikethrough.Extend(m) TaskList.Extend(m) } goldmark-1.7.4/extension/linkify.go000066400000000000000000000173541463655211100173510ustar00rootroot00000000000000package extension import ( "bytes" "regexp" "github.com/yuin/goldmark" "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) var wwwURLRegxp = regexp.MustCompile(`^www\.[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]+(?:[/#?][-a-zA-Z0-9@:%_\+.~#!?&/=\(\);,'">\^{}\[\]` + "`" + `]*)?`) //nolint:golint,lll var urlRegexp = regexp.MustCompile(`^(?:http|https|ftp)://[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]+(?::\d+)?(?:[/#?][-a-zA-Z0-9@:%_+.~#$!?&/=\(\);,'">\^{}\[\]` + "`" + `]*)?`) //nolint:golint,lll // An LinkifyConfig struct is a data structure that holds configuration of the // Linkify extension. type LinkifyConfig struct { AllowedProtocols [][]byte URLRegexp *regexp.Regexp WWWRegexp *regexp.Regexp EmailRegexp *regexp.Regexp } const ( optLinkifyAllowedProtocols parser.OptionName = "LinkifyAllowedProtocols" optLinkifyURLRegexp parser.OptionName = "LinkifyURLRegexp" optLinkifyWWWRegexp parser.OptionName = "LinkifyWWWRegexp" optLinkifyEmailRegexp parser.OptionName = "LinkifyEmailRegexp" ) // SetOption implements SetOptioner. func (c *LinkifyConfig) SetOption(name parser.OptionName, value interface{}) { switch name { case optLinkifyAllowedProtocols: c.AllowedProtocols = value.([][]byte) case optLinkifyURLRegexp: c.URLRegexp = value.(*regexp.Regexp) case optLinkifyWWWRegexp: c.WWWRegexp = value.(*regexp.Regexp) case optLinkifyEmailRegexp: c.EmailRegexp = value.(*regexp.Regexp) } } // A LinkifyOption interface sets options for the LinkifyOption. type LinkifyOption interface { parser.Option SetLinkifyOption(*LinkifyConfig) } type withLinkifyAllowedProtocols struct { value [][]byte } func (o *withLinkifyAllowedProtocols) SetParserOption(c *parser.Config) { c.Options[optLinkifyAllowedProtocols] = o.value } func (o *withLinkifyAllowedProtocols) SetLinkifyOption(p *LinkifyConfig) { p.AllowedProtocols = o.value } // WithLinkifyAllowedProtocols is a functional option that specify allowed // protocols in autolinks. Each protocol must end with ':' like // 'http:' . func WithLinkifyAllowedProtocols[T []byte | string](value []T) LinkifyOption { opt := &withLinkifyAllowedProtocols{} for _, v := range value { opt.value = append(opt.value, []byte(v)) } return opt } type withLinkifyURLRegexp struct { value *regexp.Regexp } func (o *withLinkifyURLRegexp) SetParserOption(c *parser.Config) { c.Options[optLinkifyURLRegexp] = o.value } func (o *withLinkifyURLRegexp) SetLinkifyOption(p *LinkifyConfig) { p.URLRegexp = o.value } // WithLinkifyURLRegexp is a functional option that specify // a pattern of the URL including a protocol. func WithLinkifyURLRegexp(value *regexp.Regexp) LinkifyOption { return &withLinkifyURLRegexp{ value: value, } } type withLinkifyWWWRegexp struct { value *regexp.Regexp } func (o *withLinkifyWWWRegexp) SetParserOption(c *parser.Config) { c.Options[optLinkifyWWWRegexp] = o.value } func (o *withLinkifyWWWRegexp) SetLinkifyOption(p *LinkifyConfig) { p.WWWRegexp = o.value } // WithLinkifyWWWRegexp is a functional option that specify // a pattern of the URL without a protocol. // This pattern must start with 'www.' . func WithLinkifyWWWRegexp(value *regexp.Regexp) LinkifyOption { return &withLinkifyWWWRegexp{ value: value, } } type withLinkifyEmailRegexp struct { value *regexp.Regexp } func (o *withLinkifyEmailRegexp) SetParserOption(c *parser.Config) { c.Options[optLinkifyEmailRegexp] = o.value } func (o *withLinkifyEmailRegexp) SetLinkifyOption(p *LinkifyConfig) { p.EmailRegexp = o.value } // WithLinkifyEmailRegexp is a functional otpion that specify // a pattern of the email address. func WithLinkifyEmailRegexp(value *regexp.Regexp) LinkifyOption { return &withLinkifyEmailRegexp{ value: value, } } type linkifyParser struct { LinkifyConfig } // NewLinkifyParser return a new InlineParser can parse // text that seems like a URL. func NewLinkifyParser(opts ...LinkifyOption) parser.InlineParser { p := &linkifyParser{ LinkifyConfig: LinkifyConfig{ AllowedProtocols: nil, URLRegexp: urlRegexp, WWWRegexp: wwwURLRegxp, }, } for _, o := range opts { o.SetLinkifyOption(&p.LinkifyConfig) } return p } func (s *linkifyParser) Trigger() []byte { // ' ' indicates any white spaces and a line head return []byte{' ', '*', '_', '~', '('} } var ( protoHTTP = []byte("http:") protoHTTPS = []byte("https:") protoFTP = []byte("ftp:") domainWWW = []byte("www.") ) func (s *linkifyParser) Parse(parent ast.Node, block text.Reader, pc parser.Context) ast.Node { if pc.IsInLinkLabel() { return nil } line, segment := block.PeekLine() consumes := 0 start := segment.Start c := line[0] // advance if current position is not a line head. if c == ' ' || c == '*' || c == '_' || c == '~' || c == '(' { consumes++ start++ line = line[1:] } var m []int var protocol []byte var typ ast.AutoLinkType = ast.AutoLinkURL if s.LinkifyConfig.AllowedProtocols == nil { if bytes.HasPrefix(line, protoHTTP) || bytes.HasPrefix(line, protoHTTPS) || bytes.HasPrefix(line, protoFTP) { m = s.LinkifyConfig.URLRegexp.FindSubmatchIndex(line) } } else { for _, prefix := range s.LinkifyConfig.AllowedProtocols { if bytes.HasPrefix(line, prefix) { m = s.LinkifyConfig.URLRegexp.FindSubmatchIndex(line) break } } } if m == nil && bytes.HasPrefix(line, domainWWW) { m = s.LinkifyConfig.WWWRegexp.FindSubmatchIndex(line) protocol = []byte("http") } if m != nil && m[0] != 0 { m = nil } if m != nil && m[0] == 0 { lastChar := line[m[1]-1] if lastChar == '.' { m[1]-- } else if lastChar == ')' { closing := 0 for i := m[1] - 1; i >= m[0]; i-- { if line[i] == ')' { closing++ } else if line[i] == '(' { closing-- } } if closing > 0 { m[1] -= closing } } else if lastChar == ';' { i := m[1] - 2 for ; i >= m[0]; i-- { if util.IsAlphaNumeric(line[i]) { continue } break } if i != m[1]-2 { if line[i] == '&' { m[1] -= m[1] - i } } } } if m == nil { if len(line) > 0 && util.IsPunct(line[0]) { return nil } typ = ast.AutoLinkEmail stop := -1 if s.LinkifyConfig.EmailRegexp == nil { stop = util.FindEmailIndex(line) } else { m := s.LinkifyConfig.EmailRegexp.FindSubmatchIndex(line) if m != nil && m[0] == 0 { stop = m[1] } } if stop < 0 { return nil } at := bytes.IndexByte(line, '@') m = []int{0, stop, at, stop - 1} if m == nil || bytes.IndexByte(line[m[2]:m[3]], '.') < 0 { return nil } lastChar := line[m[1]-1] if lastChar == '.' { m[1]-- } if m[1] < len(line) { nextChar := line[m[1]] if nextChar == '-' || nextChar == '_' { return nil } } } if m == nil { return nil } if consumes != 0 { s := segment.WithStop(segment.Start + 1) ast.MergeOrAppendTextSegment(parent, s) } i := m[1] - 1 for ; i > 0; i-- { c := line[i] switch c { case '?', '!', '.', ',', ':', '*', '_', '~': default: goto endfor } } endfor: i++ consumes += i block.Advance(consumes) n := ast.NewTextSegment(text.NewSegment(start, start+i)) link := ast.NewAutoLink(typ, n) link.Protocol = protocol return link } func (s *linkifyParser) CloseBlock(parent ast.Node, pc parser.Context) { // nothing to do } type linkify struct { options []LinkifyOption } // Linkify is an extension that allow you to parse text that seems like a URL. var Linkify = &linkify{} // NewLinkify creates a new [goldmark.Extender] that // allow you to parse text that seems like a URL. func NewLinkify(opts ...LinkifyOption) goldmark.Extender { return &linkify{ options: opts, } } func (e *linkify) Extend(m goldmark.Markdown) { m.Parser().AddOptions( parser.WithInlineParsers( util.Prioritized(NewLinkifyParser(e.options...), 999), ), ) } goldmark-1.7.4/extension/linkify_test.go000066400000000000000000000040441463655211100204000ustar00rootroot00000000000000package extension import ( "regexp" "testing" "github.com/yuin/goldmark" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" ) func TestLinkify(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( Linkify, ), ) testutil.DoTestCaseFile(markdown, "_test/linkify.txt", t, testutil.ParseCliCaseArg()...) } func TestLinkifyWithAllowedProtocols(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( NewLinkify( WithLinkifyAllowedProtocols([]string{ "ssh:", }), WithLinkifyURLRegexp( regexp.MustCompile(`\w+://[^\s]+`), ), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 1, Markdown: `hoge ssh://user@hoge.com. http://example.com/`, Expected: `

    hoge ssh://user@hoge.com. http://example.com/

    `, }, t, ) } func TestLinkifyWithWWWRegexp(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( NewLinkify( WithLinkifyWWWRegexp( regexp.MustCompile(`www\.example\.com`), ), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 1, Markdown: `www.google.com www.example.com`, Expected: `

    www.google.com www.example.com

    `, }, t, ) } func TestLinkifyWithEmailRegexp(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( NewLinkify( WithLinkifyEmailRegexp( regexp.MustCompile(`user@example\.com`), ), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 1, Markdown: `hoge@example.com user@example.com`, Expected: `

    hoge@example.com user@example.com

    `, }, t, ) } goldmark-1.7.4/extension/package.go000066400000000000000000000001161463655211100172630ustar00rootroot00000000000000// Package extension is a collection of builtin extensions. package extension goldmark-1.7.4/extension/strikethrough.go000066400000000000000000000065371463655211100206070ustar00rootroot00000000000000package extension import ( "github.com/yuin/goldmark" gast "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/extension/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) type strikethroughDelimiterProcessor struct { } func (p *strikethroughDelimiterProcessor) IsDelimiter(b byte) bool { return b == '~' } func (p *strikethroughDelimiterProcessor) CanOpenCloser(opener, closer *parser.Delimiter) bool { return opener.Char == closer.Char } func (p *strikethroughDelimiterProcessor) OnMatch(consumes int) gast.Node { return ast.NewStrikethrough() } var defaultStrikethroughDelimiterProcessor = &strikethroughDelimiterProcessor{} type strikethroughParser struct { } var defaultStrikethroughParser = &strikethroughParser{} // NewStrikethroughParser return a new InlineParser that parses // strikethrough expressions. func NewStrikethroughParser() parser.InlineParser { return defaultStrikethroughParser } func (s *strikethroughParser) Trigger() []byte { return []byte{'~'} } func (s *strikethroughParser) Parse(parent gast.Node, block text.Reader, pc parser.Context) gast.Node { before := block.PrecendingCharacter() line, segment := block.PeekLine() node := parser.ScanDelimiter(line, before, 1, defaultStrikethroughDelimiterProcessor) if node == nil || node.OriginalLength > 2 || before == '~' { return nil } node.Segment = segment.WithStop(segment.Start + node.OriginalLength) block.Advance(node.OriginalLength) pc.PushDelimiter(node) return node } func (s *strikethroughParser) CloseBlock(parent gast.Node, pc parser.Context) { // nothing to do } // StrikethroughHTMLRenderer is a renderer.NodeRenderer implementation that // renders Strikethrough nodes. type StrikethroughHTMLRenderer struct { html.Config } // NewStrikethroughHTMLRenderer returns a new StrikethroughHTMLRenderer. func NewStrikethroughHTMLRenderer(opts ...html.Option) renderer.NodeRenderer { r := &StrikethroughHTMLRenderer{ Config: html.NewConfig(), } for _, opt := range opts { opt.SetHTMLOption(&r.Config) } return r } // RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs. func (r *StrikethroughHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { reg.Register(ast.KindStrikethrough, r.renderStrikethrough) } // StrikethroughAttributeFilter defines attribute names which dd elements can have. var StrikethroughAttributeFilter = html.GlobalAttributeFilter func (r *StrikethroughHTMLRenderer) renderStrikethrough( w util.BufWriter, source []byte, n gast.Node, entering bool) (gast.WalkStatus, error) { if entering { if n.Attributes() != nil { _, _ = w.WriteString("') } else { _, _ = w.WriteString("") } } else { _, _ = w.WriteString("") } return gast.WalkContinue, nil } type strikethrough struct { } // Strikethrough is an extension that allow you to use strikethrough expression like '~~text~~' . var Strikethrough = &strikethrough{} func (e *strikethrough) Extend(m goldmark.Markdown) { m.Parser().AddOptions(parser.WithInlineParsers( util.Prioritized(NewStrikethroughParser(), 500), )) m.Renderer().AddOptions(renderer.WithNodeRenderers( util.Prioritized(NewStrikethroughHTMLRenderer(), 500), )) } goldmark-1.7.4/extension/strikethrough_test.go000066400000000000000000000006521463655211100216360ustar00rootroot00000000000000package extension import ( "testing" "github.com/yuin/goldmark" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" ) func TestStrikethrough(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( Strikethrough, ), ) testutil.DoTestCaseFile(markdown, "_test/strikethrough.txt", t, testutil.ParseCliCaseArg()...) } goldmark-1.7.4/extension/table.go000066400000000000000000000407631463655211100167730ustar00rootroot00000000000000package extension import ( "bytes" "fmt" "regexp" "github.com/yuin/goldmark" gast "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/extension/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) var escapedPipeCellListKey = parser.NewContextKey() type escapedPipeCell struct { Cell *ast.TableCell Pos []int Transformed bool } // TableCellAlignMethod indicates how are table cells aligned in HTML format. type TableCellAlignMethod int const ( // TableCellAlignDefault renders alignments by default method. // With XHTML, alignments are rendered as an align attribute. // With HTML5, alignments are rendered as a style attribute. TableCellAlignDefault TableCellAlignMethod = iota // TableCellAlignAttribute renders alignments as an align attribute. TableCellAlignAttribute // TableCellAlignStyle renders alignments as a style attribute. TableCellAlignStyle // TableCellAlignNone does not care about alignments. // If you using classes or other styles, you can add these attributes // in an ASTTransformer. TableCellAlignNone ) // TableConfig struct holds options for the extension. type TableConfig struct { html.Config // TableCellAlignMethod indicates how are table celss aligned. TableCellAlignMethod TableCellAlignMethod } // TableOption interface is a functional option interface for the extension. type TableOption interface { renderer.Option // SetTableOption sets given option to the extension. SetTableOption(*TableConfig) } // NewTableConfig returns a new Config with defaults. func NewTableConfig() TableConfig { return TableConfig{ Config: html.NewConfig(), TableCellAlignMethod: TableCellAlignDefault, } } // SetOption implements renderer.SetOptioner. func (c *TableConfig) SetOption(name renderer.OptionName, value interface{}) { switch name { case optTableCellAlignMethod: c.TableCellAlignMethod = value.(TableCellAlignMethod) default: c.Config.SetOption(name, value) } } type withTableHTMLOptions struct { value []html.Option } func (o *withTableHTMLOptions) SetConfig(c *renderer.Config) { if o.value != nil { for _, v := range o.value { v.(renderer.Option).SetConfig(c) } } } func (o *withTableHTMLOptions) SetTableOption(c *TableConfig) { if o.value != nil { for _, v := range o.value { v.SetHTMLOption(&c.Config) } } } // WithTableHTMLOptions is functional option that wraps goldmark HTMLRenderer options. func WithTableHTMLOptions(opts ...html.Option) TableOption { return &withTableHTMLOptions{opts} } const optTableCellAlignMethod renderer.OptionName = "TableTableCellAlignMethod" type withTableCellAlignMethod struct { value TableCellAlignMethod } func (o *withTableCellAlignMethod) SetConfig(c *renderer.Config) { c.Options[optTableCellAlignMethod] = o.value } func (o *withTableCellAlignMethod) SetTableOption(c *TableConfig) { c.TableCellAlignMethod = o.value } // WithTableCellAlignMethod is a functional option that indicates how are table cells aligned in HTML format. func WithTableCellAlignMethod(a TableCellAlignMethod) TableOption { return &withTableCellAlignMethod{a} } func isTableDelim(bs []byte) bool { if w, _ := util.IndentWidth(bs, 0); w > 3 { return false } for _, b := range bs { if !(util.IsSpace(b) || b == '-' || b == '|' || b == ':') { return false } } return true } var tableDelimLeft = regexp.MustCompile(`^\s*\:\-+\s*$`) var tableDelimRight = regexp.MustCompile(`^\s*\-+\:\s*$`) var tableDelimCenter = regexp.MustCompile(`^\s*\:\-+\:\s*$`) var tableDelimNone = regexp.MustCompile(`^\s*\-+\s*$`) type tableParagraphTransformer struct { } var defaultTableParagraphTransformer = &tableParagraphTransformer{} // NewTableParagraphTransformer returns a new ParagraphTransformer // that can transform paragraphs into tables. func NewTableParagraphTransformer() parser.ParagraphTransformer { return defaultTableParagraphTransformer } func (b *tableParagraphTransformer) Transform(node *gast.Paragraph, reader text.Reader, pc parser.Context) { lines := node.Lines() if lines.Len() < 2 { return } for i := 1; i < lines.Len(); i++ { alignments := b.parseDelimiter(lines.At(i), reader) if alignments == nil { continue } header := b.parseRow(lines.At(i-1), alignments, true, reader, pc) if header == nil || len(alignments) != header.ChildCount() { return } table := ast.NewTable() table.Alignments = alignments table.AppendChild(table, ast.NewTableHeader(header)) for j := i + 1; j < lines.Len(); j++ { table.AppendChild(table, b.parseRow(lines.At(j), alignments, false, reader, pc)) } node.Lines().SetSliced(0, i-1) node.Parent().InsertAfter(node.Parent(), node, table) if node.Lines().Len() == 0 { node.Parent().RemoveChild(node.Parent(), node) } else { last := node.Lines().At(i - 2) last.Stop = last.Stop - 1 // trim last newline(\n) node.Lines().Set(i-2, last) } } } func (b *tableParagraphTransformer) parseRow(segment text.Segment, alignments []ast.Alignment, isHeader bool, reader text.Reader, pc parser.Context) *ast.TableRow { source := reader.Source() line := segment.Value(source) pos := 0 pos += util.TrimLeftSpaceLength(line) limit := len(line) limit -= util.TrimRightSpaceLength(line) row := ast.NewTableRow(alignments) if len(line) > 0 && line[pos] == '|' { pos++ } if len(line) > 0 && line[limit-1] == '|' { limit-- } i := 0 for ; pos < limit; i++ { alignment := ast.AlignNone if i >= len(alignments) { if !isHeader { return row } } else { alignment = alignments[i] } var escapedCell *escapedPipeCell node := ast.NewTableCell() node.Alignment = alignment hasBacktick := false closure := pos for ; closure < limit; closure++ { if line[closure] == '`' { hasBacktick = true } if line[closure] == '|' { if closure == 0 || line[closure-1] != '\\' { break } else if hasBacktick { if escapedCell == nil { escapedCell = &escapedPipeCell{node, []int{}, false} escapedList := pc.ComputeIfAbsent(escapedPipeCellListKey, func() interface{} { return []*escapedPipeCell{} }).([]*escapedPipeCell) escapedList = append(escapedList, escapedCell) pc.Set(escapedPipeCellListKey, escapedList) } escapedCell.Pos = append(escapedCell.Pos, segment.Start+closure-1) } } } seg := text.NewSegment(segment.Start+pos, segment.Start+closure) seg = seg.TrimLeftSpace(source) seg = seg.TrimRightSpace(source) node.Lines().Append(seg) row.AppendChild(row, node) pos = closure + 1 } for ; i < len(alignments); i++ { row.AppendChild(row, ast.NewTableCell()) } return row } func (b *tableParagraphTransformer) parseDelimiter(segment text.Segment, reader text.Reader) []ast.Alignment { line := segment.Value(reader.Source()) if !isTableDelim(line) { return nil } cols := bytes.Split(line, []byte{'|'}) if util.IsBlank(cols[0]) { cols = cols[1:] } if len(cols) > 0 && util.IsBlank(cols[len(cols)-1]) { cols = cols[:len(cols)-1] } var alignments []ast.Alignment for _, col := range cols { if tableDelimLeft.Match(col) { alignments = append(alignments, ast.AlignLeft) } else if tableDelimRight.Match(col) { alignments = append(alignments, ast.AlignRight) } else if tableDelimCenter.Match(col) { alignments = append(alignments, ast.AlignCenter) } else if tableDelimNone.Match(col) { alignments = append(alignments, ast.AlignNone) } else { return nil } } return alignments } type tableASTTransformer struct { } var defaultTableASTTransformer = &tableASTTransformer{} // NewTableASTTransformer returns a parser.ASTTransformer for tables. func NewTableASTTransformer() parser.ASTTransformer { return defaultTableASTTransformer } func (a *tableASTTransformer) Transform(node *gast.Document, reader text.Reader, pc parser.Context) { lst := pc.Get(escapedPipeCellListKey) if lst == nil { return } pc.Set(escapedPipeCellListKey, nil) for _, v := range lst.([]*escapedPipeCell) { if v.Transformed { continue } _ = gast.Walk(v.Cell, func(n gast.Node, entering bool) (gast.WalkStatus, error) { if !entering || n.Kind() != gast.KindCodeSpan { return gast.WalkContinue, nil } for c := n.FirstChild(); c != nil; { next := c.NextSibling() if c.Kind() != gast.KindText { c = next continue } parent := c.Parent() ts := &c.(*gast.Text).Segment n := c for _, v := range lst.([]*escapedPipeCell) { for _, pos := range v.Pos { if ts.Start <= pos && pos < ts.Stop { segment := n.(*gast.Text).Segment n1 := gast.NewRawTextSegment(segment.WithStop(pos)) n2 := gast.NewRawTextSegment(segment.WithStart(pos + 1)) parent.InsertAfter(parent, n, n1) parent.InsertAfter(parent, n1, n2) parent.RemoveChild(parent, n) n = n2 v.Transformed = true } } } c = next } return gast.WalkContinue, nil }) } } // TableHTMLRenderer is a renderer.NodeRenderer implementation that // renders Table nodes. type TableHTMLRenderer struct { TableConfig } // NewTableHTMLRenderer returns a new TableHTMLRenderer. func NewTableHTMLRenderer(opts ...TableOption) renderer.NodeRenderer { r := &TableHTMLRenderer{ TableConfig: NewTableConfig(), } for _, opt := range opts { opt.SetTableOption(&r.TableConfig) } return r } // RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs. func (r *TableHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { reg.Register(ast.KindTable, r.renderTable) reg.Register(ast.KindTableHeader, r.renderTableHeader) reg.Register(ast.KindTableRow, r.renderTableRow) reg.Register(ast.KindTableCell, r.renderTableCell) } // TableAttributeFilter defines attribute names which table elements can have. var TableAttributeFilter = html.GlobalAttributeFilter.Extend( []byte("align"), // [Deprecated] []byte("bgcolor"), // [Deprecated] []byte("border"), // [Deprecated] []byte("cellpadding"), // [Deprecated] []byte("cellspacing"), // [Deprecated] []byte("frame"), // [Deprecated] []byte("rules"), // [Deprecated] []byte("summary"), // [Deprecated] []byte("width"), // [Deprecated] ) func (r *TableHTMLRenderer) renderTable( w util.BufWriter, source []byte, n gast.Node, entering bool) (gast.WalkStatus, error) { if entering { _, _ = w.WriteString("\n") } else { _, _ = w.WriteString("\n") } return gast.WalkContinue, nil } // TableHeaderAttributeFilter defines attribute names which elements can have. var TableHeaderAttributeFilter = html.GlobalAttributeFilter.Extend( []byte("align"), // [Deprecated since HTML4] [Obsolete since HTML5] []byte("bgcolor"), // [Not Standardized] []byte("char"), // [Deprecated since HTML4] [Obsolete since HTML5] []byte("charoff"), // [Deprecated since HTML4] [Obsolete since HTML5] []byte("valign"), // [Deprecated since HTML4] [Obsolete since HTML5] ) func (r *TableHTMLRenderer) renderTableHeader( w util.BufWriter, source []byte, n gast.Node, entering bool) (gast.WalkStatus, error) { if entering { _, _ = w.WriteString("\n") _, _ = w.WriteString("\n") // Header has no separate handle } else { _, _ = w.WriteString("\n") _, _ = w.WriteString("\n") if n.NextSibling() != nil { _, _ = w.WriteString("\n") } } return gast.WalkContinue, nil } // TableRowAttributeFilter defines attribute names which elements can have. var TableRowAttributeFilter = html.GlobalAttributeFilter.Extend( []byte("align"), // [Obsolete since HTML5] []byte("bgcolor"), // [Obsolete since HTML5] []byte("char"), // [Obsolete since HTML5] []byte("charoff"), // [Obsolete since HTML5] []byte("valign"), // [Obsolete since HTML5] ) func (r *TableHTMLRenderer) renderTableRow( w util.BufWriter, source []byte, n gast.Node, entering bool) (gast.WalkStatus, error) { if entering { _, _ = w.WriteString("\n") } else { _, _ = w.WriteString("\n") if n.Parent().LastChild() == n { _, _ = w.WriteString("\n") } } return gast.WalkContinue, nil } // TableThCellAttributeFilter defines attribute names which table cells can have. var TableThCellAttributeFilter = html.GlobalAttributeFilter.Extend( []byte("abbr"), // [OK] Contains a short abbreviated description of the cell's content [NOT OK in ] []byte("align"), // [Obsolete since HTML5] []byte("axis"), // [Obsolete since HTML5] []byte("bgcolor"), // [Not Standardized] []byte("char"), // [Obsolete since HTML5] []byte("charoff"), // [Obsolete since HTML5] []byte("colspan"), // [OK] Number of columns that the cell is to span []byte("headers"), // [OK] This attribute contains a list of space-separated // strings, each corresponding to the id attribute of the elements that apply to this element []byte("height"), // [Deprecated since HTML4] [Obsolete since HTML5] []byte("rowspan"), // [OK] Number of rows that the cell is to span []byte("scope"), // [OK] This enumerated attribute defines the cells that // the header (defined in the ) element relates to [NOT OK in ] []byte("valign"), // [Obsolete since HTML5] []byte("width"), // [Deprecated since HTML4] [Obsolete since HTML5] ) // TableTdCellAttributeFilter defines attribute names which table cells can have. var TableTdCellAttributeFilter = html.GlobalAttributeFilter.Extend( []byte("abbr"), // [Obsolete since HTML5] [OK in ] []byte("align"), // [Obsolete since HTML5] []byte("axis"), // [Obsolete since HTML5] []byte("bgcolor"), // [Not Standardized] []byte("char"), // [Obsolete since HTML5] []byte("charoff"), // [Obsolete since HTML5] []byte("colspan"), // [OK] Number of columns that the cell is to span []byte("headers"), // [OK] This attribute contains a list of space-separated // strings, each corresponding to the id attribute of the elements that apply to this element []byte("height"), // [Deprecated since HTML4] [Obsolete since HTML5] []byte("rowspan"), // [OK] Number of rows that the cell is to span []byte("scope"), // [Obsolete since HTML5] [OK in ] []byte("valign"), // [Obsolete since HTML5] []byte("width"), // [Deprecated since HTML4] [Obsolete since HTML5] ) func (r *TableHTMLRenderer) renderTableCell( w util.BufWriter, source []byte, node gast.Node, entering bool) (gast.WalkStatus, error) { n := node.(*ast.TableCell) tag := "td" if n.Parent().Kind() == ast.KindTableHeader { tag = "th" } if entering { _, _ = fmt.Fprintf(w, "<%s", tag) if n.Alignment != ast.AlignNone { amethod := r.TableConfig.TableCellAlignMethod if amethod == TableCellAlignDefault { if r.Config.XHTML { amethod = TableCellAlignAttribute } else { amethod = TableCellAlignStyle } } switch amethod { case TableCellAlignAttribute: if _, ok := n.AttributeString("align"); !ok { // Skip align render if overridden _, _ = fmt.Fprintf(w, ` align="%s"`, n.Alignment.String()) } case TableCellAlignStyle: v, ok := n.AttributeString("style") var cob util.CopyOnWriteBuffer if ok { cob = util.NewCopyOnWriteBuffer(v.([]byte)) cob.AppendByte(';') } style := fmt.Sprintf("text-align:%s", n.Alignment.String()) cob.AppendString(style) n.SetAttributeString("style", cob.Bytes()) } } if n.Attributes() != nil { if tag == "td" { html.RenderAttributes(w, n, TableTdCellAttributeFilter) // } else { html.RenderAttributes(w, n, TableThCellAttributeFilter) // } } _ = w.WriteByte('>') } else { _, _ = fmt.Fprintf(w, "\n", tag) } return gast.WalkContinue, nil } type table struct { options []TableOption } // Table is an extension that allow you to use GFM tables . var Table = &table{ options: []TableOption{}, } // NewTable returns a new extension with given options. func NewTable(opts ...TableOption) goldmark.Extender { return &table{ options: opts, } } func (e *table) Extend(m goldmark.Markdown) { m.Parser().AddOptions( parser.WithParagraphTransformers( util.Prioritized(NewTableParagraphTransformer(), 200), ), parser.WithASTTransformers( util.Prioritized(defaultTableASTTransformer, 0), ), ) m.Renderer().AddOptions(renderer.WithNodeRenderers( util.Prioritized(NewTableHTMLRenderer(e.options...), 500), )) } goldmark-1.7.4/extension/table_test.go000066400000000000000000000147251463655211100200310ustar00rootroot00000000000000package extension import ( "testing" "github.com/yuin/goldmark" "github.com/yuin/goldmark/ast" east "github.com/yuin/goldmark/extension/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) func TestTable(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), html.WithXHTML(), ), goldmark.WithExtensions( Table, ), ) testutil.DoTestCaseFile(markdown, "_test/table.txt", t, testutil.ParseCliCaseArg()...) } func TestTableWithAlignDefault(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( NewTable( WithTableCellAlignMethod(TableCellAlignDefault), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 1, Description: "Cell with TableCellAlignDefault and XHTML should be rendered as an align attribute", Markdown: ` | abc | defghi | :-: | -----------: bar | baz `, Expected: `
    abc defghi
    bar baz
    `, }, t, ) markdown = goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( NewTable( WithTableCellAlignMethod(TableCellAlignDefault), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 2, Description: "Cell with TableCellAlignDefault and HTML5 should be rendered as a style attribute", Markdown: ` | abc | defghi | :-: | -----------: bar | baz `, Expected: `
    abc defghi
    bar baz
    `, }, t, ) } func TestTableWithAlignAttribute(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( NewTable( WithTableCellAlignMethod(TableCellAlignAttribute), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 1, Description: "Cell with TableCellAlignAttribute and XHTML should be rendered as an align attribute", Markdown: ` | abc | defghi | :-: | -----------: bar | baz `, Expected: `
    abc defghi
    bar baz
    `, }, t, ) markdown = goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( NewTable( WithTableCellAlignMethod(TableCellAlignAttribute), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 2, Description: "Cell with TableCellAlignAttribute and HTML5 should be rendered as an align attribute", Markdown: ` | abc | defghi | :-: | -----------: bar | baz `, Expected: `
    abc defghi
    bar baz
    `, }, t, ) } type tableStyleTransformer struct { } func (a *tableStyleTransformer) Transform(node *ast.Document, reader text.Reader, pc parser.Context) { cell := node.FirstChild().FirstChild().FirstChild().(*east.TableCell) cell.SetAttributeString("style", []byte("font-size:1em")) } func TestTableWithAlignStyle(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( NewTable( WithTableCellAlignMethod(TableCellAlignStyle), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 1, Description: "Cell with TableCellAlignStyle and XHTML should be rendered as a style attribute", Markdown: ` | abc | defghi | :-: | -----------: bar | baz `, Expected: `
    abc defghi
    bar baz
    `, }, t, ) markdown = goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( NewTable( WithTableCellAlignMethod(TableCellAlignStyle), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 2, Description: "Cell with TableCellAlignStyle and HTML5 should be rendered as a style attribute", Markdown: ` | abc | defghi | :-: | -----------: bar | baz `, Expected: `
    abc defghi
    bar baz
    `, }, t, ) markdown = goldmark.New( goldmark.WithParserOptions( parser.WithASTTransformers( util.Prioritized(&tableStyleTransformer{}, 0), ), ), goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( NewTable( WithTableCellAlignMethod(TableCellAlignStyle), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 3, Description: "Styled cell should not be broken the style by the alignments", Markdown: ` | abc | defghi | :-: | -----------: bar | baz `, Expected: `
    abc defghi
    bar baz
    `, }, t, ) } func TestTableWithAlignNone(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), ), goldmark.WithExtensions( NewTable( WithTableCellAlignMethod(TableCellAlignNone), ), ), ) testutil.DoTestCase( markdown, testutil.MarkdownTestCase{ No: 1, Description: "Cell with TableCellAlignStyle and XHTML should not be rendered", Markdown: ` | abc | defghi | :-: | -----------: bar | baz `, Expected: `
    abc defghi
    bar baz
    `, }, t, ) } goldmark-1.7.4/extension/tasklist.go000066400000000000000000000061311463655211100175310ustar00rootroot00000000000000package extension import ( "regexp" "github.com/yuin/goldmark" gast "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/extension/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) var taskListRegexp = regexp.MustCompile(`^\[([\sxX])\]\s*`) type taskCheckBoxParser struct { } var defaultTaskCheckBoxParser = &taskCheckBoxParser{} // NewTaskCheckBoxParser returns a new InlineParser that can parse // checkboxes in list items. // This parser must take precedence over the parser.LinkParser. func NewTaskCheckBoxParser() parser.InlineParser { return defaultTaskCheckBoxParser } func (s *taskCheckBoxParser) Trigger() []byte { return []byte{'['} } func (s *taskCheckBoxParser) Parse(parent gast.Node, block text.Reader, pc parser.Context) gast.Node { // Given AST structure must be like // - List // - ListItem : parent.Parent // - TextBlock : parent // (current line) if parent.Parent() == nil || parent.Parent().FirstChild() != parent { return nil } if parent.HasChildren() { return nil } if _, ok := parent.Parent().(*gast.ListItem); !ok { return nil } line, _ := block.PeekLine() m := taskListRegexp.FindSubmatchIndex(line) if m == nil { return nil } value := line[m[2]:m[3]][0] block.Advance(m[1]) checked := value == 'x' || value == 'X' return ast.NewTaskCheckBox(checked) } func (s *taskCheckBoxParser) CloseBlock(parent gast.Node, pc parser.Context) { // nothing to do } // TaskCheckBoxHTMLRenderer is a renderer.NodeRenderer implementation that // renders checkboxes in list items. type TaskCheckBoxHTMLRenderer struct { html.Config } // NewTaskCheckBoxHTMLRenderer returns a new TaskCheckBoxHTMLRenderer. func NewTaskCheckBoxHTMLRenderer(opts ...html.Option) renderer.NodeRenderer { r := &TaskCheckBoxHTMLRenderer{ Config: html.NewConfig(), } for _, opt := range opts { opt.SetHTMLOption(&r.Config) } return r } // RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs. func (r *TaskCheckBoxHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { reg.Register(ast.KindTaskCheckBox, r.renderTaskCheckBox) } func (r *TaskCheckBoxHTMLRenderer) renderTaskCheckBox( w util.BufWriter, source []byte, node gast.Node, entering bool) (gast.WalkStatus, error) { if !entering { return gast.WalkContinue, nil } n := node.(*ast.TaskCheckBox) if n.IsChecked { _, _ = w.WriteString(` ") } else { _, _ = w.WriteString("> ") } return gast.WalkContinue, nil } type taskList struct { } // TaskList is an extension that allow you to use GFM task lists. var TaskList = &taskList{} func (e *taskList) Extend(m goldmark.Markdown) { m.Parser().AddOptions(parser.WithInlineParsers( util.Prioritized(NewTaskCheckBoxParser(), 0), )) m.Renderer().AddOptions(renderer.WithNodeRenderers( util.Prioritized(NewTaskCheckBoxHTMLRenderer(), 500), )) } goldmark-1.7.4/extension/tasklist_test.go000066400000000000000000000006331463655211100205710ustar00rootroot00000000000000package extension import ( "testing" "github.com/yuin/goldmark" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" ) func TestTaskList(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( TaskList, ), ) testutil.DoTestCaseFile(markdown, "_test/tasklist.txt", t, testutil.ParseCliCaseArg()...) } goldmark-1.7.4/extension/typographer.go000066400000000000000000000241221463655211100202370ustar00rootroot00000000000000package extension import ( "unicode" "github.com/yuin/goldmark" gast "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) var uncloseCounterKey = parser.NewContextKey() type unclosedCounter struct { Single int Double int } func (u *unclosedCounter) Reset() { u.Single = 0 u.Double = 0 } func getUnclosedCounter(pc parser.Context) *unclosedCounter { v := pc.Get(uncloseCounterKey) if v == nil { v = &unclosedCounter{} pc.Set(uncloseCounterKey, v) } return v.(*unclosedCounter) } // TypographicPunctuation is a key of the punctuations that can be replaced with // typographic entities. type TypographicPunctuation int const ( // LeftSingleQuote is ' . LeftSingleQuote TypographicPunctuation = iota + 1 // RightSingleQuote is ' . RightSingleQuote // LeftDoubleQuote is " . LeftDoubleQuote // RightDoubleQuote is " . RightDoubleQuote // EnDash is -- . EnDash // EmDash is --- . EmDash // Ellipsis is ... . Ellipsis // LeftAngleQuote is << . LeftAngleQuote // RightAngleQuote is >> . RightAngleQuote // Apostrophe is ' . Apostrophe typographicPunctuationMax ) // An TypographerConfig struct is a data structure that holds configuration of the // Typographer extension. type TypographerConfig struct { Substitutions [][]byte } func newDefaultSubstitutions() [][]byte { replacements := make([][]byte, typographicPunctuationMax) replacements[LeftSingleQuote] = []byte("‘") replacements[RightSingleQuote] = []byte("’") replacements[LeftDoubleQuote] = []byte("“") replacements[RightDoubleQuote] = []byte("”") replacements[EnDash] = []byte("–") replacements[EmDash] = []byte("—") replacements[Ellipsis] = []byte("…") replacements[LeftAngleQuote] = []byte("«") replacements[RightAngleQuote] = []byte("»") replacements[Apostrophe] = []byte("’") return replacements } // SetOption implements SetOptioner. func (b *TypographerConfig) SetOption(name parser.OptionName, value interface{}) { switch name { case optTypographicSubstitutions: b.Substitutions = value.([][]byte) } } // A TypographerOption interface sets options for the TypographerParser. type TypographerOption interface { parser.Option SetTypographerOption(*TypographerConfig) } const optTypographicSubstitutions parser.OptionName = "TypographicSubstitutions" // TypographicSubstitutions is a list of the substitutions for the Typographer extension. type TypographicSubstitutions map[TypographicPunctuation][]byte type withTypographicSubstitutions struct { value [][]byte } func (o *withTypographicSubstitutions) SetParserOption(c *parser.Config) { c.Options[optTypographicSubstitutions] = o.value } func (o *withTypographicSubstitutions) SetTypographerOption(p *TypographerConfig) { p.Substitutions = o.value } // WithTypographicSubstitutions is a functional otpion that specify replacement text // for punctuations. func WithTypographicSubstitutions[T []byte | string](values map[TypographicPunctuation]T) TypographerOption { replacements := newDefaultSubstitutions() for k, v := range values { replacements[k] = []byte(v) } return &withTypographicSubstitutions{replacements} } type typographerDelimiterProcessor struct { } func (p *typographerDelimiterProcessor) IsDelimiter(b byte) bool { return b == '\'' || b == '"' } func (p *typographerDelimiterProcessor) CanOpenCloser(opener, closer *parser.Delimiter) bool { return opener.Char == closer.Char } func (p *typographerDelimiterProcessor) OnMatch(consumes int) gast.Node { return nil } var defaultTypographerDelimiterProcessor = &typographerDelimiterProcessor{} type typographerParser struct { TypographerConfig } // NewTypographerParser return a new InlineParser that parses // typographer expressions. func NewTypographerParser(opts ...TypographerOption) parser.InlineParser { p := &typographerParser{ TypographerConfig: TypographerConfig{ Substitutions: newDefaultSubstitutions(), }, } for _, o := range opts { o.SetTypographerOption(&p.TypographerConfig) } return p } func (s *typographerParser) Trigger() []byte { return []byte{'\'', '"', '-', '.', ',', '<', '>', '*', '['} } func (s *typographerParser) Parse(parent gast.Node, block text.Reader, pc parser.Context) gast.Node { line, _ := block.PeekLine() c := line[0] if len(line) > 2 { if c == '-' { if s.Substitutions[EmDash] != nil && line[1] == '-' && line[2] == '-' { // --- node := gast.NewString(s.Substitutions[EmDash]) node.SetCode(true) block.Advance(3) return node } } else if c == '.' { if s.Substitutions[Ellipsis] != nil && line[1] == '.' && line[2] == '.' { // ... node := gast.NewString(s.Substitutions[Ellipsis]) node.SetCode(true) block.Advance(3) return node } return nil } } if len(line) > 1 { if c == '<' { if s.Substitutions[LeftAngleQuote] != nil && line[1] == '<' { // << node := gast.NewString(s.Substitutions[LeftAngleQuote]) node.SetCode(true) block.Advance(2) return node } return nil } else if c == '>' { if s.Substitutions[RightAngleQuote] != nil && line[1] == '>' { // >> node := gast.NewString(s.Substitutions[RightAngleQuote]) node.SetCode(true) block.Advance(2) return node } return nil } else if s.Substitutions[EnDash] != nil && c == '-' && line[1] == '-' { // -- node := gast.NewString(s.Substitutions[EnDash]) node.SetCode(true) block.Advance(2) return node } } if c == '\'' || c == '"' { before := block.PrecendingCharacter() d := parser.ScanDelimiter(line, before, 1, defaultTypographerDelimiterProcessor) if d == nil { return nil } counter := getUnclosedCounter(pc) if c == '\'' { if s.Substitutions[Apostrophe] != nil { // Handle decade abbrevations such as '90s if d.CanOpen && !d.CanClose && len(line) > 3 && util.IsNumeric(line[1]) && util.IsNumeric(line[2]) && line[3] == 's' { after := rune(' ') if len(line) > 4 { after = util.ToRune(line, 4) } if len(line) == 3 || util.IsSpaceRune(after) || util.IsPunctRune(after) { node := gast.NewString(s.Substitutions[Apostrophe]) node.SetCode(true) block.Advance(1) return node } } // special cases: 'twas, 'em, 'net if len(line) > 1 && (unicode.IsPunct(before) || unicode.IsSpace(before)) && (line[1] == 't' || line[1] == 'e' || line[1] == 'n' || line[1] == 'l') { node := gast.NewString(s.Substitutions[Apostrophe]) node.SetCode(true) block.Advance(1) return node } // Convert normal apostrophes. This is probably more flexible than necessary but // converts any apostrophe in between two alphanumerics. if len(line) > 1 && (unicode.IsDigit(before) || unicode.IsLetter(before)) && (unicode.IsLetter(util.ToRune(line, 1))) { node := gast.NewString(s.Substitutions[Apostrophe]) node.SetCode(true) block.Advance(1) return node } } if s.Substitutions[LeftSingleQuote] != nil && d.CanOpen && !d.CanClose { nt := LeftSingleQuote // special cases: Alice's, I'm, Don't, You'd if len(line) > 1 && (line[1] == 's' || line[1] == 'm' || line[1] == 't' || line[1] == 'd') && (len(line) < 3 || util.IsPunct(line[2]) || util.IsSpace(line[2])) { nt = RightSingleQuote } // special cases: I've, I'll, You're if len(line) > 2 && ((line[1] == 'v' && line[2] == 'e') || (line[1] == 'l' && line[2] == 'l') || (line[1] == 'r' && line[2] == 'e')) && (len(line) < 4 || util.IsPunct(line[3]) || util.IsSpace(line[3])) { nt = RightSingleQuote } if nt == LeftSingleQuote { counter.Single++ } node := gast.NewString(s.Substitutions[nt]) node.SetCode(true) block.Advance(1) return node } if s.Substitutions[RightSingleQuote] != nil { // plural possesive and abbreviations: Smiths', doin' if len(line) > 1 && unicode.IsSpace(util.ToRune(line, 0)) || unicode.IsPunct(util.ToRune(line, 0)) && (len(line) > 2 && !unicode.IsDigit(util.ToRune(line, 1))) { node := gast.NewString(s.Substitutions[RightSingleQuote]) node.SetCode(true) block.Advance(1) return node } } if s.Substitutions[RightSingleQuote] != nil && counter.Single > 0 { isClose := d.CanClose && !d.CanOpen maybeClose := d.CanClose && d.CanOpen && len(line) > 1 && unicode.IsPunct(util.ToRune(line, 1)) && (len(line) == 2 || (len(line) > 2 && util.IsPunct(line[2]) || util.IsSpace(line[2]))) if isClose || maybeClose { node := gast.NewString(s.Substitutions[RightSingleQuote]) node.SetCode(true) block.Advance(1) counter.Single-- return node } } } if c == '"' { if s.Substitutions[LeftDoubleQuote] != nil && d.CanOpen && !d.CanClose { node := gast.NewString(s.Substitutions[LeftDoubleQuote]) node.SetCode(true) block.Advance(1) counter.Double++ return node } if s.Substitutions[RightDoubleQuote] != nil && counter.Double > 0 { isClose := d.CanClose && !d.CanOpen maybeClose := d.CanClose && d.CanOpen && len(line) > 1 && (unicode.IsPunct(util.ToRune(line, 1))) && (len(line) == 2 || (len(line) > 2 && util.IsPunct(line[2]) || util.IsSpace(line[2]))) if isClose || maybeClose { // special case: "Monitor 21"" if len(line) > 1 && line[1] == '"' && unicode.IsDigit(before) { return nil } node := gast.NewString(s.Substitutions[RightDoubleQuote]) node.SetCode(true) block.Advance(1) counter.Double-- return node } } } } return nil } func (s *typographerParser) CloseBlock(parent gast.Node, pc parser.Context) { getUnclosedCounter(pc).Reset() } type typographer struct { options []TypographerOption } // Typographer is an extension that replaces punctuations with typographic entities. var Typographer = &typographer{} // NewTypographer returns a new Extender that replaces punctuations with typographic entities. func NewTypographer(opts ...TypographerOption) goldmark.Extender { return &typographer{ options: opts, } } func (e *typographer) Extend(m goldmark.Markdown) { m.Parser().AddOptions(parser.WithInlineParsers( util.Prioritized(NewTypographerParser(e.options...), 9999), )) } goldmark-1.7.4/extension/typographer_test.go000066400000000000000000000006441463655211100213010ustar00rootroot00000000000000package extension import ( "testing" "github.com/yuin/goldmark" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" ) func TestTypographer(t *testing.T) { markdown := goldmark.New( goldmark.WithRendererOptions( html.WithUnsafe(), ), goldmark.WithExtensions( Typographer, ), ) testutil.DoTestCaseFile(markdown, "_test/typographer.txt", t, testutil.ParseCliCaseArg()...) } goldmark-1.7.4/extra_test.go000066400000000000000000000123401463655211100160400ustar00rootroot00000000000000package goldmark_test import ( "bytes" "os" "strconv" "strings" "testing" "time" . "github.com/yuin/goldmark" "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/testutil" ) var testTimeoutMultiplier = 1.0 func init() { m, err := strconv.ParseFloat(os.Getenv("GOLDMARK_TEST_TIMEOUT_MULTIPLIER"), 64) if err == nil { testTimeoutMultiplier = m } } func TestExtras(t *testing.T) { markdown := New(WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) testutil.DoTestCaseFile(markdown, "_test/extra.txt", t, testutil.ParseCliCaseArg()...) } func TestEndsWithNonSpaceCharacters(t *testing.T) { markdown := New(WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) source := []byte("```\na\n```") var b bytes.Buffer err := markdown.Convert(source, &b) if err != nil { t.Error(err.Error()) } if b.String() != "
    a\n
    \n" { t.Errorf("%s \n---------\n %s", source, b.String()) } } func TestWindowsNewLine(t *testing.T) { markdown := New(WithRendererOptions( html.WithXHTML(), )) source := []byte("a \r\nb\n") var b bytes.Buffer err := markdown.Convert(source, &b) if err != nil { t.Error(err.Error()) } if b.String() != "

    a
    \nb

    \n" { t.Errorf("%s\n---------\n%s", source, b.String()) } source = []byte("a\\\r\nb\r\n") var b2 bytes.Buffer err = markdown.Convert(source, &b2) if err != nil { t.Error(err.Error()) } if b2.String() != "

    a
    \nb

    \n" { t.Errorf("\n%s\n---------\n%s", source, b2.String()) } } type myIDs struct { } func (s *myIDs) Generate(value []byte, kind ast.NodeKind) []byte { return []byte("my-id") } func (s *myIDs) Put(value []byte) { } func TestAutogeneratedIDs(t *testing.T) { ctx := parser.NewContext(parser.WithIDs(&myIDs{})) markdown := New(WithParserOptions(parser.WithAutoHeadingID())) source := []byte("# Title1\n## Title2") var b bytes.Buffer err := markdown.Convert(source, &b, parser.WithContext(ctx)) if err != nil { t.Error(err.Error()) } if b.String() != `

    Title1

    Title2

    ` { t.Errorf("%s\n---------\n%s", source, b.String()) } } func nowMillis() int64 { // TODO: replace UnixNano to UnixMillis(drops Go1.16 support) return time.Now().UnixNano() / 1000000 } func TestDeepNestedLabelPerformance(t *testing.T) { if testing.Short() { t.Skip("skipping performance test in short mode") } markdown := New(WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) started := nowMillis() n := 50000 source := []byte(strings.Repeat("[", n) + strings.Repeat("]", n)) var b bytes.Buffer _ = markdown.Convert(source, &b) finished := nowMillis() if (finished - started) > int64(5000*testTimeoutMultiplier) { t.Error("Parsing deep nested labels took too long") } } func TestManyProcessingInstructionPerformance(t *testing.T) { if testing.Short() { t.Skip("skipping performance test in short mode") } markdown := New(WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) started := nowMillis() n := 50000 source := []byte("a " + strings.Repeat(" int64(5000*testTimeoutMultiplier) { t.Error("Parsing processing instructions took too long") } } func TestManyCDATAPerformance(t *testing.T) { if testing.Short() { t.Skip("skipping performance test in short mode") } markdown := New(WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) started := nowMillis() n := 50000 source := []byte(strings.Repeat("a int64(5000*testTimeoutMultiplier) { t.Error("Parsing processing instructions took too long") } } func TestManyDeclPerformance(t *testing.T) { if testing.Short() { t.Skip("skipping performance test in short mode") } markdown := New(WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) started := nowMillis() n := 50000 source := []byte(strings.Repeat("a int64(5000*testTimeoutMultiplier) { t.Error("Parsing processing instructions took too long") } } func TestManyCommentPerformance(t *testing.T) { if testing.Short() { t.Skip("skipping performance test in short mode") } markdown := New(WithRendererOptions( html.WithXHTML(), html.WithUnsafe(), )) started := nowMillis() n := 50000 source := []byte(strings.Repeat("a ") var emptyComment2 = []byte("") var openComment = []byte("") func (s *rawHTMLParser) parseComment(block text.Reader, pc Context) ast.Node { savedLine, savedSegment := block.Position() node := ast.NewRawHTML() line, segment := block.PeekLine() if bytes.HasPrefix(line, emptyComment1) { node.Segments.Append(segment.WithStop(segment.Start + len(emptyComment1))) block.Advance(len(emptyComment1)) return node } if bytes.HasPrefix(line, emptyComment2) { node.Segments.Append(segment.WithStop(segment.Start + len(emptyComment2))) block.Advance(len(emptyComment2)) return node } offset := len(openComment) line = line[offset:] for { index := bytes.Index(line, closeComment) if index > -1 { node.Segments.Append(segment.WithStop(segment.Start + offset + index + len(closeComment))) block.Advance(offset + index + len(closeComment)) return node } offset = 0 node.Segments.Append(segment) block.AdvanceLine() line, segment = block.PeekLine() if line == nil { break } } block.SetPosition(savedLine, savedSegment) return nil } func (s *rawHTMLParser) parseUntil(block text.Reader, closer []byte, pc Context) ast.Node { savedLine, savedSegment := block.Position() node := ast.NewRawHTML() for { line, segment := block.PeekLine() if line == nil { break } index := bytes.Index(line, closer) if index > -1 { node.Segments.Append(segment.WithStop(segment.Start + index + len(closer))) block.Advance(index + len(closer)) return node } node.Segments.Append(segment) block.AdvanceLine() } block.SetPosition(savedLine, savedSegment) return nil } func (s *rawHTMLParser) parseMultiLineRegexp(reg *regexp.Regexp, block text.Reader, pc Context) ast.Node { sline, ssegment := block.Position() if block.Match(reg) { node := ast.NewRawHTML() eline, esegment := block.Position() block.SetPosition(sline, ssegment) for { line, segment := block.PeekLine() if line == nil { break } l, _ := block.Position() start := segment.Start if l == sline { start = ssegment.Start } end := segment.Stop if l == eline { end = esegment.Start } node.Segments.Append(text.NewSegment(start, end)) if l == eline { block.Advance(end - start) break } block.AdvanceLine() } return node } return nil } goldmark-1.7.4/parser/setext_headings.go000066400000000000000000000057741463655211100203450ustar00rootroot00000000000000package parser import ( "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) var temporaryParagraphKey = NewContextKey() type setextHeadingParser struct { HeadingConfig } func matchesSetextHeadingBar(line []byte) (byte, bool) { start := 0 end := len(line) space := util.TrimLeftLength(line, []byte{' '}) if space > 3 { return 0, false } start += space level1 := util.TrimLeftLength(line[start:end], []byte{'='}) c := byte('=') var level2 int if level1 == 0 { level2 = util.TrimLeftLength(line[start:end], []byte{'-'}) c = '-' } if util.IsSpace(line[end-1]) { end -= util.TrimRightSpaceLength(line[start:end]) } if !((level1 > 0 && start+level1 == end) || (level2 > 0 && start+level2 == end)) { return 0, false } return c, true } // NewSetextHeadingParser return a new BlockParser that can parse Setext headings. func NewSetextHeadingParser(opts ...HeadingOption) BlockParser { p := &setextHeadingParser{} for _, o := range opts { o.SetHeadingOption(&p.HeadingConfig) } return p } func (b *setextHeadingParser) Trigger() []byte { return []byte{'-', '='} } func (b *setextHeadingParser) Open(parent ast.Node, reader text.Reader, pc Context) (ast.Node, State) { last := pc.LastOpenedBlock().Node if last == nil { return nil, NoChildren } paragraph, ok := last.(*ast.Paragraph) if !ok || paragraph.Parent() != parent { return nil, NoChildren } line, segment := reader.PeekLine() c, ok := matchesSetextHeadingBar(line) if !ok { return nil, NoChildren } level := 1 if c == '-' { level = 2 } node := ast.NewHeading(level) node.Lines().Append(segment) pc.Set(temporaryParagraphKey, last) return node, NoChildren | RequireParagraph } func (b *setextHeadingParser) Continue(node ast.Node, reader text.Reader, pc Context) State { return Close } func (b *setextHeadingParser) Close(node ast.Node, reader text.Reader, pc Context) { heading := node.(*ast.Heading) segment := node.Lines().At(0) heading.Lines().Clear() tmp := pc.Get(temporaryParagraphKey).(*ast.Paragraph) pc.Set(temporaryParagraphKey, nil) if tmp.Lines().Len() == 0 { next := heading.NextSibling() segment = segment.TrimLeftSpace(reader.Source()) if next == nil || !ast.IsParagraph(next) { para := ast.NewParagraph() para.Lines().Append(segment) heading.Parent().InsertAfter(heading.Parent(), heading, para) } else { next.Lines().Unshift(segment) } heading.Parent().RemoveChild(heading.Parent(), heading) } else { heading.SetLines(tmp.Lines()) heading.SetBlankPreviousLines(tmp.HasBlankPreviousLines()) tp := tmp.Parent() if tp != nil { tp.RemoveChild(tp, tmp) } } if b.Attribute { parseLastLineAttributes(node, reader, pc) } if b.AutoHeadingID { id, ok := node.AttributeString("id") if !ok { generateAutoHeadingID(heading, reader, pc) } else { pc.IDs().Put(id.([]byte)) } } } func (b *setextHeadingParser) CanInterruptParagraph() bool { return true } func (b *setextHeadingParser) CanAcceptIndentedLine() bool { return false } goldmark-1.7.4/parser/thematic_break.go000066400000000000000000000030571463655211100201210ustar00rootroot00000000000000package parser import ( "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" ) type thematicBreakPraser struct { } var defaultThematicBreakPraser = &thematicBreakPraser{} // NewThematicBreakParser returns a new BlockParser that // parses thematic breaks. func NewThematicBreakParser() BlockParser { return defaultThematicBreakPraser } func isThematicBreak(line []byte, offset int) bool { w, pos := util.IndentWidth(line, offset) if w > 3 { return false } mark := byte(0) count := 0 for i := pos; i < len(line); i++ { c := line[i] if util.IsSpace(c) { continue } if mark == 0 { mark = c count = 1 if mark == '*' || mark == '-' || mark == '_' { continue } return false } if c != mark { return false } count++ } return count > 2 } func (b *thematicBreakPraser) Trigger() []byte { return []byte{'-', '*', '_'} } func (b *thematicBreakPraser) Open(parent ast.Node, reader text.Reader, pc Context) (ast.Node, State) { line, segment := reader.PeekLine() if isThematicBreak(line, reader.LineOffset()) { reader.Advance(segment.Len() - 1) return ast.NewThematicBreak(), NoChildren } return nil, NoChildren } func (b *thematicBreakPraser) Continue(node ast.Node, reader text.Reader, pc Context) State { return Close } func (b *thematicBreakPraser) Close(node ast.Node, reader text.Reader, pc Context) { // nothing to do } func (b *thematicBreakPraser) CanInterruptParagraph() bool { return true } func (b *thematicBreakPraser) CanAcceptIndentedLine() bool { return false } goldmark-1.7.4/renderer/000077500000000000000000000000001463655211100151355ustar00rootroot00000000000000goldmark-1.7.4/renderer/html/000077500000000000000000000000001463655211100161015ustar00rootroot00000000000000goldmark-1.7.4/renderer/html/html.go000066400000000000000000000667011463655211100174060ustar00rootroot00000000000000// Package html implements renderer that outputs HTMLs. package html import ( "bytes" "fmt" "strconv" "unicode" "unicode/utf8" "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/renderer" "github.com/yuin/goldmark/util" ) // A Config struct has configurations for the HTML based renderers. type Config struct { Writer Writer HardWraps bool EastAsianLineBreaks EastAsianLineBreaks XHTML bool Unsafe bool } // NewConfig returns a new Config with defaults. func NewConfig() Config { return Config{ Writer: DefaultWriter, HardWraps: false, EastAsianLineBreaks: EastAsianLineBreaksNone, XHTML: false, Unsafe: false, } } // SetOption implements renderer.NodeRenderer.SetOption. func (c *Config) SetOption(name renderer.OptionName, value interface{}) { switch name { case optHardWraps: c.HardWraps = value.(bool) case optEastAsianLineBreaks: c.EastAsianLineBreaks = value.(EastAsianLineBreaks) case optXHTML: c.XHTML = value.(bool) case optUnsafe: c.Unsafe = value.(bool) case optTextWriter: c.Writer = value.(Writer) } } // An Option interface sets options for HTML based renderers. type Option interface { SetHTMLOption(*Config) } // TextWriter is an option name used in WithWriter. const optTextWriter renderer.OptionName = "Writer" type withWriter struct { value Writer } func (o *withWriter) SetConfig(c *renderer.Config) { c.Options[optTextWriter] = o.value } func (o *withWriter) SetHTMLOption(c *Config) { c.Writer = o.value } // WithWriter is a functional option that allow you to set the given writer to // the renderer. func WithWriter(writer Writer) interface { renderer.Option Option } { return &withWriter{writer} } // HardWraps is an option name used in WithHardWraps. const optHardWraps renderer.OptionName = "HardWraps" type withHardWraps struct { } func (o *withHardWraps) SetConfig(c *renderer.Config) { c.Options[optHardWraps] = true } func (o *withHardWraps) SetHTMLOption(c *Config) { c.HardWraps = true } // WithHardWraps is a functional option that indicates whether softline breaks // should be rendered as '
    '. func WithHardWraps() interface { renderer.Option Option } { return &withHardWraps{} } // EastAsianLineBreaks is an option name used in WithEastAsianLineBreaks. const optEastAsianLineBreaks renderer.OptionName = "EastAsianLineBreaks" // A EastAsianLineBreaks is a style of east asian line breaks. type EastAsianLineBreaks int const ( //EastAsianLineBreaksNone renders line breaks as it is. EastAsianLineBreaksNone EastAsianLineBreaks = iota // EastAsianLineBreaksSimple follows east_asian_line_breaks in Pandoc. EastAsianLineBreaksSimple // EastAsianLineBreaksCSS3Draft follows CSS text level3 "Segment Break Transformation Rules" with some enhancements. EastAsianLineBreaksCSS3Draft ) func (b EastAsianLineBreaks) softLineBreak(thisLastRune rune, siblingFirstRune rune) bool { switch b { case EastAsianLineBreaksNone: return false case EastAsianLineBreaksSimple: return !(util.IsEastAsianWideRune(thisLastRune) && util.IsEastAsianWideRune(siblingFirstRune)) case EastAsianLineBreaksCSS3Draft: return eastAsianLineBreaksCSS3DraftSoftLineBreak(thisLastRune, siblingFirstRune) } return false } func eastAsianLineBreaksCSS3DraftSoftLineBreak(thisLastRune rune, siblingFirstRune rune) bool { // Implements CSS text level3 Segment Break Transformation Rules with some enhancements. // References: // - https://www.w3.org/TR/2020/WD-css-text-3-20200429/#line-break-transform // - https://github.com/w3c/csswg-drafts/issues/5086 // Rule1: // If the character immediately before or immediately after the segment break is // the zero-width space character (U+200B), then the break is removed, leaving behind the zero-width space. if thisLastRune == '\u200B' || siblingFirstRune == '\u200B' { return false } // Rule2: // Otherwise, if the East Asian Width property of both the character before and after the segment break is // F, W, or H (not A), and neither side is Hangul, then the segment break is removed. thisLastRuneEastAsianWidth := util.EastAsianWidth(thisLastRune) siblingFirstRuneEastAsianWidth := util.EastAsianWidth(siblingFirstRune) if (thisLastRuneEastAsianWidth == "F" || thisLastRuneEastAsianWidth == "W" || thisLastRuneEastAsianWidth == "H") && (siblingFirstRuneEastAsianWidth == "F" || siblingFirstRuneEastAsianWidth == "W" || siblingFirstRuneEastAsianWidth == "H") { return unicode.Is(unicode.Hangul, thisLastRune) || unicode.Is(unicode.Hangul, siblingFirstRune) } // Rule3: // Otherwise, if either the character before or after the segment break belongs to // the space-discarding character set and it is a Unicode Punctuation (P*) or U+3000, // then the segment break is removed. if util.IsSpaceDiscardingUnicodeRune(thisLastRune) || unicode.IsPunct(thisLastRune) || thisLastRune == '\u3000' || util.IsSpaceDiscardingUnicodeRune(siblingFirstRune) || unicode.IsPunct(siblingFirstRune) || siblingFirstRune == '\u3000' { return false } // Rule4: // Otherwise, the segment break is converted to a space (U+0020). return true } type withEastAsianLineBreaks struct { eastAsianLineBreaksStyle EastAsianLineBreaks } func (o *withEastAsianLineBreaks) SetConfig(c *renderer.Config) { c.Options[optEastAsianLineBreaks] = o.eastAsianLineBreaksStyle } func (o *withEastAsianLineBreaks) SetHTMLOption(c *Config) { c.EastAsianLineBreaks = o.eastAsianLineBreaksStyle } // WithEastAsianLineBreaks is a functional option that indicates whether softline breaks // between east asian wide characters should be ignored. func WithEastAsianLineBreaks(e EastAsianLineBreaks) interface { renderer.Option Option } { return &withEastAsianLineBreaks{e} } // XHTML is an option name used in WithXHTML. const optXHTML renderer.OptionName = "XHTML" type withXHTML struct { } func (o *withXHTML) SetConfig(c *renderer.Config) { c.Options[optXHTML] = true } func (o *withXHTML) SetHTMLOption(c *Config) { c.XHTML = true } // WithXHTML is a functional option indicates that nodes should be rendered in // xhtml instead of HTML5. func WithXHTML() interface { Option renderer.Option } { return &withXHTML{} } // Unsafe is an option name used in WithUnsafe. const optUnsafe renderer.OptionName = "Unsafe" type withUnsafe struct { } func (o *withUnsafe) SetConfig(c *renderer.Config) { c.Options[optUnsafe] = true } func (o *withUnsafe) SetHTMLOption(c *Config) { c.Unsafe = true } // WithUnsafe is a functional option that renders dangerous contents // (raw htmls and potentially dangerous links) as it is. func WithUnsafe() interface { renderer.Option Option } { return &withUnsafe{} } // A Renderer struct is an implementation of renderer.NodeRenderer that renders // nodes as (X)HTML. type Renderer struct { Config } // NewRenderer returns a new Renderer with given options. func NewRenderer(opts ...Option) renderer.NodeRenderer { r := &Renderer{ Config: NewConfig(), } for _, opt := range opts { opt.SetHTMLOption(&r.Config) } return r } // RegisterFuncs implements NodeRenderer.RegisterFuncs . func (r *Renderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer) { // blocks reg.Register(ast.KindDocument, r.renderDocument) reg.Register(ast.KindHeading, r.renderHeading) reg.Register(ast.KindBlockquote, r.renderBlockquote) reg.Register(ast.KindCodeBlock, r.renderCodeBlock) reg.Register(ast.KindFencedCodeBlock, r.renderFencedCodeBlock) reg.Register(ast.KindHTMLBlock, r.renderHTMLBlock) reg.Register(ast.KindList, r.renderList) reg.Register(ast.KindListItem, r.renderListItem) reg.Register(ast.KindParagraph, r.renderParagraph) reg.Register(ast.KindTextBlock, r.renderTextBlock) reg.Register(ast.KindThematicBreak, r.renderThematicBreak) // inlines reg.Register(ast.KindAutoLink, r.renderAutoLink) reg.Register(ast.KindCodeSpan, r.renderCodeSpan) reg.Register(ast.KindEmphasis, r.renderEmphasis) reg.Register(ast.KindImage, r.renderImage) reg.Register(ast.KindLink, r.renderLink) reg.Register(ast.KindRawHTML, r.renderRawHTML) reg.Register(ast.KindText, r.renderText) reg.Register(ast.KindString, r.renderString) } func (r *Renderer) writeLines(w util.BufWriter, source []byte, n ast.Node) { l := n.Lines().Len() for i := 0; i < l; i++ { line := n.Lines().At(i) r.Writer.RawWrite(w, line.Value(source)) } } // GlobalAttributeFilter defines attribute names which any elements can have. var GlobalAttributeFilter = util.NewBytesFilter( []byte("accesskey"), []byte("autocapitalize"), []byte("autofocus"), []byte("class"), []byte("contenteditable"), []byte("dir"), []byte("draggable"), []byte("enterkeyhint"), []byte("hidden"), []byte("id"), []byte("inert"), []byte("inputmode"), []byte("is"), []byte("itemid"), []byte("itemprop"), []byte("itemref"), []byte("itemscope"), []byte("itemtype"), []byte("lang"), []byte("part"), []byte("role"), []byte("slot"), []byte("spellcheck"), []byte("style"), []byte("tabindex"), []byte("title"), []byte("translate"), ) func (r *Renderer) renderDocument( w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { // nothing to do return ast.WalkContinue, nil } // HeadingAttributeFilter defines attribute names which heading elements can have. var HeadingAttributeFilter = GlobalAttributeFilter func (r *Renderer) renderHeading( w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { n := node.(*ast.Heading) if entering { _, _ = w.WriteString("') } else { _, _ = w.WriteString("\n") } return ast.WalkContinue, nil } // BlockquoteAttributeFilter defines attribute names which blockquote elements can have. var BlockquoteAttributeFilter = GlobalAttributeFilter.Extend( []byte("cite"), ) func (r *Renderer) renderBlockquote( w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) { if entering { if n.Attributes() != nil { _, _ = w.WriteString("') } else { _, _ = w.WriteString("
    \n") } } else { _, _ = w.WriteString("
    \n") } return ast.WalkContinue, nil } func (r *Renderer) renderCodeBlock(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) { if entering { _, _ = w.WriteString("
    ")
    		r.writeLines(w, source, n)
    	} else {
    		_, _ = w.WriteString("
    \n") } return ast.WalkContinue, nil } func (r *Renderer) renderFencedCodeBlock( w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { n := node.(*ast.FencedCodeBlock) if entering { _, _ = w.WriteString("
    \n") } return ast.WalkContinue, nil } func (r *Renderer) renderHTMLBlock( w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { n := node.(*ast.HTMLBlock) if entering { if r.Unsafe { l := n.Lines().Len() for i := 0; i < l; i++ { line := n.Lines().At(i) r.Writer.SecureWrite(w, line.Value(source)) } } else { _, _ = w.WriteString("\n") } } else { if n.HasClosure() { if r.Unsafe { closure := n.ClosureLine r.Writer.SecureWrite(w, closure.Value(source)) } else { _, _ = w.WriteString("\n") } } } return ast.WalkContinue, nil } // ListAttributeFilter defines attribute names which list elements can have. var ListAttributeFilter = GlobalAttributeFilter.Extend( []byte("start"), []byte("reversed"), []byte("type"), ) func (r *Renderer) renderList(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { n := node.(*ast.List) tag := "ul" if n.IsOrdered() { tag = "ol" } if entering { _ = w.WriteByte('<') _, _ = w.WriteString(tag) if n.IsOrdered() && n.Start != 1 { _, _ = fmt.Fprintf(w, " start=\"%d\"", n.Start) } if n.Attributes() != nil { RenderAttributes(w, n, ListAttributeFilter) } _, _ = w.WriteString(">\n") } else { _, _ = w.WriteString("\n") } return ast.WalkContinue, nil } // ListItemAttributeFilter defines attribute names which list item elements can have. var ListItemAttributeFilter = GlobalAttributeFilter.Extend( []byte("value"), ) func (r *Renderer) renderListItem(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) { if entering { if n.Attributes() != nil { _, _ = w.WriteString("') } else { _, _ = w.WriteString("
  • ") } fc := n.FirstChild() if fc != nil { if _, ok := fc.(*ast.TextBlock); !ok { _ = w.WriteByte('\n') } } } else { _, _ = w.WriteString("
  • \n") } return ast.WalkContinue, nil } // ParagraphAttributeFilter defines attribute names which paragraph elements can have. var ParagraphAttributeFilter = GlobalAttributeFilter func (r *Renderer) renderParagraph(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) { if entering { if n.Attributes() != nil { _, _ = w.WriteString("') } else { _, _ = w.WriteString("

    ") } } else { _, _ = w.WriteString("

    \n") } return ast.WalkContinue, nil } func (r *Renderer) renderTextBlock(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { if n.NextSibling() != nil && n.FirstChild() != nil { _ = w.WriteByte('\n') } } return ast.WalkContinue, nil } // ThematicAttributeFilter defines attribute names which hr elements can have. var ThematicAttributeFilter = GlobalAttributeFilter.Extend( []byte("align"), // [Deprecated] []byte("color"), // [Not Standardized] []byte("noshade"), // [Deprecated] []byte("size"), // [Deprecated] []byte("width"), // [Deprecated] ) func (r *Renderer) renderThematicBreak( w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { return ast.WalkContinue, nil } _, _ = w.WriteString("\n") } else { _, _ = w.WriteString(">\n") } return ast.WalkContinue, nil } // LinkAttributeFilter defines attribute names which link elements can have. var LinkAttributeFilter = GlobalAttributeFilter.Extend( []byte("download"), // []byte("href"), []byte("hreflang"), []byte("media"), []byte("ping"), []byte("referrerpolicy"), []byte("rel"), []byte("shape"), []byte("target"), ) func (r *Renderer) renderAutoLink( w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { n := node.(*ast.AutoLink) if !entering { return ast.WalkContinue, nil } _, _ = w.WriteString(`') } else { _, _ = w.WriteString(`">`) } _, _ = w.Write(util.EscapeHTML(label)) _, _ = w.WriteString(``) return ast.WalkContinue, nil } // CodeAttributeFilter defines attribute names which code elements can have. var CodeAttributeFilter = GlobalAttributeFilter func (r *Renderer) renderCodeSpan(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) { if entering { if n.Attributes() != nil { _, _ = w.WriteString("') } else { _, _ = w.WriteString("") } for c := n.FirstChild(); c != nil; c = c.NextSibling() { segment := c.(*ast.Text).Segment value := segment.Value(source) if bytes.HasSuffix(value, []byte("\n")) { r.Writer.RawWrite(w, value[:len(value)-1]) r.Writer.RawWrite(w, []byte(" ")) } else { r.Writer.RawWrite(w, value) } } return ast.WalkSkipChildren, nil } _, _ = w.WriteString("") return ast.WalkContinue, nil } // EmphasisAttributeFilter defines attribute names which emphasis elements can have. var EmphasisAttributeFilter = GlobalAttributeFilter func (r *Renderer) renderEmphasis( w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { n := node.(*ast.Emphasis) tag := "em" if n.Level == 2 { tag = "strong" } if entering { _ = w.WriteByte('<') _, _ = w.WriteString(tag) if n.Attributes() != nil { RenderAttributes(w, n, EmphasisAttributeFilter) } _ = w.WriteByte('>') } else { _, _ = w.WriteString("') } return ast.WalkContinue, nil } func (r *Renderer) renderLink(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { n := node.(*ast.Link) if entering { _, _ = w.WriteString("') } else { _, _ = w.WriteString("") } return ast.WalkContinue, nil } // ImageAttributeFilter defines attribute names which image elements can have. var ImageAttributeFilter = GlobalAttributeFilter.Extend( []byte("align"), []byte("border"), []byte("crossorigin"), []byte("decoding"), []byte("height"), []byte("importance"), []byte("intrinsicsize"), []byte("ismap"), []byte("loading"), []byte("referrerpolicy"), []byte("sizes"), []byte("srcset"), []byte("usemap"), []byte("width"), ) func (r *Renderer) renderImage(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { return ast.WalkContinue, nil } n := node.(*ast.Image) _, _ = w.WriteString("`)
	r.renderAttribute(w, source, n)
	_ = w.WriteByte('") } else { _, _ = w.WriteString(">") } return ast.WalkSkipChildren, nil } func (r *Renderer) renderRawHTML( w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { return ast.WalkSkipChildren, nil } if r.Unsafe { n := node.(*ast.RawHTML) l := n.Segments.Len() for i := 0; i < l; i++ { segment := n.Segments.At(i) _, _ = w.Write(segment.Value(source)) } return ast.WalkSkipChildren, nil } _, _ = w.WriteString("") return ast.WalkSkipChildren, nil } func (r *Renderer) renderText(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { return ast.WalkContinue, nil } n := node.(*ast.Text) segment := n.Segment if n.IsRaw() { r.Writer.RawWrite(w, segment.Value(source)) } else { value := segment.Value(source) r.Writer.Write(w, value) if n.HardLineBreak() || (n.SoftLineBreak() && r.HardWraps) { if r.XHTML { _, _ = w.WriteString("
    \n") } else { _, _ = w.WriteString("
    \n") } } else if n.SoftLineBreak() { if r.EastAsianLineBreaks != EastAsianLineBreaksNone && len(value) != 0 { sibling := node.NextSibling() if sibling != nil && sibling.Kind() == ast.KindText { if siblingText := sibling.(*ast.Text).Text(source); len(siblingText) != 0 { thisLastRune := util.ToRune(value, len(value)-1) siblingFirstRune, _ := utf8.DecodeRune(siblingText) if r.EastAsianLineBreaks.softLineBreak(thisLastRune, siblingFirstRune) { _ = w.WriteByte('\n') } } } } else { _ = w.WriteByte('\n') } } } return ast.WalkContinue, nil } func (r *Renderer) renderString(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error) { if !entering { return ast.WalkContinue, nil } n := node.(*ast.String) if n.IsCode() { _, _ = w.Write(n.Value) } else { if n.IsRaw() { r.Writer.RawWrite(w, n.Value) } else { r.Writer.Write(w, n.Value) } } return ast.WalkContinue, nil } func (r *Renderer) renderAttribute(w util.BufWriter, source []byte, n ast.Node) { for c := n.FirstChild(); c != nil; c = c.NextSibling() { if s, ok := c.(*ast.String); ok { _, _ = r.renderString(w, source, s, true) } else if t, ok := c.(*ast.String); ok { _, _ = r.renderText(w, source, t, true) } else if !c.HasChildren() { r.Writer.Write(w, c.Text(source)) if t, ok := c.(*ast.Text); ok && t.SoftLineBreak() { _ = w.WriteByte('\n') } } else { r.renderAttribute(w, source, c) } } } var dataPrefix = []byte("data-") // RenderAttributes renders given node's attributes. // You can specify attribute names to render by the filter. // If filter is nil, RenderAttributes renders all attributes. func RenderAttributes(w util.BufWriter, node ast.Node, filter util.BytesFilter) { for _, attr := range node.Attributes() { if filter != nil && !filter.Contains(attr.Name) { if !bytes.HasPrefix(attr.Name, dataPrefix) { continue } } _, _ = w.WriteString(" ") _, _ = w.Write(attr.Name) _, _ = w.WriteString(`="`) // TODO: convert numeric values to strings var value []byte switch typed := attr.Value.(type) { case []byte: value = typed case string: value = util.StringToReadOnlyBytes(typed) } _, _ = w.Write(util.EscapeHTML(value)) _ = w.WriteByte('"') } } // A Writer interface writes textual contents to a writer. type Writer interface { // Write writes the given source to writer with resolving references and unescaping // backslash escaped characters. Write(writer util.BufWriter, source []byte) // RawWrite writes the given source to writer without resolving references and // unescaping backslash escaped characters. RawWrite(writer util.BufWriter, source []byte) // SecureWrite writes the given source to writer with replacing insecure characters. SecureWrite(writer util.BufWriter, source []byte) } var replacementCharacter = []byte("\ufffd") // A WriterConfig struct has configurations for the HTML based writers. type WriterConfig struct { // EscapedSpace is an option that indicates that a '\' escaped half-space(0x20) should not be rendered. EscapedSpace bool } // A WriterOption interface sets options for HTML based writers. type WriterOption func(*WriterConfig) // WithEscapedSpace is a WriterOption indicates that a '\' escaped half-space(0x20) should not be rendered. func WithEscapedSpace() WriterOption { return func(c *WriterConfig) { c.EscapedSpace = true } } type defaultWriter struct { WriterConfig } // NewWriter returns a new Writer. func NewWriter(opts ...WriterOption) Writer { w := &defaultWriter{} for _, opt := range opts { opt(&w.WriterConfig) } return w } func escapeRune(writer util.BufWriter, r rune) { if r < 256 { v := util.EscapeHTMLByte(byte(r)) if v != nil { _, _ = writer.Write(v) return } } _, _ = writer.WriteRune(util.ToValidRune(r)) } func (d *defaultWriter) SecureWrite(writer util.BufWriter, source []byte) { n := 0 l := len(source) for i := 0; i < l; i++ { if source[i] == '\u0000' { _, _ = writer.Write(source[i-n : i]) n = 0 _, _ = writer.Write(replacementCharacter) continue } n++ } if n != 0 { _, _ = writer.Write(source[l-n:]) } } func (d *defaultWriter) RawWrite(writer util.BufWriter, source []byte) { n := 0 l := len(source) for i := 0; i < l; i++ { v := util.EscapeHTMLByte(source[i]) if v != nil { _, _ = writer.Write(source[i-n : i]) n = 0 _, _ = writer.Write(v) continue } n++ } if n != 0 { _, _ = writer.Write(source[l-n:]) } } func (d *defaultWriter) Write(writer util.BufWriter, source []byte) { escaped := false var ok bool limit := len(source) n := 0 for i := 0; i < limit; i++ { c := source[i] if escaped { if util.IsPunct(c) { d.RawWrite(writer, source[n:i-1]) n = i escaped = false continue } if d.EscapedSpace && c == ' ' { d.RawWrite(writer, source[n:i-1]) n = i + 1 escaped = false continue } } if c == '\x00' { d.RawWrite(writer, source[n:i]) d.RawWrite(writer, replacementCharacter) n = i + 1 escaped = false continue } if c == '&' { pos := i next := i + 1 if next < limit && source[next] == '#' { nnext := next + 1 if nnext < limit { nc := source[nnext] // code point like #x22; if nnext < limit && nc == 'x' || nc == 'X' { start := nnext + 1 i, ok = util.ReadWhile(source, [2]int{start, limit}, util.IsHexDecimal) if ok && i < limit && source[i] == ';' && i-start < 7 { v, _ := strconv.ParseUint(util.BytesToReadOnlyString(source[start:i]), 16, 32) d.RawWrite(writer, source[n:pos]) n = i + 1 escapeRune(writer, rune(v)) continue } // code point like #1234; } else if nc >= '0' && nc <= '9' { start := nnext i, ok = util.ReadWhile(source, [2]int{start, limit}, util.IsNumeric) if ok && i < limit && i-start < 8 && source[i] == ';' { v, _ := strconv.ParseUint(util.BytesToReadOnlyString(source[start:i]), 10, 32) d.RawWrite(writer, source[n:pos]) n = i + 1 escapeRune(writer, rune(v)) continue } } } } else { start := next i, ok = util.ReadWhile(source, [2]int{start, limit}, util.IsAlphaNumeric) // entity reference if ok && i < limit && source[i] == ';' { name := util.BytesToReadOnlyString(source[start:i]) entity, ok := util.LookUpHTML5EntityByName(name) if ok { d.RawWrite(writer, source[n:pos]) n = i + 1 d.RawWrite(writer, entity.Characters) continue } } } i = next - 1 } if c == '\\' { escaped = true continue } escaped = false } d.RawWrite(writer, source[n:]) } // DefaultWriter is a default instance of the Writer. var DefaultWriter = NewWriter() var bDataImage = []byte("data:image/") var bPng = []byte("png;") var bGif = []byte("gif;") var bJpeg = []byte("jpeg;") var bWebp = []byte("webp;") var bSvg = []byte("svg+xml;") var bJs = []byte("javascript:") var bVb = []byte("vbscript:") var bFile = []byte("file:") var bData = []byte("data:") func hasPrefix(s, prefix []byte) bool { return len(s) >= len(prefix) && bytes.Equal(bytes.ToLower(s[0:len(prefix)]), bytes.ToLower(prefix)) } // IsDangerousURL returns true if the given url seems a potentially dangerous url, // otherwise false. func IsDangerousURL(url []byte) bool { if hasPrefix(url, bDataImage) && len(url) >= 11 { v := url[11:] if hasPrefix(v, bPng) || hasPrefix(v, bGif) || hasPrefix(v, bJpeg) || hasPrefix(v, bWebp) || hasPrefix(v, bSvg) { return false } return true } return hasPrefix(url, bJs) || hasPrefix(url, bVb) || hasPrefix(url, bFile) || hasPrefix(url, bData) } goldmark-1.7.4/renderer/renderer.go000066400000000000000000000107731463655211100173020ustar00rootroot00000000000000// Package renderer renders the given AST to certain formats. package renderer import ( "bufio" "io" "sync" "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/util" ) // A Config struct is a data structure that holds configuration of the Renderer. type Config struct { Options map[OptionName]interface{} NodeRenderers util.PrioritizedSlice } // NewConfig returns a new Config. func NewConfig() *Config { return &Config{ Options: map[OptionName]interface{}{}, NodeRenderers: util.PrioritizedSlice{}, } } // An OptionName is a name of the option. type OptionName string // An Option interface is a functional option type for the Renderer. type Option interface { SetConfig(*Config) } type withNodeRenderers struct { value []util.PrioritizedValue } func (o *withNodeRenderers) SetConfig(c *Config) { c.NodeRenderers = append(c.NodeRenderers, o.value...) } // WithNodeRenderers is a functional option that allow you to add // NodeRenderers to the renderer. func WithNodeRenderers(ps ...util.PrioritizedValue) Option { return &withNodeRenderers{ps} } type withOption struct { name OptionName value interface{} } func (o *withOption) SetConfig(c *Config) { c.Options[o.name] = o.value } // WithOption is a functional option that allow you to set // an arbitrary option to the parser. func WithOption(name OptionName, value interface{}) Option { return &withOption{name, value} } // A SetOptioner interface sets given option to the object. type SetOptioner interface { // SetOption sets given option to the object. // Unacceptable options may be passed. // Thus implementations must ignore unacceptable options. SetOption(name OptionName, value interface{}) } // NodeRendererFunc is a function that renders a given node. type NodeRendererFunc func(writer util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error) // A NodeRenderer interface offers NodeRendererFuncs. type NodeRenderer interface { // RendererFuncs registers NodeRendererFuncs to given NodeRendererFuncRegisterer. RegisterFuncs(NodeRendererFuncRegisterer) } // A NodeRendererFuncRegisterer registers given NodeRendererFunc to this object. type NodeRendererFuncRegisterer interface { // Register registers given NodeRendererFunc to this object. Register(ast.NodeKind, NodeRendererFunc) } // A Renderer interface renders given AST node to given // writer with given Renderer. type Renderer interface { Render(w io.Writer, source []byte, n ast.Node) error // AddOptions adds given option to this renderer. AddOptions(...Option) } type renderer struct { config *Config options map[OptionName]interface{} nodeRendererFuncsTmp map[ast.NodeKind]NodeRendererFunc maxKind int nodeRendererFuncs []NodeRendererFunc initSync sync.Once } // NewRenderer returns a new Renderer with given options. func NewRenderer(options ...Option) Renderer { config := NewConfig() for _, opt := range options { opt.SetConfig(config) } r := &renderer{ options: map[OptionName]interface{}{}, config: config, nodeRendererFuncsTmp: map[ast.NodeKind]NodeRendererFunc{}, } return r } func (r *renderer) AddOptions(opts ...Option) { for _, opt := range opts { opt.SetConfig(r.config) } } func (r *renderer) Register(kind ast.NodeKind, v NodeRendererFunc) { r.nodeRendererFuncsTmp[kind] = v if int(kind) > r.maxKind { r.maxKind = int(kind) } } // Render renders the given AST node to the given writer with the given Renderer. func (r *renderer) Render(w io.Writer, source []byte, n ast.Node) error { r.initSync.Do(func() { r.options = r.config.Options r.config.NodeRenderers.Sort() l := len(r.config.NodeRenderers) for i := l - 1; i >= 0; i-- { v := r.config.NodeRenderers[i] nr, _ := v.Value.(NodeRenderer) if se, ok := v.Value.(SetOptioner); ok { for oname, ovalue := range r.options { se.SetOption(oname, ovalue) } } nr.RegisterFuncs(r) } r.nodeRendererFuncs = make([]NodeRendererFunc, r.maxKind+1) for kind, nr := range r.nodeRendererFuncsTmp { r.nodeRendererFuncs[kind] = nr } r.config = nil r.nodeRendererFuncsTmp = nil }) writer, ok := w.(util.BufWriter) if !ok { writer = bufio.NewWriter(w) } err := ast.Walk(n, func(n ast.Node, entering bool) (ast.WalkStatus, error) { s := ast.WalkStatus(ast.WalkContinue) var err error f := r.nodeRendererFuncs[n.Kind()] if f != nil { s, err = f(writer, source, n, entering) } return s, err }) if err != nil { return err } return writer.Flush() } goldmark-1.7.4/testutil/000077500000000000000000000000001463655211100152045ustar00rootroot00000000000000goldmark-1.7.4/testutil/testutil.go000066400000000000000000000214071463655211100174140ustar00rootroot00000000000000// Package testutil provides utilities for unit tests. package testutil import ( "bufio" "bytes" "encoding/hex" "encoding/json" "fmt" "os" "regexp" "runtime/debug" "strconv" "strings" "github.com/yuin/goldmark" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/util" ) // TestingT is a subset of the functionality provided by testing.T. type TestingT interface { Logf(string, ...interface{}) Skipf(string, ...interface{}) Errorf(string, ...interface{}) FailNow() } // MarkdownTestCase represents a test case. type MarkdownTestCase struct { No int Description string Options MarkdownTestCaseOptions Markdown string Expected string } func source(t *MarkdownTestCase) string { ret := t.Markdown if t.Options.Trim { ret = strings.TrimSpace(ret) } if t.Options.EnableEscape { return string(applyEscapeSequence([]byte(ret))) } return ret } func expected(t *MarkdownTestCase) string { ret := t.Expected if t.Options.Trim { ret = strings.TrimSpace(ret) } if t.Options.EnableEscape { return string(applyEscapeSequence([]byte(ret))) } return ret } // MarkdownTestCaseOptions represents options for each test case. type MarkdownTestCaseOptions struct { EnableEscape bool Trim bool } const attributeSeparator = "//- - - - - - - - -//" const caseSeparator = "//= = = = = = = = = = = = = = = = = = = = = = = =//" var optionsRegexp = regexp.MustCompile(`(?i)\s*options:(.*)`) // ParseCliCaseArg parses -case command line args. func ParseCliCaseArg() []int { ret := []int{} for _, a := range os.Args { if strings.HasPrefix(a, "case=") { parts := strings.Split(a, "=") for _, cas := range strings.Split(parts[1], ",") { value, err := strconv.Atoi(strings.TrimSpace(cas)) if err == nil { ret = append(ret, value) } } } } return ret } // DoTestCaseFile runs test cases in a given file. func DoTestCaseFile(m goldmark.Markdown, filename string, t TestingT, no ...int) { fp, err := os.Open(filename) if err != nil { panic(err) } defer func() { _ = fp.Close() }() scanner := bufio.NewScanner(fp) c := MarkdownTestCase{ No: -1, Description: "", Options: MarkdownTestCaseOptions{}, Markdown: "", Expected: "", } cases := []MarkdownTestCase{} line := 0 for scanner.Scan() { line++ if util.IsBlank([]byte(scanner.Text())) { continue } header := scanner.Text() c.Description = "" if strings.Contains(header, ":") { parts := strings.Split(header, ":") c.No, err = strconv.Atoi(strings.TrimSpace(parts[0])) c.Description = strings.Join(parts[1:], ":") } else { c.No, err = strconv.Atoi(scanner.Text()) } if err != nil { panic(fmt.Sprintf("%s: invalid case No at line %d", filename, line)) } if !scanner.Scan() { panic(fmt.Sprintf("%s: invalid case at line %d", filename, line)) } line++ matches := optionsRegexp.FindAllStringSubmatch(scanner.Text(), -1) if len(matches) != 0 { err = json.Unmarshal([]byte(matches[0][1]), &c.Options) if err != nil { panic(fmt.Sprintf("%s: invalid options at line %d", filename, line)) } scanner.Scan() line++ } if scanner.Text() != attributeSeparator { panic(fmt.Sprintf("%s: invalid separator '%s' at line %d", filename, scanner.Text(), line)) } buf := []string{} for scanner.Scan() { line++ text := scanner.Text() if text == attributeSeparator { break } buf = append(buf, text) } c.Markdown = strings.Join(buf, "\n") buf = []string{} for scanner.Scan() { line++ text := scanner.Text() if text == caseSeparator { break } buf = append(buf, text) } c.Expected = strings.Join(buf, "\n") if len(c.Expected) != 0 { c.Expected = c.Expected + "\n" } shouldAdd := len(no) == 0 if !shouldAdd { for _, n := range no { if n == c.No { shouldAdd = true break } } } if shouldAdd { cases = append(cases, c) } } DoTestCases(m, cases, t) } // DoTestCases runs a set of test cases. func DoTestCases(m goldmark.Markdown, cases []MarkdownTestCase, t TestingT, opts ...parser.ParseOption) { for _, testCase := range cases { DoTestCase(m, testCase, t, opts...) } } // DoTestCase runs a test case. func DoTestCase(m goldmark.Markdown, testCase MarkdownTestCase, t TestingT, opts ...parser.ParseOption) { var ok bool var out bytes.Buffer defer func() { description := "" if len(testCase.Description) != 0 { description = ": " + testCase.Description } if err := recover(); err != nil { format := `============= case %d%s ================ Markdown: ----------- %s Expected: ---------- %s Actual --------- %v %s ` t.Errorf(format, testCase.No, description, source(&testCase), expected(&testCase), err, debug.Stack()) } else if !ok { format := `============= case %d%s ================ Markdown: ----------- %s Expected: ---------- %s Actual --------- %s Diff --------- %s ` t.Errorf(format, testCase.No, description, source(&testCase), expected(&testCase), out.Bytes(), DiffPretty([]byte(expected(&testCase)), out.Bytes())) } }() if err := m.Convert([]byte(source(&testCase)), &out, opts...); err != nil { panic(err) } ok = bytes.Equal(bytes.TrimSpace(out.Bytes()), bytes.TrimSpace([]byte(expected(&testCase)))) } type diffType int const ( diffRemoved diffType = iota diffAdded diffNone ) type diff struct { Type diffType Lines [][]byte } func simpleDiff(v1, v2 []byte) []diff { return simpleDiffAux( bytes.Split(v1, []byte("\n")), bytes.Split(v2, []byte("\n"))) } func simpleDiffAux(v1lines, v2lines [][]byte) []diff { v1index := map[string][]int{} for i, line := range v1lines { key := util.BytesToReadOnlyString(line) if _, ok := v1index[key]; !ok { v1index[key] = []int{} } v1index[key] = append(v1index[key], i) } overlap := map[int]int{} v1start := 0 v2start := 0 length := 0 for v2pos, line := range v2lines { newOverlap := map[int]int{} key := util.BytesToReadOnlyString(line) if _, ok := v1index[key]; !ok { v1index[key] = []int{} } for _, v1pos := range v1index[key] { value := 0 if v1pos != 0 { if v, ok := overlap[v1pos-1]; ok { value = v } } newOverlap[v1pos] = value + 1 if newOverlap[v1pos] > length { length = newOverlap[v1pos] v1start = v1pos - length + 1 v2start = v2pos - length + 1 } } overlap = newOverlap } if length == 0 { diffs := []diff{} if len(v1lines) != 0 { diffs = append(diffs, diff{diffRemoved, v1lines}) } if len(v2lines) != 0 { diffs = append(diffs, diff{diffAdded, v2lines}) } return diffs } diffs := simpleDiffAux(v1lines[:v1start], v2lines[:v2start]) diffs = append(diffs, diff{diffNone, v2lines[v2start : v2start+length]}) diffs = append(diffs, simpleDiffAux(v1lines[v1start+length:], v2lines[v2start+length:])...) return diffs } // DiffPretty returns pretty formatted diff between given bytes. func DiffPretty(v1, v2 []byte) []byte { var b bytes.Buffer diffs := simpleDiff(v1, v2) for _, diff := range diffs { c := " " switch diff.Type { case diffAdded: c = "+" case diffRemoved: c = "-" case diffNone: c = " " } for _, line := range diff.Lines { if c != " " { b.WriteString(fmt.Sprintf("%s | %s\n", c, util.VisualizeSpaces(line))) } else { b.WriteString(fmt.Sprintf("%s | %s\n", c, line)) } } } return b.Bytes() } func applyEscapeSequence(b []byte) []byte { result := make([]byte, 0, len(b)) for i := 0; i < len(b); i++ { if b[i] == '\\' && i != len(b)-1 { switch b[i+1] { case 'a': result = append(result, '\a') i++ continue case 'b': result = append(result, '\b') i++ continue case 'f': result = append(result, '\f') i++ continue case 'n': result = append(result, '\n') i++ continue case 'r': result = append(result, '\r') i++ continue case 't': result = append(result, '\t') i++ continue case 'v': result = append(result, '\v') i++ continue case '\\': result = append(result, '\\') i++ continue case 'x': if len(b) >= i+3 && util.IsHexDecimal(b[i+2]) && util.IsHexDecimal(b[i+3]) { v, _ := hex.DecodeString(string(b[i+2 : i+4])) result = append(result, v[0]) i += 3 continue } case 'u', 'U': if len(b) > i+2 { num := []byte{} for j := i + 2; j < len(b); j++ { if util.IsHexDecimal(b[j]) { num = append(num, b[j]) continue } break } if len(num) >= 4 && len(num) < 8 { v, _ := strconv.ParseInt(string(num[:4]), 16, 32) result = append(result, []byte(string(rune(v)))...) i += 5 continue } if len(num) >= 8 { v, _ := strconv.ParseInt(string(num[:8]), 16, 32) result = append(result, []byte(string(rune(v)))...) i += 9 continue } } } } result = append(result, b[i]) } return result } goldmark-1.7.4/testutil/testutil_test.go000066400000000000000000000002701463655211100204460ustar00rootroot00000000000000package testutil import "testing" // This will fail to compile if the TestingT interface is changed in a way // that doesn't conform to testing.T. var _ TestingT = (*testing.T)(nil) goldmark-1.7.4/text/000077500000000000000000000000001463655211100143135ustar00rootroot00000000000000goldmark-1.7.4/text/package.go000066400000000000000000000001131463655211100162300ustar00rootroot00000000000000// Package text provides functionalities to manipulate texts. package text goldmark-1.7.4/text/reader.go000066400000000000000000000324511463655211100161110ustar00rootroot00000000000000package text import ( "bytes" "io" "regexp" "unicode/utf8" "github.com/yuin/goldmark/util" ) const invalidValue = -1 // EOF indicates the end of file. const EOF = byte(0xff) // A Reader interface provides abstracted method for reading text. type Reader interface { io.RuneReader // Source returns a source of the reader. Source() []byte // ResetPosition resets positions. ResetPosition() // Peek returns a byte at current position without advancing the internal pointer. Peek() byte // PeekLine returns the current line without advancing the internal pointer. PeekLine() ([]byte, Segment) // PrecendingCharacter returns a character just before current internal pointer. PrecendingCharacter() rune // Value returns a value of the given segment. Value(Segment) []byte // LineOffset returns a distance from the line head to current position. LineOffset() int // Position returns current line number and position. Position() (int, Segment) // SetPosition sets current line number and position. SetPosition(int, Segment) // SetPadding sets padding to the reader. SetPadding(int) // Advance advances the internal pointer. Advance(int) // AdvanceAndSetPadding advances the internal pointer and add padding to the // reader. AdvanceAndSetPadding(int, int) // AdvanceLine advances the internal pointer to the next line head. AdvanceLine() // SkipSpaces skips space characters and returns a non-blank line. // If it reaches EOF, returns false. SkipSpaces() (Segment, int, bool) // SkipSpaces skips blank lines and returns a non-blank line. // If it reaches EOF, returns false. SkipBlankLines() (Segment, int, bool) // Match performs regular expression matching to current line. Match(reg *regexp.Regexp) bool // Match performs regular expression searching to current line. FindSubMatch(reg *regexp.Regexp) [][]byte // FindClosure finds corresponding closure. FindClosure(opener, closer byte, options FindClosureOptions) (*Segments, bool) } // FindClosureOptions is options for Reader.FindClosure. type FindClosureOptions struct { // CodeSpan is a flag for the FindClosure. If this is set to true, // FindClosure ignores closers in codespans. CodeSpan bool // Nesting is a flag for the FindClosure. If this is set to true, // FindClosure allows nesting. Nesting bool // Newline is a flag for the FindClosure. If this is set to true, // FindClosure searches for a closer over multiple lines. Newline bool // Advance is a flag for the FindClosure. If this is set to true, // FindClosure advances pointers when closer is found. Advance bool } type reader struct { source []byte sourceLength int line int peekedLine []byte pos Segment head int lineOffset int } // NewReader return a new Reader that can read UTF-8 bytes . func NewReader(source []byte) Reader { r := &reader{ source: source, sourceLength: len(source), } r.ResetPosition() return r } func (r *reader) FindClosure(opener, closer byte, options FindClosureOptions) (*Segments, bool) { return findClosureReader(r, opener, closer, options) } func (r *reader) ResetPosition() { r.line = -1 r.head = 0 r.lineOffset = -1 r.AdvanceLine() } func (r *reader) Source() []byte { return r.source } func (r *reader) Value(seg Segment) []byte { return seg.Value(r.source) } func (r *reader) Peek() byte { if r.pos.Start >= 0 && r.pos.Start < r.sourceLength { if r.pos.Padding != 0 { return space[0] } return r.source[r.pos.Start] } return EOF } func (r *reader) PeekLine() ([]byte, Segment) { if r.pos.Start >= 0 && r.pos.Start < r.sourceLength { if r.peekedLine == nil { r.peekedLine = r.pos.Value(r.Source()) } return r.peekedLine, r.pos } return nil, r.pos } // io.RuneReader interface. func (r *reader) ReadRune() (rune, int, error) { return readRuneReader(r) } func (r *reader) LineOffset() int { if r.lineOffset < 0 { v := 0 for i := r.head; i < r.pos.Start; i++ { if r.source[i] == '\t' { v += util.TabWidth(v) } else { v++ } } r.lineOffset = v - r.pos.Padding } return r.lineOffset } func (r *reader) PrecendingCharacter() rune { if r.pos.Start <= 0 { if r.pos.Padding != 0 { return rune(' ') } return rune('\n') } i := r.pos.Start - 1 for ; i >= 0; i-- { if utf8.RuneStart(r.source[i]) { break } } rn, _ := utf8.DecodeRune(r.source[i:]) return rn } func (r *reader) Advance(n int) { r.lineOffset = -1 if n < len(r.peekedLine) && r.pos.Padding == 0 { r.pos.Start += n r.peekedLine = nil return } r.peekedLine = nil l := r.sourceLength for ; n > 0 && r.pos.Start < l; n-- { if r.pos.Padding != 0 { r.pos.Padding-- continue } if r.source[r.pos.Start] == '\n' { r.AdvanceLine() continue } r.pos.Start++ } } func (r *reader) AdvanceAndSetPadding(n, padding int) { r.Advance(n) if padding > r.pos.Padding { r.SetPadding(padding) } } func (r *reader) AdvanceLine() { r.lineOffset = -1 r.peekedLine = nil r.pos.Start = r.pos.Stop r.head = r.pos.Start if r.pos.Start < 0 { return } r.pos.Stop = r.sourceLength for i := r.pos.Start; i < r.sourceLength; i++ { c := r.source[i] if c == '\n' { r.pos.Stop = i + 1 break } } r.line++ r.pos.Padding = 0 } func (r *reader) Position() (int, Segment) { return r.line, r.pos } func (r *reader) SetPosition(line int, pos Segment) { r.lineOffset = -1 r.line = line r.pos = pos } func (r *reader) SetPadding(v int) { r.pos.Padding = v } func (r *reader) SkipSpaces() (Segment, int, bool) { return skipSpacesReader(r) } func (r *reader) SkipBlankLines() (Segment, int, bool) { return skipBlankLinesReader(r) } func (r *reader) Match(reg *regexp.Regexp) bool { return matchReader(r, reg) } func (r *reader) FindSubMatch(reg *regexp.Regexp) [][]byte { return findSubMatchReader(r, reg) } // A BlockReader interface is a reader that is optimized for Blocks. type BlockReader interface { Reader // Reset resets current state and sets new segments to the reader. Reset(segment *Segments) } type blockReader struct { source []byte segments *Segments segmentsLength int line int pos Segment head int last int lineOffset int } // NewBlockReader returns a new BlockReader. func NewBlockReader(source []byte, segments *Segments) BlockReader { r := &blockReader{ source: source, } if segments != nil { r.Reset(segments) } return r } func (r *blockReader) FindClosure(opener, closer byte, options FindClosureOptions) (*Segments, bool) { return findClosureReader(r, opener, closer, options) } func (r *blockReader) ResetPosition() { r.line = -1 r.head = 0 r.last = 0 r.lineOffset = -1 r.pos.Start = -1 r.pos.Stop = -1 r.pos.Padding = 0 if r.segmentsLength > 0 { last := r.segments.At(r.segmentsLength - 1) r.last = last.Stop } r.AdvanceLine() } func (r *blockReader) Reset(segments *Segments) { r.segments = segments r.segmentsLength = segments.Len() r.ResetPosition() } func (r *blockReader) Source() []byte { return r.source } func (r *blockReader) Value(seg Segment) []byte { line := r.segmentsLength - 1 ret := make([]byte, 0, seg.Stop-seg.Start+1) for ; line >= 0; line-- { if seg.Start >= r.segments.At(line).Start { break } } i := seg.Start for ; line < r.segmentsLength; line++ { s := r.segments.At(line) if i < 0 { i = s.Start } ret = s.ConcatPadding(ret) for ; i < seg.Stop && i < s.Stop; i++ { ret = append(ret, r.source[i]) } i = -1 if s.Stop > seg.Stop { break } } return ret } // io.RuneReader interface. func (r *blockReader) ReadRune() (rune, int, error) { return readRuneReader(r) } func (r *blockReader) PrecendingCharacter() rune { if r.pos.Padding != 0 { return rune(' ') } if r.segments.Len() < 1 { return rune('\n') } firstSegment := r.segments.At(0) if r.line == 0 && r.pos.Start <= firstSegment.Start { return rune('\n') } l := len(r.source) i := r.pos.Start - 1 for ; i < l && i >= 0; i-- { if utf8.RuneStart(r.source[i]) { break } } if i < 0 || i >= l { return rune('\n') } rn, _ := utf8.DecodeRune(r.source[i:]) return rn } func (r *blockReader) LineOffset() int { if r.lineOffset < 0 { v := 0 for i := r.head; i < r.pos.Start; i++ { if r.source[i] == '\t' { v += util.TabWidth(v) } else { v++ } } r.lineOffset = v - r.pos.Padding } return r.lineOffset } func (r *blockReader) Peek() byte { if r.line < r.segmentsLength && r.pos.Start >= 0 && r.pos.Start < r.last { if r.pos.Padding != 0 { return space[0] } return r.source[r.pos.Start] } return EOF } func (r *blockReader) PeekLine() ([]byte, Segment) { if r.line < r.segmentsLength && r.pos.Start >= 0 && r.pos.Start < r.last { return r.pos.Value(r.source), r.pos } return nil, r.pos } func (r *blockReader) Advance(n int) { r.lineOffset = -1 if n < r.pos.Stop-r.pos.Start && r.pos.Padding == 0 { r.pos.Start += n return } for ; n > 0; n-- { if r.pos.Padding != 0 { r.pos.Padding-- continue } if r.pos.Start >= r.pos.Stop-1 && r.pos.Stop < r.last { r.AdvanceLine() continue } r.pos.Start++ } } func (r *blockReader) AdvanceAndSetPadding(n, padding int) { r.Advance(n) if padding > r.pos.Padding { r.SetPadding(padding) } } func (r *blockReader) AdvanceLine() { r.SetPosition(r.line+1, NewSegment(invalidValue, invalidValue)) r.head = r.pos.Start } func (r *blockReader) Position() (int, Segment) { return r.line, r.pos } func (r *blockReader) SetPosition(line int, pos Segment) { r.lineOffset = -1 r.line = line if pos.Start == invalidValue { if r.line < r.segmentsLength { s := r.segments.At(line) r.head = s.Start r.pos = s } } else { r.pos = pos if r.line < r.segmentsLength { s := r.segments.At(line) r.head = s.Start } } } func (r *blockReader) SetPadding(v int) { r.lineOffset = -1 r.pos.Padding = v } func (r *blockReader) SkipSpaces() (Segment, int, bool) { return skipSpacesReader(r) } func (r *blockReader) SkipBlankLines() (Segment, int, bool) { return skipBlankLinesReader(r) } func (r *blockReader) Match(reg *regexp.Regexp) bool { return matchReader(r, reg) } func (r *blockReader) FindSubMatch(reg *regexp.Regexp) [][]byte { return findSubMatchReader(r, reg) } func skipBlankLinesReader(r Reader) (Segment, int, bool) { lines := 0 for { line, seg := r.PeekLine() if line == nil { return seg, lines, false } if util.IsBlank(line) { lines++ r.AdvanceLine() } else { return seg, lines, true } } } func skipSpacesReader(r Reader) (Segment, int, bool) { chars := 0 for { line, segment := r.PeekLine() if line == nil { return segment, chars, false } for i, c := range line { if util.IsSpace(c) { chars++ r.Advance(1) continue } return segment.WithStart(segment.Start + i + 1), chars, true } } } func matchReader(r Reader, reg *regexp.Regexp) bool { oldline, oldseg := r.Position() match := reg.FindReaderSubmatchIndex(r) r.SetPosition(oldline, oldseg) if match == nil { return false } r.Advance(match[1] - match[0]) return true } func findSubMatchReader(r Reader, reg *regexp.Regexp) [][]byte { oldLine, oldSeg := r.Position() match := reg.FindReaderSubmatchIndex(r) r.SetPosition(oldLine, oldSeg) if match == nil { return nil } var bb bytes.Buffer bb.Grow(match[1] - match[0]) for i := 0; i < match[1]; { r, size, _ := readRuneReader(r) i += size bb.WriteRune(r) } bs := bb.Bytes() var result [][]byte for i := 0; i < len(match); i += 2 { if match[i] < 0 { result = append(result, []byte{}) continue } result = append(result, bs[match[i]:match[i+1]]) } r.SetPosition(oldLine, oldSeg) r.Advance(match[1] - match[0]) return result } func readRuneReader(r Reader) (rune, int, error) { line, _ := r.PeekLine() if line == nil { return 0, 0, io.EOF } rn, size := utf8.DecodeRune(line) if rn == utf8.RuneError { return 0, 0, io.EOF } r.Advance(size) return rn, size, nil } func findClosureReader(r Reader, opener, closer byte, opts FindClosureOptions) (*Segments, bool) { opened := 1 codeSpanOpener := 0 closed := false orgline, orgpos := r.Position() var ret *Segments for { bs, seg := r.PeekLine() if bs == nil { goto end } i := 0 for i < len(bs) { c := bs[i] if opts.CodeSpan && codeSpanOpener != 0 && c == '`' { codeSpanCloser := 0 for ; i < len(bs); i++ { if bs[i] == '`' { codeSpanCloser++ } else { i-- break } } if codeSpanCloser == codeSpanOpener { codeSpanOpener = 0 } } else if codeSpanOpener == 0 && c == '\\' && i < len(bs)-1 && util.IsPunct(bs[i+1]) { i += 2 continue } else if opts.CodeSpan && codeSpanOpener == 0 && c == '`' { for ; i < len(bs); i++ { if bs[i] == '`' { codeSpanOpener++ } else { i-- break } } } else if (opts.CodeSpan && codeSpanOpener == 0) || !opts.CodeSpan { if c == closer { opened-- if opened == 0 { if ret == nil { ret = NewSegments() } ret.Append(seg.WithStop(seg.Start + i)) r.Advance(i + 1) closed = true goto end } } else if c == opener { if !opts.Nesting { goto end } opened++ } } i++ } if !opts.Newline { goto end } r.AdvanceLine() if ret == nil { ret = NewSegments() } ret.Append(seg) } end: if !opts.Advance { r.SetPosition(orgline, orgpos) } if closed { return ret, true } return nil, false } goldmark-1.7.4/text/reader_test.go000066400000000000000000000004461463655211100171470ustar00rootroot00000000000000package text import ( "regexp" "testing" ) func TestFindSubMatchReader(t *testing.T) { s := "微笑" r := NewReader([]byte(":" + s + ":")) reg := regexp.MustCompile(`:(\p{L}+):`) match := r.FindSubMatch(reg) if len(match) != 2 || string(match[1]) != s { t.Fatal("no match cjk") } } goldmark-1.7.4/text/segment.go000066400000000000000000000113701463655211100163060ustar00rootroot00000000000000package text import ( "bytes" "github.com/yuin/goldmark/util" ) var space = []byte(" ") // A Segment struct holds information about source positions. type Segment struct { // Start is a start position of the segment. Start int // Stop is a stop position of the segment. // This value should be excluded. Stop int // Padding is a padding length of the segment. Padding int } // NewSegment return a new Segment. func NewSegment(start, stop int) Segment { return Segment{ Start: start, Stop: stop, Padding: 0, } } // NewSegmentPadding returns a new Segment with the given padding. func NewSegmentPadding(start, stop, n int) Segment { return Segment{ Start: start, Stop: stop, Padding: n, } } // Value returns a value of the segment. func (t *Segment) Value(buffer []byte) []byte { if t.Padding == 0 { return buffer[t.Start:t.Stop] } result := make([]byte, 0, t.Padding+t.Stop-t.Start+1) result = append(result, bytes.Repeat(space, t.Padding)...) return append(result, buffer[t.Start:t.Stop]...) } // Len returns a length of the segment. func (t *Segment) Len() int { return t.Stop - t.Start + t.Padding } // Between returns a segment between this segment and the given segment. func (t *Segment) Between(other Segment) Segment { if t.Stop != other.Stop { panic("invalid state") } return NewSegmentPadding( t.Start, other.Start, t.Padding-other.Padding, ) } // IsEmpty returns true if this segment is empty, otherwise false. func (t *Segment) IsEmpty() bool { return t.Start >= t.Stop && t.Padding == 0 } // TrimRightSpace returns a new segment by slicing off all trailing // space characters. func (t *Segment) TrimRightSpace(buffer []byte) Segment { v := buffer[t.Start:t.Stop] l := util.TrimRightSpaceLength(v) if l == len(v) { return NewSegment(t.Start, t.Start) } return NewSegmentPadding(t.Start, t.Stop-l, t.Padding) } // TrimLeftSpace returns a new segment by slicing off all leading // space characters including padding. func (t *Segment) TrimLeftSpace(buffer []byte) Segment { v := buffer[t.Start:t.Stop] l := util.TrimLeftSpaceLength(v) return NewSegment(t.Start+l, t.Stop) } // TrimLeftSpaceWidth returns a new segment by slicing off leading space // characters until the given width. func (t *Segment) TrimLeftSpaceWidth(width int, buffer []byte) Segment { padding := t.Padding for ; width > 0; width-- { if padding == 0 { break } padding-- } if width == 0 { return NewSegmentPadding(t.Start, t.Stop, padding) } text := buffer[t.Start:t.Stop] start := t.Start for _, c := range text { if start >= t.Stop-1 || width <= 0 { break } if c == ' ' { width-- } else if c == '\t' { width -= 4 } else { break } start++ } if width < 0 { padding = width * -1 } return NewSegmentPadding(start, t.Stop, padding) } // WithStart returns a new Segment with same value except Start. func (t *Segment) WithStart(v int) Segment { return NewSegmentPadding(v, t.Stop, t.Padding) } // WithStop returns a new Segment with same value except Stop. func (t *Segment) WithStop(v int) Segment { return NewSegmentPadding(t.Start, v, t.Padding) } // ConcatPadding concats the padding to the given slice. func (t *Segment) ConcatPadding(v []byte) []byte { if t.Padding > 0 { return append(v, bytes.Repeat(space, t.Padding)...) } return v } // Segments is a collection of the Segment. type Segments struct { values []Segment } // NewSegments return a new Segments. func NewSegments() *Segments { return &Segments{ values: nil, } } // Append appends the given segment after the tail of the collection. func (s *Segments) Append(t Segment) { if s.values == nil { s.values = make([]Segment, 0, 20) } s.values = append(s.values, t) } // AppendAll appends all elements of given segments after the tail of the collection. func (s *Segments) AppendAll(t []Segment) { if s.values == nil { s.values = make([]Segment, 0, 20) } s.values = append(s.values, t...) } // Len returns the length of the collection. func (s *Segments) Len() int { if s.values == nil { return 0 } return len(s.values) } // At returns a segment at the given index. func (s *Segments) At(i int) Segment { return s.values[i] } // Set sets the given Segment. func (s *Segments) Set(i int, v Segment) { s.values[i] = v } // SetSliced replace the collection with a subsliced value. func (s *Segments) SetSliced(lo, hi int) { s.values = s.values[lo:hi] } // Sliced returns a subslice of the collection. func (s *Segments) Sliced(lo, hi int) []Segment { return s.values[lo:hi] } // Clear delete all element of the collection. func (s *Segments) Clear() { s.values = nil } // Unshift insert the given Segment to head of the collection. func (s *Segments) Unshift(v Segment) { s.values = append(s.values[0:1], s.values[0:]...) s.values[0] = v } goldmark-1.7.4/util/000077500000000000000000000000001463655211100143045ustar00rootroot00000000000000goldmark-1.7.4/util/html5entities.go000066400000000000000000007504121463655211100174420ustar00rootroot00000000000000//nolint:golint,lll,misspell package util // An HTML5Entity struct represents HTML5 entitites. type HTML5Entity struct { Name string CodePoints []int Characters []byte } // LookUpHTML5EntityByName returns (an HTML5Entity, true) if an entity named // given name is found, otherwise (nil, false). func LookUpHTML5EntityByName(name string) (*HTML5Entity, bool) { v, ok := html5entities[name] return v, ok } var html5entities = map[string]*HTML5Entity{ "AElig": {Name: "AElig", CodePoints: []int{198}, Characters: []byte{0xc3, 0x86}}, "AMP": {Name: "AMP", CodePoints: []int{38}, Characters: []byte{0x26}}, "Aacute": {Name: "Aacute", CodePoints: []int{193}, Characters: []byte{0xc3, 0x81}}, "Acirc": {Name: "Acirc", CodePoints: []int{194}, Characters: []byte{0xc3, 0x82}}, "Acy": {Name: "Acy", CodePoints: []int{1040}, Characters: []byte{0xd0, 0x90}}, "Afr": {Name: "Afr", CodePoints: []int{120068}, Characters: []byte{0xf0, 0x9d, 0x94, 0x84}}, "Agrave": {Name: "Agrave", CodePoints: []int{192}, Characters: []byte{0xc3, 0x80}}, "Alpha": {Name: "Alpha", CodePoints: []int{913}, Characters: []byte{0xce, 0x91}}, "Amacr": {Name: "Amacr", CodePoints: []int{256}, Characters: []byte{0xc4, 0x80}}, "And": {Name: "And", CodePoints: []int{10835}, Characters: []byte{0xe2, 0xa9, 0x93}}, "Aogon": {Name: "Aogon", CodePoints: []int{260}, Characters: []byte{0xc4, 0x84}}, "Aopf": {Name: "Aopf", CodePoints: []int{120120}, Characters: []byte{0xf0, 0x9d, 0x94, 0xb8}}, "ApplyFunction": {Name: "ApplyFunction", CodePoints: []int{8289}, Characters: []byte{0xe2, 0x81, 0xa1}}, "Aring": {Name: "Aring", CodePoints: []int{197}, Characters: []byte{0xc3, 0x85}}, "Ascr": {Name: "Ascr", CodePoints: []int{119964}, Characters: []byte{0xf0, 0x9d, 0x92, 0x9c}}, "Assign": {Name: "Assign", CodePoints: []int{8788}, Characters: []byte{0xe2, 0x89, 0x94}}, "Atilde": {Name: "Atilde", CodePoints: []int{195}, Characters: []byte{0xc3, 0x83}}, "Auml": {Name: "Auml", CodePoints: []int{196}, Characters: []byte{0xc3, 0x84}}, "Backslash": {Name: "Backslash", CodePoints: []int{8726}, Characters: []byte{0xe2, 0x88, 0x96}}, "Barv": {Name: "Barv", CodePoints: []int{10983}, Characters: []byte{0xe2, 0xab, 0xa7}}, "Barwed": {Name: "Barwed", CodePoints: []int{8966}, Characters: []byte{0xe2, 0x8c, 0x86}}, "Bcy": {Name: "Bcy", CodePoints: []int{1041}, Characters: []byte{0xd0, 0x91}}, "Because": {Name: "Because", CodePoints: []int{8757}, Characters: []byte{0xe2, 0x88, 0xb5}}, "Bernoullis": {Name: "Bernoullis", CodePoints: []int{8492}, Characters: []byte{0xe2, 0x84, 0xac}}, "Beta": {Name: "Beta", CodePoints: []int{914}, Characters: []byte{0xce, 0x92}}, "Bfr": {Name: "Bfr", CodePoints: []int{120069}, Characters: []byte{0xf0, 0x9d, 0x94, 0x85}}, "Bopf": {Name: "Bopf", CodePoints: []int{120121}, Characters: []byte{0xf0, 0x9d, 0x94, 0xb9}}, "Breve": {Name: "Breve", CodePoints: []int{728}, Characters: []byte{0xcb, 0x98}}, "Bscr": {Name: "Bscr", CodePoints: []int{8492}, Characters: []byte{0xe2, 0x84, 0xac}}, "Bumpeq": {Name: "Bumpeq", CodePoints: []int{8782}, Characters: []byte{0xe2, 0x89, 0x8e}}, "CHcy": {Name: "CHcy", CodePoints: []int{1063}, Characters: []byte{0xd0, 0xa7}}, "COPY": {Name: "COPY", CodePoints: []int{169}, Characters: []byte{0xc2, 0xa9}}, "Cacute": {Name: "Cacute", CodePoints: []int{262}, Characters: []byte{0xc4, 0x86}}, "Cap": {Name: "Cap", CodePoints: []int{8914}, Characters: []byte{0xe2, 0x8b, 0x92}}, "CapitalDifferentialD": {Name: "CapitalDifferentialD", CodePoints: []int{8517}, Characters: []byte{0xe2, 0x85, 0x85}}, "Cayleys": {Name: "Cayleys", CodePoints: []int{8493}, Characters: []byte{0xe2, 0x84, 0xad}}, "Ccaron": {Name: "Ccaron", CodePoints: []int{268}, Characters: []byte{0xc4, 0x8c}}, "Ccedil": {Name: "Ccedil", CodePoints: []int{199}, Characters: []byte{0xc3, 0x87}}, "Ccirc": {Name: "Ccirc", CodePoints: []int{264}, Characters: []byte{0xc4, 0x88}}, "Cconint": {Name: "Cconint", CodePoints: []int{8752}, Characters: []byte{0xe2, 0x88, 0xb0}}, "Cdot": {Name: "Cdot", CodePoints: []int{266}, Characters: []byte{0xc4, 0x8a}}, "Cedilla": {Name: "Cedilla", CodePoints: []int{184}, Characters: []byte{0xc2, 0xb8}}, "CenterDot": {Name: "CenterDot", CodePoints: []int{183}, Characters: []byte{0xc2, 0xb7}}, "Cfr": {Name: "Cfr", CodePoints: []int{8493}, Characters: []byte{0xe2, 0x84, 0xad}}, "Chi": {Name: "Chi", CodePoints: []int{935}, Characters: []byte{0xce, 0xa7}}, "CircleDot": {Name: "CircleDot", CodePoints: []int{8857}, Characters: []byte{0xe2, 0x8a, 0x99}}, "CircleMinus": {Name: "CircleMinus", CodePoints: []int{8854}, Characters: []byte{0xe2, 0x8a, 0x96}}, "CirclePlus": {Name: "CirclePlus", CodePoints: []int{8853}, Characters: []byte{0xe2, 0x8a, 0x95}}, "CircleTimes": {Name: "CircleTimes", CodePoints: []int{8855}, Characters: []byte{0xe2, 0x8a, 0x97}}, "ClockwiseContourIntegral": {Name: "ClockwiseContourIntegral", CodePoints: []int{8754}, Characters: []byte{0xe2, 0x88, 0xb2}}, "CloseCurlyDoubleQuote": {Name: "CloseCurlyDoubleQuote", CodePoints: []int{8221}, Characters: []byte{0xe2, 0x80, 0x9d}}, "CloseCurlyQuote": {Name: "CloseCurlyQuote", CodePoints: []int{8217}, Characters: []byte{0xe2, 0x80, 0x99}}, "Colon": {Name: "Colon", CodePoints: []int{8759}, Characters: []byte{0xe2, 0x88, 0xb7}}, "Colone": {Name: "Colone", CodePoints: []int{10868}, Characters: []byte{0xe2, 0xa9, 0xb4}}, "Congruent": {Name: "Congruent", CodePoints: []int{8801}, Characters: []byte{0xe2, 0x89, 0xa1}}, "Conint": {Name: "Conint", CodePoints: []int{8751}, Characters: []byte{0xe2, 0x88, 0xaf}}, "ContourIntegral": {Name: "ContourIntegral", CodePoints: []int{8750}, Characters: []byte{0xe2, 0x88, 0xae}}, "Copf": {Name: "Copf", CodePoints: []int{8450}, Characters: []byte{0xe2, 0x84, 0x82}}, "Coproduct": {Name: "Coproduct", CodePoints: []int{8720}, Characters: []byte{0xe2, 0x88, 0x90}}, "CounterClockwiseContourIntegral": {Name: "CounterClockwiseContourIntegral", CodePoints: []int{8755}, Characters: []byte{0xe2, 0x88, 0xb3}}, "Cross": {Name: "Cross", CodePoints: []int{10799}, Characters: []byte{0xe2, 0xa8, 0xaf}}, "Cscr": {Name: "Cscr", CodePoints: []int{119966}, Characters: []byte{0xf0, 0x9d, 0x92, 0x9e}}, "Cup": {Name: "Cup", CodePoints: []int{8915}, Characters: []byte{0xe2, 0x8b, 0x93}}, "CupCap": {Name: "CupCap", CodePoints: []int{8781}, Characters: []byte{0xe2, 0x89, 0x8d}}, "DD": {Name: "DD", CodePoints: []int{8517}, Characters: []byte{0xe2, 0x85, 0x85}}, "DDotrahd": {Name: "DDotrahd", CodePoints: []int{10513}, Characters: []byte{0xe2, 0xa4, 0x91}}, "DJcy": {Name: "DJcy", CodePoints: []int{1026}, Characters: []byte{0xd0, 0x82}}, "DScy": {Name: "DScy", CodePoints: []int{1029}, Characters: []byte{0xd0, 0x85}}, "DZcy": {Name: "DZcy", CodePoints: []int{1039}, Characters: []byte{0xd0, 0x8f}}, "Dagger": {Name: "Dagger", CodePoints: []int{8225}, Characters: []byte{0xe2, 0x80, 0xa1}}, "Darr": {Name: "Darr", CodePoints: []int{8609}, Characters: []byte{0xe2, 0x86, 0xa1}}, "Dashv": {Name: "Dashv", CodePoints: []int{10980}, Characters: []byte{0xe2, 0xab, 0xa4}}, "Dcaron": {Name: "Dcaron", CodePoints: []int{270}, Characters: []byte{0xc4, 0x8e}}, "Dcy": {Name: "Dcy", CodePoints: []int{1044}, Characters: []byte{0xd0, 0x94}}, "Del": {Name: "Del", CodePoints: []int{8711}, Characters: []byte{0xe2, 0x88, 0x87}}, "Delta": {Name: "Delta", CodePoints: []int{916}, Characters: []byte{0xce, 0x94}}, "Dfr": {Name: "Dfr", CodePoints: []int{120071}, Characters: []byte{0xf0, 0x9d, 0x94, 0x87}}, "DiacriticalAcute": {Name: "DiacriticalAcute", CodePoints: []int{180}, Characters: []byte{0xc2, 0xb4}}, "DiacriticalDot": {Name: "DiacriticalDot", CodePoints: []int{729}, Characters: []byte{0xcb, 0x99}}, "DiacriticalDoubleAcute": {Name: "DiacriticalDoubleAcute", CodePoints: []int{733}, Characters: []byte{0xcb, 0x9d}}, "DiacriticalGrave": {Name: "DiacriticalGrave", CodePoints: []int{96}, Characters: []byte{0x60}}, "DiacriticalTilde": {Name: "DiacriticalTilde", CodePoints: []int{732}, Characters: []byte{0xcb, 0x9c}}, "Diamond": {Name: "Diamond", CodePoints: []int{8900}, Characters: []byte{0xe2, 0x8b, 0x84}}, "DifferentialD": {Name: "DifferentialD", CodePoints: []int{8518}, Characters: []byte{0xe2, 0x85, 0x86}}, "Dopf": {Name: "Dopf", CodePoints: []int{120123}, Characters: []byte{0xf0, 0x9d, 0x94, 0xbb}}, "Dot": {Name: "Dot", CodePoints: []int{168}, Characters: []byte{0xc2, 0xa8}}, "DotDot": {Name: "DotDot", CodePoints: []int{8412}, Characters: []byte{0xe2, 0x83, 0x9c}}, "DotEqual": {Name: "DotEqual", CodePoints: []int{8784}, Characters: []byte{0xe2, 0x89, 0x90}}, "DoubleContourIntegral": {Name: "DoubleContourIntegral", CodePoints: []int{8751}, Characters: []byte{0xe2, 0x88, 0xaf}}, "DoubleDot": {Name: "DoubleDot", CodePoints: []int{168}, Characters: []byte{0xc2, 0xa8}}, "DoubleDownArrow": {Name: "DoubleDownArrow", CodePoints: []int{8659}, Characters: []byte{0xe2, 0x87, 0x93}}, "DoubleLeftArrow": {Name: "DoubleLeftArrow", CodePoints: []int{8656}, Characters: []byte{0xe2, 0x87, 0x90}}, "DoubleLeftRightArrow": {Name: "DoubleLeftRightArrow", CodePoints: []int{8660}, Characters: []byte{0xe2, 0x87, 0x94}}, "DoubleLeftTee": {Name: "DoubleLeftTee", CodePoints: []int{10980}, Characters: []byte{0xe2, 0xab, 0xa4}}, "DoubleLongLeftArrow": {Name: "DoubleLongLeftArrow", CodePoints: []int{10232}, Characters: []byte{0xe2, 0x9f, 0xb8}}, "DoubleLongLeftRightArrow": {Name: "DoubleLongLeftRightArrow", CodePoints: []int{10234}, Characters: []byte{0xe2, 0x9f, 0xba}}, "DoubleLongRightArrow": {Name: "DoubleLongRightArrow", CodePoints: []int{10233}, Characters: []byte{0xe2, 0x9f, 0xb9}}, "DoubleRightArrow": {Name: "DoubleRightArrow", CodePoints: []int{8658}, Characters: []byte{0xe2, 0x87, 0x92}}, "DoubleRightTee": {Name: "DoubleRightTee", CodePoints: []int{8872}, Characters: []byte{0xe2, 0x8a, 0xa8}}, "DoubleUpArrow": {Name: "DoubleUpArrow", CodePoints: []int{8657}, Characters: []byte{0xe2, 0x87, 0x91}}, "DoubleUpDownArrow": {Name: "DoubleUpDownArrow", CodePoints: []int{8661}, Characters: []byte{0xe2, 0x87, 0x95}}, "DoubleVerticalBar": {Name: "DoubleVerticalBar", CodePoints: []int{8741}, Characters: []byte{0xe2, 0x88, 0xa5}}, "DownArrow": {Name: "DownArrow", CodePoints: []int{8595}, Characters: []byte{0xe2, 0x86, 0x93}}, "DownArrowBar": {Name: "DownArrowBar", CodePoints: []int{10515}, Characters: []byte{0xe2, 0xa4, 0x93}}, "DownArrowUpArrow": {Name: "DownArrowUpArrow", CodePoints: []int{8693}, Characters: []byte{0xe2, 0x87, 0xb5}}, "DownBreve": {Name: "DownBreve", CodePoints: []int{785}, Characters: []byte{0xcc, 0x91}}, "DownLeftRightVector": {Name: "DownLeftRightVector", CodePoints: []int{10576}, Characters: []byte{0xe2, 0xa5, 0x90}}, "DownLeftTeeVector": {Name: "DownLeftTeeVector", CodePoints: []int{10590}, Characters: []byte{0xe2, 0xa5, 0x9e}}, "DownLeftVector": {Name: "DownLeftVector", CodePoints: []int{8637}, Characters: []byte{0xe2, 0x86, 0xbd}}, "DownLeftVectorBar": {Name: "DownLeftVectorBar", CodePoints: []int{10582}, Characters: []byte{0xe2, 0xa5, 0x96}}, "DownRightTeeVector": {Name: "DownRightTeeVector", CodePoints: []int{10591}, Characters: []byte{0xe2, 0xa5, 0x9f}}, "DownRightVector": {Name: "DownRightVector", CodePoints: []int{8641}, Characters: []byte{0xe2, 0x87, 0x81}}, "DownRightVectorBar": {Name: "DownRightVectorBar", CodePoints: []int{10583}, Characters: []byte{0xe2, 0xa5, 0x97}}, "DownTee": {Name: "DownTee", CodePoints: []int{8868}, Characters: []byte{0xe2, 0x8a, 0xa4}}, "DownTeeArrow": {Name: "DownTeeArrow", CodePoints: []int{8615}, Characters: []byte{0xe2, 0x86, 0xa7}}, "Downarrow": {Name: "Downarrow", CodePoints: []int{8659}, Characters: []byte{0xe2, 0x87, 0x93}}, "Dscr": {Name: "Dscr", CodePoints: []int{119967}, Characters: []byte{0xf0, 0x9d, 0x92, 0x9f}}, "Dstrok": {Name: "Dstrok", CodePoints: []int{272}, Characters: []byte{0xc4, 0x90}}, "ENG": {Name: "ENG", CodePoints: []int{330}, Characters: []byte{0xc5, 0x8a}}, "ETH": {Name: "ETH", CodePoints: []int{208}, Characters: []byte{0xc3, 0x90}}, "Eacute": {Name: "Eacute", CodePoints: []int{201}, Characters: []byte{0xc3, 0x89}}, "Ecaron": {Name: "Ecaron", CodePoints: []int{282}, Characters: []byte{0xc4, 0x9a}}, "Ecirc": {Name: "Ecirc", CodePoints: []int{202}, Characters: []byte{0xc3, 0x8a}}, "Ecy": {Name: "Ecy", CodePoints: []int{1069}, Characters: []byte{0xd0, 0xad}}, "Edot": {Name: "Edot", CodePoints: []int{278}, Characters: []byte{0xc4, 0x96}}, "Efr": {Name: "Efr", CodePoints: []int{120072}, Characters: []byte{0xf0, 0x9d, 0x94, 0x88}}, "Egrave": {Name: "Egrave", CodePoints: []int{200}, Characters: []byte{0xc3, 0x88}}, "Element": {Name: "Element", CodePoints: []int{8712}, Characters: []byte{0xe2, 0x88, 0x88}}, "Emacr": {Name: "Emacr", CodePoints: []int{274}, Characters: []byte{0xc4, 0x92}}, "EmptySmallSquare": {Name: "EmptySmallSquare", CodePoints: []int{9723}, Characters: []byte{0xe2, 0x97, 0xbb}}, "EmptyVerySmallSquare": {Name: "EmptyVerySmallSquare", CodePoints: []int{9643}, Characters: []byte{0xe2, 0x96, 0xab}}, "Eogon": {Name: "Eogon", CodePoints: []int{280}, Characters: []byte{0xc4, 0x98}}, "Eopf": {Name: "Eopf", CodePoints: []int{120124}, Characters: []byte{0xf0, 0x9d, 0x94, 0xbc}}, "Epsilon": {Name: "Epsilon", CodePoints: []int{917}, Characters: []byte{0xce, 0x95}}, "Equal": {Name: "Equal", CodePoints: []int{10869}, Characters: []byte{0xe2, 0xa9, 0xb5}}, "EqualTilde": {Name: "EqualTilde", CodePoints: []int{8770}, Characters: []byte{0xe2, 0x89, 0x82}}, "Equilibrium": {Name: "Equilibrium", CodePoints: []int{8652}, Characters: []byte{0xe2, 0x87, 0x8c}}, "Escr": {Name: "Escr", CodePoints: []int{8496}, Characters: []byte{0xe2, 0x84, 0xb0}}, "Esim": {Name: "Esim", CodePoints: []int{10867}, Characters: []byte{0xe2, 0xa9, 0xb3}}, "Eta": {Name: "Eta", CodePoints: []int{919}, Characters: []byte{0xce, 0x97}}, "Euml": {Name: "Euml", CodePoints: []int{203}, Characters: []byte{0xc3, 0x8b}}, "Exists": {Name: "Exists", CodePoints: []int{8707}, Characters: []byte{0xe2, 0x88, 0x83}}, "ExponentialE": {Name: "ExponentialE", CodePoints: []int{8519}, Characters: []byte{0xe2, 0x85, 0x87}}, "Fcy": {Name: "Fcy", CodePoints: []int{1060}, Characters: []byte{0xd0, 0xa4}}, "Ffr": {Name: "Ffr", CodePoints: []int{120073}, Characters: []byte{0xf0, 0x9d, 0x94, 0x89}}, "FilledSmallSquare": {Name: "FilledSmallSquare", CodePoints: []int{9724}, Characters: []byte{0xe2, 0x97, 0xbc}}, "FilledVerySmallSquare": {Name: "FilledVerySmallSquare", CodePoints: []int{9642}, Characters: []byte{0xe2, 0x96, 0xaa}}, "Fopf": {Name: "Fopf", CodePoints: []int{120125}, Characters: []byte{0xf0, 0x9d, 0x94, 0xbd}}, "ForAll": {Name: "ForAll", CodePoints: []int{8704}, Characters: []byte{0xe2, 0x88, 0x80}}, "Fouriertrf": {Name: "Fouriertrf", CodePoints: []int{8497}, Characters: []byte{0xe2, 0x84, 0xb1}}, "Fscr": {Name: "Fscr", CodePoints: []int{8497}, Characters: []byte{0xe2, 0x84, 0xb1}}, "GJcy": {Name: "GJcy", CodePoints: []int{1027}, Characters: []byte{0xd0, 0x83}}, "GT": {Name: "GT", CodePoints: []int{62}, Characters: []byte{0x3e}}, "Gamma": {Name: "Gamma", CodePoints: []int{915}, Characters: []byte{0xce, 0x93}}, "Gammad": {Name: "Gammad", CodePoints: []int{988}, Characters: []byte{0xcf, 0x9c}}, "Gbreve": {Name: "Gbreve", CodePoints: []int{286}, Characters: []byte{0xc4, 0x9e}}, "Gcedil": {Name: "Gcedil", CodePoints: []int{290}, Characters: []byte{0xc4, 0xa2}}, "Gcirc": {Name: "Gcirc", CodePoints: []int{284}, Characters: []byte{0xc4, 0x9c}}, "Gcy": {Name: "Gcy", CodePoints: []int{1043}, Characters: []byte{0xd0, 0x93}}, "Gdot": {Name: "Gdot", CodePoints: []int{288}, Characters: []byte{0xc4, 0xa0}}, "Gfr": {Name: "Gfr", CodePoints: []int{120074}, Characters: []byte{0xf0, 0x9d, 0x94, 0x8a}}, "Gg": {Name: "Gg", CodePoints: []int{8921}, Characters: []byte{0xe2, 0x8b, 0x99}}, "Gopf": {Name: "Gopf", CodePoints: []int{120126}, Characters: []byte{0xf0, 0x9d, 0x94, 0xbe}}, "GreaterEqual": {Name: "GreaterEqual", CodePoints: []int{8805}, Characters: []byte{0xe2, 0x89, 0xa5}}, "GreaterEqualLess": {Name: "GreaterEqualLess", CodePoints: []int{8923}, Characters: []byte{0xe2, 0x8b, 0x9b}}, "GreaterFullEqual": {Name: "GreaterFullEqual", CodePoints: []int{8807}, Characters: []byte{0xe2, 0x89, 0xa7}}, "GreaterGreater": {Name: "GreaterGreater", CodePoints: []int{10914}, Characters: []byte{0xe2, 0xaa, 0xa2}}, "GreaterLess": {Name: "GreaterLess", CodePoints: []int{8823}, Characters: []byte{0xe2, 0x89, 0xb7}}, "GreaterSlantEqual": {Name: "GreaterSlantEqual", CodePoints: []int{10878}, Characters: []byte{0xe2, 0xa9, 0xbe}}, "GreaterTilde": {Name: "GreaterTilde", CodePoints: []int{8819}, Characters: []byte{0xe2, 0x89, 0xb3}}, "Gscr": {Name: "Gscr", CodePoints: []int{119970}, Characters: []byte{0xf0, 0x9d, 0x92, 0xa2}}, "Gt": {Name: "Gt", CodePoints: []int{8811}, Characters: []byte{0xe2, 0x89, 0xab}}, "HARDcy": {Name: "HARDcy", CodePoints: []int{1066}, Characters: []byte{0xd0, 0xaa}}, "Hacek": {Name: "Hacek", CodePoints: []int{711}, Characters: []byte{0xcb, 0x87}}, "Hat": {Name: "Hat", CodePoints: []int{94}, Characters: []byte{0x5e}}, "Hcirc": {Name: "Hcirc", CodePoints: []int{292}, Characters: []byte{0xc4, 0xa4}}, "Hfr": {Name: "Hfr", CodePoints: []int{8460}, Characters: []byte{0xe2, 0x84, 0x8c}}, "HilbertSpace": {Name: "HilbertSpace", CodePoints: []int{8459}, Characters: []byte{0xe2, 0x84, 0x8b}}, "Hopf": {Name: "Hopf", CodePoints: []int{8461}, Characters: []byte{0xe2, 0x84, 0x8d}}, "HorizontalLine": {Name: "HorizontalLine", CodePoints: []int{9472}, Characters: []byte{0xe2, 0x94, 0x80}}, "Hscr": {Name: "Hscr", CodePoints: []int{8459}, Characters: []byte{0xe2, 0x84, 0x8b}}, "Hstrok": {Name: "Hstrok", CodePoints: []int{294}, Characters: []byte{0xc4, 0xa6}}, "HumpDownHump": {Name: "HumpDownHump", CodePoints: []int{8782}, Characters: []byte{0xe2, 0x89, 0x8e}}, "HumpEqual": {Name: "HumpEqual", CodePoints: []int{8783}, Characters: []byte{0xe2, 0x89, 0x8f}}, "IEcy": {Name: "IEcy", CodePoints: []int{1045}, Characters: []byte{0xd0, 0x95}}, "IJlig": {Name: "IJlig", CodePoints: []int{306}, Characters: []byte{0xc4, 0xb2}}, "IOcy": {Name: "IOcy", CodePoints: []int{1025}, Characters: []byte{0xd0, 0x81}}, "Iacute": {Name: "Iacute", CodePoints: []int{205}, Characters: []byte{0xc3, 0x8d}}, "Icirc": {Name: "Icirc", CodePoints: []int{206}, Characters: []byte{0xc3, 0x8e}}, "Icy": {Name: "Icy", CodePoints: []int{1048}, Characters: []byte{0xd0, 0x98}}, "Idot": {Name: "Idot", CodePoints: []int{304}, Characters: []byte{0xc4, 0xb0}}, "Ifr": {Name: "Ifr", CodePoints: []int{8465}, Characters: []byte{0xe2, 0x84, 0x91}}, "Igrave": {Name: "Igrave", CodePoints: []int{204}, Characters: []byte{0xc3, 0x8c}}, "Im": {Name: "Im", CodePoints: []int{8465}, Characters: []byte{0xe2, 0x84, 0x91}}, "Imacr": {Name: "Imacr", CodePoints: []int{298}, Characters: []byte{0xc4, 0xaa}}, "ImaginaryI": {Name: "ImaginaryI", CodePoints: []int{8520}, Characters: []byte{0xe2, 0x85, 0x88}}, "Implies": {Name: "Implies", CodePoints: []int{8658}, Characters: []byte{0xe2, 0x87, 0x92}}, "Int": {Name: "Int", CodePoints: []int{8748}, Characters: []byte{0xe2, 0x88, 0xac}}, "Integral": {Name: "Integral", CodePoints: []int{8747}, Characters: []byte{0xe2, 0x88, 0xab}}, "Intersection": {Name: "Intersection", CodePoints: []int{8898}, Characters: []byte{0xe2, 0x8b, 0x82}}, "InvisibleComma": {Name: "InvisibleComma", CodePoints: []int{8291}, Characters: []byte{0xe2, 0x81, 0xa3}}, "InvisibleTimes": {Name: "InvisibleTimes", CodePoints: []int{8290}, Characters: []byte{0xe2, 0x81, 0xa2}}, "Iogon": {Name: "Iogon", CodePoints: []int{302}, Characters: []byte{0xc4, 0xae}}, "Iopf": {Name: "Iopf", CodePoints: []int{120128}, Characters: []byte{0xf0, 0x9d, 0x95, 0x80}}, "Iota": {Name: "Iota", CodePoints: []int{921}, Characters: []byte{0xce, 0x99}}, "Iscr": {Name: "Iscr", CodePoints: []int{8464}, Characters: []byte{0xe2, 0x84, 0x90}}, "Itilde": {Name: "Itilde", CodePoints: []int{296}, Characters: []byte{0xc4, 0xa8}}, "Iukcy": {Name: "Iukcy", CodePoints: []int{1030}, Characters: []byte{0xd0, 0x86}}, "Iuml": {Name: "Iuml", CodePoints: []int{207}, Characters: []byte{0xc3, 0x8f}}, "Jcirc": {Name: "Jcirc", CodePoints: []int{308}, Characters: []byte{0xc4, 0xb4}}, "Jcy": {Name: "Jcy", CodePoints: []int{1049}, Characters: []byte{0xd0, 0x99}}, "Jfr": {Name: "Jfr", CodePoints: []int{120077}, Characters: []byte{0xf0, 0x9d, 0x94, 0x8d}}, "Jopf": {Name: "Jopf", CodePoints: []int{120129}, Characters: []byte{0xf0, 0x9d, 0x95, 0x81}}, "Jscr": {Name: "Jscr", CodePoints: []int{119973}, Characters: []byte{0xf0, 0x9d, 0x92, 0xa5}}, "Jsercy": {Name: "Jsercy", CodePoints: []int{1032}, Characters: []byte{0xd0, 0x88}}, "Jukcy": {Name: "Jukcy", CodePoints: []int{1028}, Characters: []byte{0xd0, 0x84}}, "KHcy": {Name: "KHcy", CodePoints: []int{1061}, Characters: []byte{0xd0, 0xa5}}, "KJcy": {Name: "KJcy", CodePoints: []int{1036}, Characters: []byte{0xd0, 0x8c}}, "Kappa": {Name: "Kappa", CodePoints: []int{922}, Characters: []byte{0xce, 0x9a}}, "Kcedil": {Name: "Kcedil", CodePoints: []int{310}, Characters: []byte{0xc4, 0xb6}}, "Kcy": {Name: "Kcy", CodePoints: []int{1050}, Characters: []byte{0xd0, 0x9a}}, "Kfr": {Name: "Kfr", CodePoints: []int{120078}, Characters: []byte{0xf0, 0x9d, 0x94, 0x8e}}, "Kopf": {Name: "Kopf", CodePoints: []int{120130}, Characters: []byte{0xf0, 0x9d, 0x95, 0x82}}, "Kscr": {Name: "Kscr", CodePoints: []int{119974}, Characters: []byte{0xf0, 0x9d, 0x92, 0xa6}}, "LJcy": {Name: "LJcy", CodePoints: []int{1033}, Characters: []byte{0xd0, 0x89}}, "LT": {Name: "LT", CodePoints: []int{60}, Characters: []byte{0x3c}}, "Lacute": {Name: "Lacute", CodePoints: []int{313}, Characters: []byte{0xc4, 0xb9}}, "Lambda": {Name: "Lambda", CodePoints: []int{923}, Characters: []byte{0xce, 0x9b}}, "Lang": {Name: "Lang", CodePoints: []int{10218}, Characters: []byte{0xe2, 0x9f, 0xaa}}, "Laplacetrf": {Name: "Laplacetrf", CodePoints: []int{8466}, Characters: []byte{0xe2, 0x84, 0x92}}, "Larr": {Name: "Larr", CodePoints: []int{8606}, Characters: []byte{0xe2, 0x86, 0x9e}}, "Lcaron": {Name: "Lcaron", CodePoints: []int{317}, Characters: []byte{0xc4, 0xbd}}, "Lcedil": {Name: "Lcedil", CodePoints: []int{315}, Characters: []byte{0xc4, 0xbb}}, "Lcy": {Name: "Lcy", CodePoints: []int{1051}, Characters: []byte{0xd0, 0x9b}}, "LeftAngleBracket": {Name: "LeftAngleBracket", CodePoints: []int{10216}, Characters: []byte{0xe2, 0x9f, 0xa8}}, "LeftArrow": {Name: "LeftArrow", CodePoints: []int{8592}, Characters: []byte{0xe2, 0x86, 0x90}}, "LeftArrowBar": {Name: "LeftArrowBar", CodePoints: []int{8676}, Characters: []byte{0xe2, 0x87, 0xa4}}, "LeftArrowRightArrow": {Name: "LeftArrowRightArrow", CodePoints: []int{8646}, Characters: []byte{0xe2, 0x87, 0x86}}, "LeftCeiling": {Name: "LeftCeiling", CodePoints: []int{8968}, Characters: []byte{0xe2, 0x8c, 0x88}}, "LeftDoubleBracket": {Name: "LeftDoubleBracket", CodePoints: []int{10214}, Characters: []byte{0xe2, 0x9f, 0xa6}}, "LeftDownTeeVector": {Name: "LeftDownTeeVector", CodePoints: []int{10593}, Characters: []byte{0xe2, 0xa5, 0xa1}}, "LeftDownVector": {Name: "LeftDownVector", CodePoints: []int{8643}, Characters: []byte{0xe2, 0x87, 0x83}}, "LeftDownVectorBar": {Name: "LeftDownVectorBar", CodePoints: []int{10585}, Characters: []byte{0xe2, 0xa5, 0x99}}, "LeftFloor": {Name: "LeftFloor", CodePoints: []int{8970}, Characters: []byte{0xe2, 0x8c, 0x8a}}, "LeftRightArrow": {Name: "LeftRightArrow", CodePoints: []int{8596}, Characters: []byte{0xe2, 0x86, 0x94}}, "LeftRightVector": {Name: "LeftRightVector", CodePoints: []int{10574}, Characters: []byte{0xe2, 0xa5, 0x8e}}, "LeftTee": {Name: "LeftTee", CodePoints: []int{8867}, Characters: []byte{0xe2, 0x8a, 0xa3}}, "LeftTeeArrow": {Name: "LeftTeeArrow", CodePoints: []int{8612}, Characters: []byte{0xe2, 0x86, 0xa4}}, "LeftTeeVector": {Name: "LeftTeeVector", CodePoints: []int{10586}, Characters: []byte{0xe2, 0xa5, 0x9a}}, "LeftTriangle": {Name: "LeftTriangle", CodePoints: []int{8882}, Characters: []byte{0xe2, 0x8a, 0xb2}}, "LeftTriangleBar": {Name: "LeftTriangleBar", CodePoints: []int{10703}, Characters: []byte{0xe2, 0xa7, 0x8f}}, "LeftTriangleEqual": {Name: "LeftTriangleEqual", CodePoints: []int{8884}, Characters: []byte{0xe2, 0x8a, 0xb4}}, "LeftUpDownVector": {Name: "LeftUpDownVector", CodePoints: []int{10577}, Characters: []byte{0xe2, 0xa5, 0x91}}, "LeftUpTeeVector": {Name: "LeftUpTeeVector", CodePoints: []int{10592}, Characters: []byte{0xe2, 0xa5, 0xa0}}, "LeftUpVector": {Name: "LeftUpVector", CodePoints: []int{8639}, Characters: []byte{0xe2, 0x86, 0xbf}}, "LeftUpVectorBar": {Name: "LeftUpVectorBar", CodePoints: []int{10584}, Characters: []byte{0xe2, 0xa5, 0x98}}, "LeftVector": {Name: "LeftVector", CodePoints: []int{8636}, Characters: []byte{0xe2, 0x86, 0xbc}}, "LeftVectorBar": {Name: "LeftVectorBar", CodePoints: []int{10578}, Characters: []byte{0xe2, 0xa5, 0x92}}, "Leftarrow": {Name: "Leftarrow", CodePoints: []int{8656}, Characters: []byte{0xe2, 0x87, 0x90}}, "Leftrightarrow": {Name: "Leftrightarrow", CodePoints: []int{8660}, Characters: []byte{0xe2, 0x87, 0x94}}, "LessEqualGreater": {Name: "LessEqualGreater", CodePoints: []int{8922}, Characters: []byte{0xe2, 0x8b, 0x9a}}, "LessFullEqual": {Name: "LessFullEqual", CodePoints: []int{8806}, Characters: []byte{0xe2, 0x89, 0xa6}}, "LessGreater": {Name: "LessGreater", CodePoints: []int{8822}, Characters: []byte{0xe2, 0x89, 0xb6}}, "LessLess": {Name: "LessLess", CodePoints: []int{10913}, Characters: []byte{0xe2, 0xaa, 0xa1}}, "LessSlantEqual": {Name: "LessSlantEqual", CodePoints: []int{10877}, Characters: []byte{0xe2, 0xa9, 0xbd}}, "LessTilde": {Name: "LessTilde", CodePoints: []int{8818}, Characters: []byte{0xe2, 0x89, 0xb2}}, "Lfr": {Name: "Lfr", CodePoints: []int{120079}, Characters: []byte{0xf0, 0x9d, 0x94, 0x8f}}, "Ll": {Name: "Ll", CodePoints: []int{8920}, Characters: []byte{0xe2, 0x8b, 0x98}}, "Lleftarrow": {Name: "Lleftarrow", CodePoints: []int{8666}, Characters: []byte{0xe2, 0x87, 0x9a}}, "Lmidot": {Name: "Lmidot", CodePoints: []int{319}, Characters: []byte{0xc4, 0xbf}}, "LongLeftArrow": {Name: "LongLeftArrow", CodePoints: []int{10229}, Characters: []byte{0xe2, 0x9f, 0xb5}}, "LongLeftRightArrow": {Name: "LongLeftRightArrow", CodePoints: []int{10231}, Characters: []byte{0xe2, 0x9f, 0xb7}}, "LongRightArrow": {Name: "LongRightArrow", CodePoints: []int{10230}, Characters: []byte{0xe2, 0x9f, 0xb6}}, "Longleftarrow": {Name: "Longleftarrow", CodePoints: []int{10232}, Characters: []byte{0xe2, 0x9f, 0xb8}}, "Longleftrightarrow": {Name: "Longleftrightarrow", CodePoints: []int{10234}, Characters: []byte{0xe2, 0x9f, 0xba}}, "Longrightarrow": {Name: "Longrightarrow", CodePoints: []int{10233}, Characters: []byte{0xe2, 0x9f, 0xb9}}, "Lopf": {Name: "Lopf", CodePoints: []int{120131}, Characters: []byte{0xf0, 0x9d, 0x95, 0x83}}, "LowerLeftArrow": {Name: "LowerLeftArrow", CodePoints: []int{8601}, Characters: []byte{0xe2, 0x86, 0x99}}, "LowerRightArrow": {Name: "LowerRightArrow", CodePoints: []int{8600}, Characters: []byte{0xe2, 0x86, 0x98}}, "Lscr": {Name: "Lscr", CodePoints: []int{8466}, Characters: []byte{0xe2, 0x84, 0x92}}, "Lsh": {Name: "Lsh", CodePoints: []int{8624}, Characters: []byte{0xe2, 0x86, 0xb0}}, "Lstrok": {Name: "Lstrok", CodePoints: []int{321}, Characters: []byte{0xc5, 0x81}}, "Lt": {Name: "Lt", CodePoints: []int{8810}, Characters: []byte{0xe2, 0x89, 0xaa}}, "Map": {Name: "Map", CodePoints: []int{10501}, Characters: []byte{0xe2, 0xa4, 0x85}}, "Mcy": {Name: "Mcy", CodePoints: []int{1052}, Characters: []byte{0xd0, 0x9c}}, "MediumSpace": {Name: "MediumSpace", CodePoints: []int{8287}, Characters: []byte{0xe2, 0x81, 0x9f}}, "Mellintrf": {Name: "Mellintrf", CodePoints: []int{8499}, Characters: []byte{0xe2, 0x84, 0xb3}}, "Mfr": {Name: "Mfr", CodePoints: []int{120080}, Characters: []byte{0xf0, 0x9d, 0x94, 0x90}}, "MinusPlus": {Name: "MinusPlus", CodePoints: []int{8723}, Characters: []byte{0xe2, 0x88, 0x93}}, "Mopf": {Name: "Mopf", CodePoints: []int{120132}, Characters: []byte{0xf0, 0x9d, 0x95, 0x84}}, "Mscr": {Name: "Mscr", CodePoints: []int{8499}, Characters: []byte{0xe2, 0x84, 0xb3}}, "Mu": {Name: "Mu", CodePoints: []int{924}, Characters: []byte{0xce, 0x9c}}, "NJcy": {Name: "NJcy", CodePoints: []int{1034}, Characters: []byte{0xd0, 0x8a}}, "Nacute": {Name: "Nacute", CodePoints: []int{323}, Characters: []byte{0xc5, 0x83}}, "Ncaron": {Name: "Ncaron", CodePoints: []int{327}, Characters: []byte{0xc5, 0x87}}, "Ncedil": {Name: "Ncedil", CodePoints: []int{325}, Characters: []byte{0xc5, 0x85}}, "Ncy": {Name: "Ncy", CodePoints: []int{1053}, Characters: []byte{0xd0, 0x9d}}, "NegativeMediumSpace": {Name: "NegativeMediumSpace", CodePoints: []int{8203}, Characters: []byte{0xe2, 0x80, 0x8b}}, "NegativeThickSpace": {Name: "NegativeThickSpace", CodePoints: []int{8203}, Characters: []byte{0xe2, 0x80, 0x8b}}, "NegativeThinSpace": {Name: "NegativeThinSpace", CodePoints: []int{8203}, Characters: []byte{0xe2, 0x80, 0x8b}}, "NegativeVeryThinSpace": {Name: "NegativeVeryThinSpace", CodePoints: []int{8203}, Characters: []byte{0xe2, 0x80, 0x8b}}, "NestedGreaterGreater": {Name: "NestedGreaterGreater", CodePoints: []int{8811}, Characters: []byte{0xe2, 0x89, 0xab}}, "NestedLessLess": {Name: "NestedLessLess", CodePoints: []int{8810}, Characters: []byte{0xe2, 0x89, 0xaa}}, "NewLine": {Name: "NewLine", CodePoints: []int{10}, Characters: []byte{0xa}}, "Nfr": {Name: "Nfr", CodePoints: []int{120081}, Characters: []byte{0xf0, 0x9d, 0x94, 0x91}}, "NoBreak": {Name: "NoBreak", CodePoints: []int{8288}, Characters: []byte{0xe2, 0x81, 0xa0}}, "NonBreakingSpace": {Name: "NonBreakingSpace", CodePoints: []int{160}, Characters: []byte{0xc2, 0xa0}}, "Nopf": {Name: "Nopf", CodePoints: []int{8469}, Characters: []byte{0xe2, 0x84, 0x95}}, "Not": {Name: "Not", CodePoints: []int{10988}, Characters: []byte{0xe2, 0xab, 0xac}}, "NotCongruent": {Name: "NotCongruent", CodePoints: []int{8802}, Characters: []byte{0xe2, 0x89, 0xa2}}, "NotCupCap": {Name: "NotCupCap", CodePoints: []int{8813}, Characters: []byte{0xe2, 0x89, 0xad}}, "NotDoubleVerticalBar": {Name: "NotDoubleVerticalBar", CodePoints: []int{8742}, Characters: []byte{0xe2, 0x88, 0xa6}}, "NotElement": {Name: "NotElement", CodePoints: []int{8713}, Characters: []byte{0xe2, 0x88, 0x89}}, "NotEqual": {Name: "NotEqual", CodePoints: []int{8800}, Characters: []byte{0xe2, 0x89, 0xa0}}, "NotEqualTilde": {Name: "NotEqualTilde", CodePoints: []int{8770, 824}, Characters: []byte{0xe2, 0x89, 0x82, 0xcc, 0xb8}}, "NotExists": {Name: "NotExists", CodePoints: []int{8708}, Characters: []byte{0xe2, 0x88, 0x84}}, "NotGreater": {Name: "NotGreater", CodePoints: []int{8815}, Characters: []byte{0xe2, 0x89, 0xaf}}, "NotGreaterEqual": {Name: "NotGreaterEqual", CodePoints: []int{8817}, Characters: []byte{0xe2, 0x89, 0xb1}}, "NotGreaterFullEqual": {Name: "NotGreaterFullEqual", CodePoints: []int{8807, 824}, Characters: []byte{0xe2, 0x89, 0xa7, 0xcc, 0xb8}}, "NotGreaterGreater": {Name: "NotGreaterGreater", CodePoints: []int{8811, 824}, Characters: []byte{0xe2, 0x89, 0xab, 0xcc, 0xb8}}, "NotGreaterLess": {Name: "NotGreaterLess", CodePoints: []int{8825}, Characters: []byte{0xe2, 0x89, 0xb9}}, "NotGreaterSlantEqual": {Name: "NotGreaterSlantEqual", CodePoints: []int{10878, 824}, Characters: []byte{0xe2, 0xa9, 0xbe, 0xcc, 0xb8}}, "NotGreaterTilde": {Name: "NotGreaterTilde", CodePoints: []int{8821}, Characters: []byte{0xe2, 0x89, 0xb5}}, "NotHumpDownHump": {Name: "NotHumpDownHump", CodePoints: []int{8782, 824}, Characters: []byte{0xe2, 0x89, 0x8e, 0xcc, 0xb8}}, "NotHumpEqual": {Name: "NotHumpEqual", CodePoints: []int{8783, 824}, Characters: []byte{0xe2, 0x89, 0x8f, 0xcc, 0xb8}}, "NotLeftTriangle": {Name: "NotLeftTriangle", CodePoints: []int{8938}, Characters: []byte{0xe2, 0x8b, 0xaa}}, "NotLeftTriangleBar": {Name: "NotLeftTriangleBar", CodePoints: []int{10703, 824}, Characters: []byte{0xe2, 0xa7, 0x8f, 0xcc, 0xb8}}, "NotLeftTriangleEqual": {Name: "NotLeftTriangleEqual", CodePoints: []int{8940}, Characters: []byte{0xe2, 0x8b, 0xac}}, "NotLess": {Name: "NotLess", CodePoints: []int{8814}, Characters: []byte{0xe2, 0x89, 0xae}}, "NotLessEqual": {Name: "NotLessEqual", CodePoints: []int{8816}, Characters: []byte{0xe2, 0x89, 0xb0}}, "NotLessGreater": {Name: "NotLessGreater", CodePoints: []int{8824}, Characters: []byte{0xe2, 0x89, 0xb8}}, "NotLessLess": {Name: "NotLessLess", CodePoints: []int{8810, 824}, Characters: []byte{0xe2, 0x89, 0xaa, 0xcc, 0xb8}}, "NotLessSlantEqual": {Name: "NotLessSlantEqual", CodePoints: []int{10877, 824}, Characters: []byte{0xe2, 0xa9, 0xbd, 0xcc, 0xb8}}, "NotLessTilde": {Name: "NotLessTilde", CodePoints: []int{8820}, Characters: []byte{0xe2, 0x89, 0xb4}}, "NotNestedGreaterGreater": {Name: "NotNestedGreaterGreater", CodePoints: []int{10914, 824}, Characters: []byte{0xe2, 0xaa, 0xa2, 0xcc, 0xb8}}, "NotNestedLessLess": {Name: "NotNestedLessLess", CodePoints: []int{10913, 824}, Characters: []byte{0xe2, 0xaa, 0xa1, 0xcc, 0xb8}}, "NotPrecedes": {Name: "NotPrecedes", CodePoints: []int{8832}, Characters: []byte{0xe2, 0x8a, 0x80}}, "NotPrecedesEqual": {Name: "NotPrecedesEqual", CodePoints: []int{10927, 824}, Characters: []byte{0xe2, 0xaa, 0xaf, 0xcc, 0xb8}}, "NotPrecedesSlantEqual": {Name: "NotPrecedesSlantEqual", CodePoints: []int{8928}, Characters: []byte{0xe2, 0x8b, 0xa0}}, "NotReverseElement": {Name: "NotReverseElement", CodePoints: []int{8716}, Characters: []byte{0xe2, 0x88, 0x8c}}, "NotRightTriangle": {Name: "NotRightTriangle", CodePoints: []int{8939}, Characters: []byte{0xe2, 0x8b, 0xab}}, "NotRightTriangleBar": {Name: "NotRightTriangleBar", CodePoints: []int{10704, 824}, Characters: []byte{0xe2, 0xa7, 0x90, 0xcc, 0xb8}}, "NotRightTriangleEqual": {Name: "NotRightTriangleEqual", CodePoints: []int{8941}, Characters: []byte{0xe2, 0x8b, 0xad}}, "NotSquareSubset": {Name: "NotSquareSubset", CodePoints: []int{8847, 824}, Characters: []byte{0xe2, 0x8a, 0x8f, 0xcc, 0xb8}}, "NotSquareSubsetEqual": {Name: "NotSquareSubsetEqual", CodePoints: []int{8930}, Characters: []byte{0xe2, 0x8b, 0xa2}}, "NotSquareSuperset": {Name: "NotSquareSuperset", CodePoints: []int{8848, 824}, Characters: []byte{0xe2, 0x8a, 0x90, 0xcc, 0xb8}}, "NotSquareSupersetEqual": {Name: "NotSquareSupersetEqual", CodePoints: []int{8931}, Characters: []byte{0xe2, 0x8b, 0xa3}}, "NotSubset": {Name: "NotSubset", CodePoints: []int{8834, 8402}, Characters: []byte{0xe2, 0x8a, 0x82, 0xe2, 0x83, 0x92}}, "NotSubsetEqual": {Name: "NotSubsetEqual", CodePoints: []int{8840}, Characters: []byte{0xe2, 0x8a, 0x88}}, "NotSucceeds": {Name: "NotSucceeds", CodePoints: []int{8833}, Characters: []byte{0xe2, 0x8a, 0x81}}, "NotSucceedsEqual": {Name: "NotSucceedsEqual", CodePoints: []int{10928, 824}, Characters: []byte{0xe2, 0xaa, 0xb0, 0xcc, 0xb8}}, "NotSucceedsSlantEqual": {Name: "NotSucceedsSlantEqual", CodePoints: []int{8929}, Characters: []byte{0xe2, 0x8b, 0xa1}}, "NotSucceedsTilde": {Name: "NotSucceedsTilde", CodePoints: []int{8831, 824}, Characters: []byte{0xe2, 0x89, 0xbf, 0xcc, 0xb8}}, "NotSuperset": {Name: "NotSuperset", CodePoints: []int{8835, 8402}, Characters: []byte{0xe2, 0x8a, 0x83, 0xe2, 0x83, 0x92}}, "NotSupersetEqual": {Name: "NotSupersetEqual", CodePoints: []int{8841}, Characters: []byte{0xe2, 0x8a, 0x89}}, "NotTilde": {Name: "NotTilde", CodePoints: []int{8769}, Characters: []byte{0xe2, 0x89, 0x81}}, "NotTildeEqual": {Name: "NotTildeEqual", CodePoints: []int{8772}, Characters: []byte{0xe2, 0x89, 0x84}}, "NotTildeFullEqual": {Name: "NotTildeFullEqual", CodePoints: []int{8775}, Characters: []byte{0xe2, 0x89, 0x87}}, "NotTildeTilde": {Name: "NotTildeTilde", CodePoints: []int{8777}, Characters: []byte{0xe2, 0x89, 0x89}}, "NotVerticalBar": {Name: "NotVerticalBar", CodePoints: []int{8740}, Characters: []byte{0xe2, 0x88, 0xa4}}, "Nscr": {Name: "Nscr", CodePoints: []int{119977}, Characters: []byte{0xf0, 0x9d, 0x92, 0xa9}}, "Ntilde": {Name: "Ntilde", CodePoints: []int{209}, Characters: []byte{0xc3, 0x91}}, "Nu": {Name: "Nu", CodePoints: []int{925}, Characters: []byte{0xce, 0x9d}}, "OElig": {Name: "OElig", CodePoints: []int{338}, Characters: []byte{0xc5, 0x92}}, "Oacute": {Name: "Oacute", CodePoints: []int{211}, Characters: []byte{0xc3, 0x93}}, "Ocirc": {Name: "Ocirc", CodePoints: []int{212}, Characters: []byte{0xc3, 0x94}}, "Ocy": {Name: "Ocy", CodePoints: []int{1054}, Characters: []byte{0xd0, 0x9e}}, "Odblac": {Name: "Odblac", CodePoints: []int{336}, Characters: []byte{0xc5, 0x90}}, "Ofr": {Name: "Ofr", CodePoints: []int{120082}, Characters: []byte{0xf0, 0x9d, 0x94, 0x92}}, "Ograve": {Name: "Ograve", CodePoints: []int{210}, Characters: []byte{0xc3, 0x92}}, "Omacr": {Name: "Omacr", CodePoints: []int{332}, Characters: []byte{0xc5, 0x8c}}, "Omega": {Name: "Omega", CodePoints: []int{937}, Characters: []byte{0xce, 0xa9}}, "Omicron": {Name: "Omicron", CodePoints: []int{927}, Characters: []byte{0xce, 0x9f}}, "Oopf": {Name: "Oopf", CodePoints: []int{120134}, Characters: []byte{0xf0, 0x9d, 0x95, 0x86}}, "OpenCurlyDoubleQuote": {Name: "OpenCurlyDoubleQuote", CodePoints: []int{8220}, Characters: []byte{0xe2, 0x80, 0x9c}}, "OpenCurlyQuote": {Name: "OpenCurlyQuote", CodePoints: []int{8216}, Characters: []byte{0xe2, 0x80, 0x98}}, "Or": {Name: "Or", CodePoints: []int{10836}, Characters: []byte{0xe2, 0xa9, 0x94}}, "Oscr": {Name: "Oscr", CodePoints: []int{119978}, Characters: []byte{0xf0, 0x9d, 0x92, 0xaa}}, "Oslash": {Name: "Oslash", CodePoints: []int{216}, Characters: []byte{0xc3, 0x98}}, "Otilde": {Name: "Otilde", CodePoints: []int{213}, Characters: []byte{0xc3, 0x95}}, "Otimes": {Name: "Otimes", CodePoints: []int{10807}, Characters: []byte{0xe2, 0xa8, 0xb7}}, "Ouml": {Name: "Ouml", CodePoints: []int{214}, Characters: []byte{0xc3, 0x96}}, "OverBar": {Name: "OverBar", CodePoints: []int{8254}, Characters: []byte{0xe2, 0x80, 0xbe}}, "OverBrace": {Name: "OverBrace", CodePoints: []int{9182}, Characters: []byte{0xe2, 0x8f, 0x9e}}, "OverBracket": {Name: "OverBracket", CodePoints: []int{9140}, Characters: []byte{0xe2, 0x8e, 0xb4}}, "OverParenthesis": {Name: "OverParenthesis", CodePoints: []int{9180}, Characters: []byte{0xe2, 0x8f, 0x9c}}, "PartialD": {Name: "PartialD", CodePoints: []int{8706}, Characters: []byte{0xe2, 0x88, 0x82}}, "Pcy": {Name: "Pcy", CodePoints: []int{1055}, Characters: []byte{0xd0, 0x9f}}, "Pfr": {Name: "Pfr", CodePoints: []int{120083}, Characters: []byte{0xf0, 0x9d, 0x94, 0x93}}, "Phi": {Name: "Phi", CodePoints: []int{934}, Characters: []byte{0xce, 0xa6}}, "Pi": {Name: "Pi", CodePoints: []int{928}, Characters: []byte{0xce, 0xa0}}, "PlusMinus": {Name: "PlusMinus", CodePoints: []int{177}, Characters: []byte{0xc2, 0xb1}}, "Poincareplane": {Name: "Poincareplane", CodePoints: []int{8460}, Characters: []byte{0xe2, 0x84, 0x8c}}, "Popf": {Name: "Popf", CodePoints: []int{8473}, Characters: []byte{0xe2, 0x84, 0x99}}, "Pr": {Name: "Pr", CodePoints: []int{10939}, Characters: []byte{0xe2, 0xaa, 0xbb}}, "Precedes": {Name: "Precedes", CodePoints: []int{8826}, Characters: []byte{0xe2, 0x89, 0xba}}, "PrecedesEqual": {Name: "PrecedesEqual", CodePoints: []int{10927}, Characters: []byte{0xe2, 0xaa, 0xaf}}, "PrecedesSlantEqual": {Name: "PrecedesSlantEqual", CodePoints: []int{8828}, Characters: []byte{0xe2, 0x89, 0xbc}}, "PrecedesTilde": {Name: "PrecedesTilde", CodePoints: []int{8830}, Characters: []byte{0xe2, 0x89, 0xbe}}, "Prime": {Name: "Prime", CodePoints: []int{8243}, Characters: []byte{0xe2, 0x80, 0xb3}}, "Product": {Name: "Product", CodePoints: []int{8719}, Characters: []byte{0xe2, 0x88, 0x8f}}, "Proportion": {Name: "Proportion", CodePoints: []int{8759}, Characters: []byte{0xe2, 0x88, 0xb7}}, "Proportional": {Name: "Proportional", CodePoints: []int{8733}, Characters: []byte{0xe2, 0x88, 0x9d}}, "Pscr": {Name: "Pscr", CodePoints: []int{119979}, Characters: []byte{0xf0, 0x9d, 0x92, 0xab}}, "Psi": {Name: "Psi", CodePoints: []int{936}, Characters: []byte{0xce, 0xa8}}, "QUOT": {Name: "QUOT", CodePoints: []int{34}, Characters: []byte{0x22}}, "Qfr": {Name: "Qfr", CodePoints: []int{120084}, Characters: []byte{0xf0, 0x9d, 0x94, 0x94}}, "Qopf": {Name: "Qopf", CodePoints: []int{8474}, Characters: []byte{0xe2, 0x84, 0x9a}}, "Qscr": {Name: "Qscr", CodePoints: []int{119980}, Characters: []byte{0xf0, 0x9d, 0x92, 0xac}}, "RBarr": {Name: "RBarr", CodePoints: []int{10512}, Characters: []byte{0xe2, 0xa4, 0x90}}, "REG": {Name: "REG", CodePoints: []int{174}, Characters: []byte{0xc2, 0xae}}, "Racute": {Name: "Racute", CodePoints: []int{340}, Characters: []byte{0xc5, 0x94}}, "Rang": {Name: "Rang", CodePoints: []int{10219}, Characters: []byte{0xe2, 0x9f, 0xab}}, "Rarr": {Name: "Rarr", CodePoints: []int{8608}, Characters: []byte{0xe2, 0x86, 0xa0}}, "Rarrtl": {Name: "Rarrtl", CodePoints: []int{10518}, Characters: []byte{0xe2, 0xa4, 0x96}}, "Rcaron": {Name: "Rcaron", CodePoints: []int{344}, Characters: []byte{0xc5, 0x98}}, "Rcedil": {Name: "Rcedil", CodePoints: []int{342}, Characters: []byte{0xc5, 0x96}}, "Rcy": {Name: "Rcy", CodePoints: []int{1056}, Characters: []byte{0xd0, 0xa0}}, "Re": {Name: "Re", CodePoints: []int{8476}, Characters: []byte{0xe2, 0x84, 0x9c}}, "ReverseElement": {Name: "ReverseElement", CodePoints: []int{8715}, Characters: []byte{0xe2, 0x88, 0x8b}}, "ReverseEquilibrium": {Name: "ReverseEquilibrium", CodePoints: []int{8651}, Characters: []byte{0xe2, 0x87, 0x8b}}, "ReverseUpEquilibrium": {Name: "ReverseUpEquilibrium", CodePoints: []int{10607}, Characters: []byte{0xe2, 0xa5, 0xaf}}, "Rfr": {Name: "Rfr", CodePoints: []int{8476}, Characters: []byte{0xe2, 0x84, 0x9c}}, "Rho": {Name: "Rho", CodePoints: []int{929}, Characters: []byte{0xce, 0xa1}}, "RightAngleBracket": {Name: "RightAngleBracket", CodePoints: []int{10217}, Characters: []byte{0xe2, 0x9f, 0xa9}}, "RightArrow": {Name: "RightArrow", CodePoints: []int{8594}, Characters: []byte{0xe2, 0x86, 0x92}}, "RightArrowBar": {Name: "RightArrowBar", CodePoints: []int{8677}, Characters: []byte{0xe2, 0x87, 0xa5}}, "RightArrowLeftArrow": {Name: "RightArrowLeftArrow", CodePoints: []int{8644}, Characters: []byte{0xe2, 0x87, 0x84}}, "RightCeiling": {Name: "RightCeiling", CodePoints: []int{8969}, Characters: []byte{0xe2, 0x8c, 0x89}}, "RightDoubleBracket": {Name: "RightDoubleBracket", CodePoints: []int{10215}, Characters: []byte{0xe2, 0x9f, 0xa7}}, "RightDownTeeVector": {Name: "RightDownTeeVector", CodePoints: []int{10589}, Characters: []byte{0xe2, 0xa5, 0x9d}}, "RightDownVector": {Name: "RightDownVector", CodePoints: []int{8642}, Characters: []byte{0xe2, 0x87, 0x82}}, "RightDownVectorBar": {Name: "RightDownVectorBar", CodePoints: []int{10581}, Characters: []byte{0xe2, 0xa5, 0x95}}, "RightFloor": {Name: "RightFloor", CodePoints: []int{8971}, Characters: []byte{0xe2, 0x8c, 0x8b}}, "RightTee": {Name: "RightTee", CodePoints: []int{8866}, Characters: []byte{0xe2, 0x8a, 0xa2}}, "RightTeeArrow": {Name: "RightTeeArrow", CodePoints: []int{8614}, Characters: []byte{0xe2, 0x86, 0xa6}}, "RightTeeVector": {Name: "RightTeeVector", CodePoints: []int{10587}, Characters: []byte{0xe2, 0xa5, 0x9b}}, "RightTriangle": {Name: "RightTriangle", CodePoints: []int{8883}, Characters: []byte{0xe2, 0x8a, 0xb3}}, "RightTriangleBar": {Name: "RightTriangleBar", CodePoints: []int{10704}, Characters: []byte{0xe2, 0xa7, 0x90}}, "RightTriangleEqual": {Name: "RightTriangleEqual", CodePoints: []int{8885}, Characters: []byte{0xe2, 0x8a, 0xb5}}, "RightUpDownVector": {Name: "RightUpDownVector", CodePoints: []int{10575}, Characters: []byte{0xe2, 0xa5, 0x8f}}, "RightUpTeeVector": {Name: "RightUpTeeVector", CodePoints: []int{10588}, Characters: []byte{0xe2, 0xa5, 0x9c}}, "RightUpVector": {Name: "RightUpVector", CodePoints: []int{8638}, Characters: []byte{0xe2, 0x86, 0xbe}}, "RightUpVectorBar": {Name: "RightUpVectorBar", CodePoints: []int{10580}, Characters: []byte{0xe2, 0xa5, 0x94}}, "RightVector": {Name: "RightVector", CodePoints: []int{8640}, Characters: []byte{0xe2, 0x87, 0x80}}, "RightVectorBar": {Name: "RightVectorBar", CodePoints: []int{10579}, Characters: []byte{0xe2, 0xa5, 0x93}}, "Rightarrow": {Name: "Rightarrow", CodePoints: []int{8658}, Characters: []byte{0xe2, 0x87, 0x92}}, "Ropf": {Name: "Ropf", CodePoints: []int{8477}, Characters: []byte{0xe2, 0x84, 0x9d}}, "RoundImplies": {Name: "RoundImplies", CodePoints: []int{10608}, Characters: []byte{0xe2, 0xa5, 0xb0}}, "Rrightarrow": {Name: "Rrightarrow", CodePoints: []int{8667}, Characters: []byte{0xe2, 0x87, 0x9b}}, "Rscr": {Name: "Rscr", CodePoints: []int{8475}, Characters: []byte{0xe2, 0x84, 0x9b}}, "Rsh": {Name: "Rsh", CodePoints: []int{8625}, Characters: []byte{0xe2, 0x86, 0xb1}}, "RuleDelayed": {Name: "RuleDelayed", CodePoints: []int{10740}, Characters: []byte{0xe2, 0xa7, 0xb4}}, "SHCHcy": {Name: "SHCHcy", CodePoints: []int{1065}, Characters: []byte{0xd0, 0xa9}}, "SHcy": {Name: "SHcy", CodePoints: []int{1064}, Characters: []byte{0xd0, 0xa8}}, "SOFTcy": {Name: "SOFTcy", CodePoints: []int{1068}, Characters: []byte{0xd0, 0xac}}, "Sacute": {Name: "Sacute", CodePoints: []int{346}, Characters: []byte{0xc5, 0x9a}}, "Sc": {Name: "Sc", CodePoints: []int{10940}, Characters: []byte{0xe2, 0xaa, 0xbc}}, "Scaron": {Name: "Scaron", CodePoints: []int{352}, Characters: []byte{0xc5, 0xa0}}, "Scedil": {Name: "Scedil", CodePoints: []int{350}, Characters: []byte{0xc5, 0x9e}}, "Scirc": {Name: "Scirc", CodePoints: []int{348}, Characters: []byte{0xc5, 0x9c}}, "Scy": {Name: "Scy", CodePoints: []int{1057}, Characters: []byte{0xd0, 0xa1}}, "Sfr": {Name: "Sfr", CodePoints: []int{120086}, Characters: []byte{0xf0, 0x9d, 0x94, 0x96}}, "ShortDownArrow": {Name: "ShortDownArrow", CodePoints: []int{8595}, Characters: []byte{0xe2, 0x86, 0x93}}, "ShortLeftArrow": {Name: "ShortLeftArrow", CodePoints: []int{8592}, Characters: []byte{0xe2, 0x86, 0x90}}, "ShortRightArrow": {Name: "ShortRightArrow", CodePoints: []int{8594}, Characters: []byte{0xe2, 0x86, 0x92}}, "ShortUpArrow": {Name: "ShortUpArrow", CodePoints: []int{8593}, Characters: []byte{0xe2, 0x86, 0x91}}, "Sigma": {Name: "Sigma", CodePoints: []int{931}, Characters: []byte{0xce, 0xa3}}, "SmallCircle": {Name: "SmallCircle", CodePoints: []int{8728}, Characters: []byte{0xe2, 0x88, 0x98}}, "Sopf": {Name: "Sopf", CodePoints: []int{120138}, Characters: []byte{0xf0, 0x9d, 0x95, 0x8a}}, "Sqrt": {Name: "Sqrt", CodePoints: []int{8730}, Characters: []byte{0xe2, 0x88, 0x9a}}, "Square": {Name: "Square", CodePoints: []int{9633}, Characters: []byte{0xe2, 0x96, 0xa1}}, "SquareIntersection": {Name: "SquareIntersection", CodePoints: []int{8851}, Characters: []byte{0xe2, 0x8a, 0x93}}, "SquareSubset": {Name: "SquareSubset", CodePoints: []int{8847}, Characters: []byte{0xe2, 0x8a, 0x8f}}, "SquareSubsetEqual": {Name: "SquareSubsetEqual", CodePoints: []int{8849}, Characters: []byte{0xe2, 0x8a, 0x91}}, "SquareSuperset": {Name: "SquareSuperset", CodePoints: []int{8848}, Characters: []byte{0xe2, 0x8a, 0x90}}, "SquareSupersetEqual": {Name: "SquareSupersetEqual", CodePoints: []int{8850}, Characters: []byte{0xe2, 0x8a, 0x92}}, "SquareUnion": {Name: "SquareUnion", CodePoints: []int{8852}, Characters: []byte{0xe2, 0x8a, 0x94}}, "Sscr": {Name: "Sscr", CodePoints: []int{119982}, Characters: []byte{0xf0, 0x9d, 0x92, 0xae}}, "Star": {Name: "Star", CodePoints: []int{8902}, Characters: []byte{0xe2, 0x8b, 0x86}}, "Sub": {Name: "Sub", CodePoints: []int{8912}, Characters: []byte{0xe2, 0x8b, 0x90}}, "Subset": {Name: "Subset", CodePoints: []int{8912}, Characters: []byte{0xe2, 0x8b, 0x90}}, "SubsetEqual": {Name: "SubsetEqual", CodePoints: []int{8838}, Characters: []byte{0xe2, 0x8a, 0x86}}, "Succeeds": {Name: "Succeeds", CodePoints: []int{8827}, Characters: []byte{0xe2, 0x89, 0xbb}}, "SucceedsEqual": {Name: "SucceedsEqual", CodePoints: []int{10928}, Characters: []byte{0xe2, 0xaa, 0xb0}}, "SucceedsSlantEqual": {Name: "SucceedsSlantEqual", CodePoints: []int{8829}, Characters: []byte{0xe2, 0x89, 0xbd}}, "SucceedsTilde": {Name: "SucceedsTilde", CodePoints: []int{8831}, Characters: []byte{0xe2, 0x89, 0xbf}}, "SuchThat": {Name: "SuchThat", CodePoints: []int{8715}, Characters: []byte{0xe2, 0x88, 0x8b}}, "Sum": {Name: "Sum", CodePoints: []int{8721}, Characters: []byte{0xe2, 0x88, 0x91}}, "Sup": {Name: "Sup", CodePoints: []int{8913}, Characters: []byte{0xe2, 0x8b, 0x91}}, "Superset": {Name: "Superset", CodePoints: []int{8835}, Characters: []byte{0xe2, 0x8a, 0x83}}, "SupersetEqual": {Name: "SupersetEqual", CodePoints: []int{8839}, Characters: []byte{0xe2, 0x8a, 0x87}}, "Supset": {Name: "Supset", CodePoints: []int{8913}, Characters: []byte{0xe2, 0x8b, 0x91}}, "THORN": {Name: "THORN", CodePoints: []int{222}, Characters: []byte{0xc3, 0x9e}}, "TRADE": {Name: "TRADE", CodePoints: []int{8482}, Characters: []byte{0xe2, 0x84, 0xa2}}, "TSHcy": {Name: "TSHcy", CodePoints: []int{1035}, Characters: []byte{0xd0, 0x8b}}, "TScy": {Name: "TScy", CodePoints: []int{1062}, Characters: []byte{0xd0, 0xa6}}, "Tab": {Name: "Tab", CodePoints: []int{9}, Characters: []byte{0x9}}, "Tau": {Name: "Tau", CodePoints: []int{932}, Characters: []byte{0xce, 0xa4}}, "Tcaron": {Name: "Tcaron", CodePoints: []int{356}, Characters: []byte{0xc5, 0xa4}}, "Tcedil": {Name: "Tcedil", CodePoints: []int{354}, Characters: []byte{0xc5, 0xa2}}, "Tcy": {Name: "Tcy", CodePoints: []int{1058}, Characters: []byte{0xd0, 0xa2}}, "Tfr": {Name: "Tfr", CodePoints: []int{120087}, Characters: []byte{0xf0, 0x9d, 0x94, 0x97}}, "Therefore": {Name: "Therefore", CodePoints: []int{8756}, Characters: []byte{0xe2, 0x88, 0xb4}}, "Theta": {Name: "Theta", CodePoints: []int{920}, Characters: []byte{0xce, 0x98}}, "ThickSpace": {Name: "ThickSpace", CodePoints: []int{8287, 8202}, Characters: []byte{0xe2, 0x81, 0x9f, 0xe2, 0x80, 0x8a}}, "ThinSpace": {Name: "ThinSpace", CodePoints: []int{8201}, Characters: []byte{0xe2, 0x80, 0x89}}, "Tilde": {Name: "Tilde", CodePoints: []int{8764}, Characters: []byte{0xe2, 0x88, 0xbc}}, "TildeEqual": {Name: "TildeEqual", CodePoints: []int{8771}, Characters: []byte{0xe2, 0x89, 0x83}}, "TildeFullEqual": {Name: "TildeFullEqual", CodePoints: []int{8773}, Characters: []byte{0xe2, 0x89, 0x85}}, "TildeTilde": {Name: "TildeTilde", CodePoints: []int{8776}, Characters: []byte{0xe2, 0x89, 0x88}}, "Topf": {Name: "Topf", CodePoints: []int{120139}, Characters: []byte{0xf0, 0x9d, 0x95, 0x8b}}, "TripleDot": {Name: "TripleDot", CodePoints: []int{8411}, Characters: []byte{0xe2, 0x83, 0x9b}}, "Tscr": {Name: "Tscr", CodePoints: []int{119983}, Characters: []byte{0xf0, 0x9d, 0x92, 0xaf}}, "Tstrok": {Name: "Tstrok", CodePoints: []int{358}, Characters: []byte{0xc5, 0xa6}}, "Uacute": {Name: "Uacute", CodePoints: []int{218}, Characters: []byte{0xc3, 0x9a}}, "Uarr": {Name: "Uarr", CodePoints: []int{8607}, Characters: []byte{0xe2, 0x86, 0x9f}}, "Uarrocir": {Name: "Uarrocir", CodePoints: []int{10569}, Characters: []byte{0xe2, 0xa5, 0x89}}, "Ubrcy": {Name: "Ubrcy", CodePoints: []int{1038}, Characters: []byte{0xd0, 0x8e}}, "Ubreve": {Name: "Ubreve", CodePoints: []int{364}, Characters: []byte{0xc5, 0xac}}, "Ucirc": {Name: "Ucirc", CodePoints: []int{219}, Characters: []byte{0xc3, 0x9b}}, "Ucy": {Name: "Ucy", CodePoints: []int{1059}, Characters: []byte{0xd0, 0xa3}}, "Udblac": {Name: "Udblac", CodePoints: []int{368}, Characters: []byte{0xc5, 0xb0}}, "Ufr": {Name: "Ufr", CodePoints: []int{120088}, Characters: []byte{0xf0, 0x9d, 0x94, 0x98}}, "Ugrave": {Name: "Ugrave", CodePoints: []int{217}, Characters: []byte{0xc3, 0x99}}, "Umacr": {Name: "Umacr", CodePoints: []int{362}, Characters: []byte{0xc5, 0xaa}}, "UnderBar": {Name: "UnderBar", CodePoints: []int{95}, Characters: []byte{0x5f}}, "UnderBrace": {Name: "UnderBrace", CodePoints: []int{9183}, Characters: []byte{0xe2, 0x8f, 0x9f}}, "UnderBracket": {Name: "UnderBracket", CodePoints: []int{9141}, Characters: []byte{0xe2, 0x8e, 0xb5}}, "UnderParenthesis": {Name: "UnderParenthesis", CodePoints: []int{9181}, Characters: []byte{0xe2, 0x8f, 0x9d}}, "Union": {Name: "Union", CodePoints: []int{8899}, Characters: []byte{0xe2, 0x8b, 0x83}}, "UnionPlus": {Name: "UnionPlus", CodePoints: []int{8846}, Characters: []byte{0xe2, 0x8a, 0x8e}}, "Uogon": {Name: "Uogon", CodePoints: []int{370}, Characters: []byte{0xc5, 0xb2}}, "Uopf": {Name: "Uopf", CodePoints: []int{120140}, Characters: []byte{0xf0, 0x9d, 0x95, 0x8c}}, "UpArrow": {Name: "UpArrow", CodePoints: []int{8593}, Characters: []byte{0xe2, 0x86, 0x91}}, "UpArrowBar": {Name: "UpArrowBar", CodePoints: []int{10514}, Characters: []byte{0xe2, 0xa4, 0x92}}, "UpArrowDownArrow": {Name: "UpArrowDownArrow", CodePoints: []int{8645}, Characters: []byte{0xe2, 0x87, 0x85}}, "UpDownArrow": {Name: "UpDownArrow", CodePoints: []int{8597}, Characters: []byte{0xe2, 0x86, 0x95}}, "UpEquilibrium": {Name: "UpEquilibrium", CodePoints: []int{10606}, Characters: []byte{0xe2, 0xa5, 0xae}}, "UpTee": {Name: "UpTee", CodePoints: []int{8869}, Characters: []byte{0xe2, 0x8a, 0xa5}}, "UpTeeArrow": {Name: "UpTeeArrow", CodePoints: []int{8613}, Characters: []byte{0xe2, 0x86, 0xa5}}, "Uparrow": {Name: "Uparrow", CodePoints: []int{8657}, Characters: []byte{0xe2, 0x87, 0x91}}, "Updownarrow": {Name: "Updownarrow", CodePoints: []int{8661}, Characters: []byte{0xe2, 0x87, 0x95}}, "UpperLeftArrow": {Name: "UpperLeftArrow", CodePoints: []int{8598}, Characters: []byte{0xe2, 0x86, 0x96}}, "UpperRightArrow": {Name: "UpperRightArrow", CodePoints: []int{8599}, Characters: []byte{0xe2, 0x86, 0x97}}, "Upsi": {Name: "Upsi", CodePoints: []int{978}, Characters: []byte{0xcf, 0x92}}, "Upsilon": {Name: "Upsilon", CodePoints: []int{933}, Characters: []byte{0xce, 0xa5}}, "Uring": {Name: "Uring", CodePoints: []int{366}, Characters: []byte{0xc5, 0xae}}, "Uscr": {Name: "Uscr", CodePoints: []int{119984}, Characters: []byte{0xf0, 0x9d, 0x92, 0xb0}}, "Utilde": {Name: "Utilde", CodePoints: []int{360}, Characters: []byte{0xc5, 0xa8}}, "Uuml": {Name: "Uuml", CodePoints: []int{220}, Characters: []byte{0xc3, 0x9c}}, "VDash": {Name: "VDash", CodePoints: []int{8875}, Characters: []byte{0xe2, 0x8a, 0xab}}, "Vbar": {Name: "Vbar", CodePoints: []int{10987}, Characters: []byte{0xe2, 0xab, 0xab}}, "Vcy": {Name: "Vcy", CodePoints: []int{1042}, Characters: []byte{0xd0, 0x92}}, "Vdash": {Name: "Vdash", CodePoints: []int{8873}, Characters: []byte{0xe2, 0x8a, 0xa9}}, "Vdashl": {Name: "Vdashl", CodePoints: []int{10982}, Characters: []byte{0xe2, 0xab, 0xa6}}, "Vee": {Name: "Vee", CodePoints: []int{8897}, Characters: []byte{0xe2, 0x8b, 0x81}}, "Verbar": {Name: "Verbar", CodePoints: []int{8214}, Characters: []byte{0xe2, 0x80, 0x96}}, "Vert": {Name: "Vert", CodePoints: []int{8214}, Characters: []byte{0xe2, 0x80, 0x96}}, "VerticalBar": {Name: "VerticalBar", CodePoints: []int{8739}, Characters: []byte{0xe2, 0x88, 0xa3}}, "VerticalLine": {Name: "VerticalLine", CodePoints: []int{124}, Characters: []byte{0x7c}}, "VerticalSeparator": {Name: "VerticalSeparator", CodePoints: []int{10072}, Characters: []byte{0xe2, 0x9d, 0x98}}, "VerticalTilde": {Name: "VerticalTilde", CodePoints: []int{8768}, Characters: []byte{0xe2, 0x89, 0x80}}, "VeryThinSpace": {Name: "VeryThinSpace", CodePoints: []int{8202}, Characters: []byte{0xe2, 0x80, 0x8a}}, "Vfr": {Name: "Vfr", CodePoints: []int{120089}, Characters: []byte{0xf0, 0x9d, 0x94, 0x99}}, "Vopf": {Name: "Vopf", CodePoints: []int{120141}, Characters: []byte{0xf0, 0x9d, 0x95, 0x8d}}, "Vscr": {Name: "Vscr", CodePoints: []int{119985}, Characters: []byte{0xf0, 0x9d, 0x92, 0xb1}}, "Vvdash": {Name: "Vvdash", CodePoints: []int{8874}, Characters: []byte{0xe2, 0x8a, 0xaa}}, "Wcirc": {Name: "Wcirc", CodePoints: []int{372}, Characters: []byte{0xc5, 0xb4}}, "Wedge": {Name: "Wedge", CodePoints: []int{8896}, Characters: []byte{0xe2, 0x8b, 0x80}}, "Wfr": {Name: "Wfr", CodePoints: []int{120090}, Characters: []byte{0xf0, 0x9d, 0x94, 0x9a}}, "Wopf": {Name: "Wopf", CodePoints: []int{120142}, Characters: []byte{0xf0, 0x9d, 0x95, 0x8e}}, "Wscr": {Name: "Wscr", CodePoints: []int{119986}, Characters: []byte{0xf0, 0x9d, 0x92, 0xb2}}, "Xfr": {Name: "Xfr", CodePoints: []int{120091}, Characters: []byte{0xf0, 0x9d, 0x94, 0x9b}}, "Xi": {Name: "Xi", CodePoints: []int{926}, Characters: []byte{0xce, 0x9e}}, "Xopf": {Name: "Xopf", CodePoints: []int{120143}, Characters: []byte{0xf0, 0x9d, 0x95, 0x8f}}, "Xscr": {Name: "Xscr", CodePoints: []int{119987}, Characters: []byte{0xf0, 0x9d, 0x92, 0xb3}}, "YAcy": {Name: "YAcy", CodePoints: []int{1071}, Characters: []byte{0xd0, 0xaf}}, "YIcy": {Name: "YIcy", CodePoints: []int{1031}, Characters: []byte{0xd0, 0x87}}, "YUcy": {Name: "YUcy", CodePoints: []int{1070}, Characters: []byte{0xd0, 0xae}}, "Yacute": {Name: "Yacute", CodePoints: []int{221}, Characters: []byte{0xc3, 0x9d}}, "Ycirc": {Name: "Ycirc", CodePoints: []int{374}, Characters: []byte{0xc5, 0xb6}}, "Ycy": {Name: "Ycy", CodePoints: []int{1067}, Characters: []byte{0xd0, 0xab}}, "Yfr": {Name: "Yfr", CodePoints: []int{120092}, Characters: []byte{0xf0, 0x9d, 0x94, 0x9c}}, "Yopf": {Name: "Yopf", CodePoints: []int{120144}, Characters: []byte{0xf0, 0x9d, 0x95, 0x90}}, "Yscr": {Name: "Yscr", CodePoints: []int{119988}, Characters: []byte{0xf0, 0x9d, 0x92, 0xb4}}, "Yuml": {Name: "Yuml", CodePoints: []int{376}, Characters: []byte{0xc5, 0xb8}}, "ZHcy": {Name: "ZHcy", CodePoints: []int{1046}, Characters: []byte{0xd0, 0x96}}, "Zacute": {Name: "Zacute", CodePoints: []int{377}, Characters: []byte{0xc5, 0xb9}}, "Zcaron": {Name: "Zcaron", CodePoints: []int{381}, Characters: []byte{0xc5, 0xbd}}, "Zcy": {Name: "Zcy", CodePoints: []int{1047}, Characters: []byte{0xd0, 0x97}}, "Zdot": {Name: "Zdot", CodePoints: []int{379}, Characters: []byte{0xc5, 0xbb}}, "ZeroWidthSpace": {Name: "ZeroWidthSpace", CodePoints: []int{8203}, Characters: []byte{0xe2, 0x80, 0x8b}}, "Zeta": {Name: "Zeta", CodePoints: []int{918}, Characters: []byte{0xce, 0x96}}, "Zfr": {Name: "Zfr", CodePoints: []int{8488}, Characters: []byte{0xe2, 0x84, 0xa8}}, "Zopf": {Name: "Zopf", CodePoints: []int{8484}, Characters: []byte{0xe2, 0x84, 0xa4}}, "Zscr": {Name: "Zscr", CodePoints: []int{119989}, Characters: []byte{0xf0, 0x9d, 0x92, 0xb5}}, "aacute": {Name: "aacute", CodePoints: []int{225}, Characters: []byte{0xc3, 0xa1}}, "abreve": {Name: "abreve", CodePoints: []int{259}, Characters: []byte{0xc4, 0x83}}, "ac": {Name: "ac", CodePoints: []int{8766}, Characters: []byte{0xe2, 0x88, 0xbe}}, "acE": {Name: "acE", CodePoints: []int{8766, 819}, Characters: []byte{0xe2, 0x88, 0xbe, 0xcc, 0xb3}}, "acd": {Name: "acd", CodePoints: []int{8767}, Characters: []byte{0xe2, 0x88, 0xbf}}, "acirc": {Name: "acirc", CodePoints: []int{226}, Characters: []byte{0xc3, 0xa2}}, "acute": {Name: "acute", CodePoints: []int{180}, Characters: []byte{0xc2, 0xb4}}, "acy": {Name: "acy", CodePoints: []int{1072}, Characters: []byte{0xd0, 0xb0}}, "aelig": {Name: "aelig", CodePoints: []int{230}, Characters: []byte{0xc3, 0xa6}}, "af": {Name: "af", CodePoints: []int{8289}, Characters: []byte{0xe2, 0x81, 0xa1}}, "afr": {Name: "afr", CodePoints: []int{120094}, Characters: []byte{0xf0, 0x9d, 0x94, 0x9e}}, "agrave": {Name: "agrave", CodePoints: []int{224}, Characters: []byte{0xc3, 0xa0}}, "alefsym": {Name: "alefsym", CodePoints: []int{8501}, Characters: []byte{0xe2, 0x84, 0xb5}}, "aleph": {Name: "aleph", CodePoints: []int{8501}, Characters: []byte{0xe2, 0x84, 0xb5}}, "alpha": {Name: "alpha", CodePoints: []int{945}, Characters: []byte{0xce, 0xb1}}, "amacr": {Name: "amacr", CodePoints: []int{257}, Characters: []byte{0xc4, 0x81}}, "amalg": {Name: "amalg", CodePoints: []int{10815}, Characters: []byte{0xe2, 0xa8, 0xbf}}, "amp": {Name: "amp", CodePoints: []int{38}, Characters: []byte{0x26}}, "and": {Name: "and", CodePoints: []int{8743}, Characters: []byte{0xe2, 0x88, 0xa7}}, "andand": {Name: "andand", CodePoints: []int{10837}, Characters: []byte{0xe2, 0xa9, 0x95}}, "andd": {Name: "andd", CodePoints: []int{10844}, Characters: []byte{0xe2, 0xa9, 0x9c}}, "andslope": {Name: "andslope", CodePoints: []int{10840}, Characters: []byte{0xe2, 0xa9, 0x98}}, "andv": {Name: "andv", CodePoints: []int{10842}, Characters: []byte{0xe2, 0xa9, 0x9a}}, "ang": {Name: "ang", CodePoints: []int{8736}, Characters: []byte{0xe2, 0x88, 0xa0}}, "ange": {Name: "ange", CodePoints: []int{10660}, Characters: []byte{0xe2, 0xa6, 0xa4}}, "angle": {Name: "angle", CodePoints: []int{8736}, Characters: []byte{0xe2, 0x88, 0xa0}}, "angmsd": {Name: "angmsd", CodePoints: []int{8737}, Characters: []byte{0xe2, 0x88, 0xa1}}, "angmsdaa": {Name: "angmsdaa", CodePoints: []int{10664}, Characters: []byte{0xe2, 0xa6, 0xa8}}, "angmsdab": {Name: "angmsdab", CodePoints: []int{10665}, Characters: []byte{0xe2, 0xa6, 0xa9}}, "angmsdac": {Name: "angmsdac", CodePoints: []int{10666}, Characters: []byte{0xe2, 0xa6, 0xaa}}, "angmsdad": {Name: "angmsdad", CodePoints: []int{10667}, Characters: []byte{0xe2, 0xa6, 0xab}}, "angmsdae": {Name: "angmsdae", CodePoints: []int{10668}, Characters: []byte{0xe2, 0xa6, 0xac}}, "angmsdaf": {Name: "angmsdaf", CodePoints: []int{10669}, Characters: []byte{0xe2, 0xa6, 0xad}}, "angmsdag": {Name: "angmsdag", CodePoints: []int{10670}, Characters: []byte{0xe2, 0xa6, 0xae}}, "angmsdah": {Name: "angmsdah", CodePoints: []int{10671}, Characters: []byte{0xe2, 0xa6, 0xaf}}, "angrt": {Name: "angrt", CodePoints: []int{8735}, Characters: []byte{0xe2, 0x88, 0x9f}}, "angrtvb": {Name: "angrtvb", CodePoints: []int{8894}, Characters: []byte{0xe2, 0x8a, 0xbe}}, "angrtvbd": {Name: "angrtvbd", CodePoints: []int{10653}, Characters: []byte{0xe2, 0xa6, 0x9d}}, "angsph": {Name: "angsph", CodePoints: []int{8738}, Characters: []byte{0xe2, 0x88, 0xa2}}, "angst": {Name: "angst", CodePoints: []int{197}, Characters: []byte{0xc3, 0x85}}, "angzarr": {Name: "angzarr", CodePoints: []int{9084}, Characters: []byte{0xe2, 0x8d, 0xbc}}, "aogon": {Name: "aogon", CodePoints: []int{261}, Characters: []byte{0xc4, 0x85}}, "aopf": {Name: "aopf", CodePoints: []int{120146}, Characters: []byte{0xf0, 0x9d, 0x95, 0x92}}, "ap": {Name: "ap", CodePoints: []int{8776}, Characters: []byte{0xe2, 0x89, 0x88}}, "apE": {Name: "apE", CodePoints: []int{10864}, Characters: []byte{0xe2, 0xa9, 0xb0}}, "apacir": {Name: "apacir", CodePoints: []int{10863}, Characters: []byte{0xe2, 0xa9, 0xaf}}, "ape": {Name: "ape", CodePoints: []int{8778}, Characters: []byte{0xe2, 0x89, 0x8a}}, "apid": {Name: "apid", CodePoints: []int{8779}, Characters: []byte{0xe2, 0x89, 0x8b}}, "apos": {Name: "apos", CodePoints: []int{39}, Characters: []byte{0x27}}, "approx": {Name: "approx", CodePoints: []int{8776}, Characters: []byte{0xe2, 0x89, 0x88}}, "approxeq": {Name: "approxeq", CodePoints: []int{8778}, Characters: []byte{0xe2, 0x89, 0x8a}}, "aring": {Name: "aring", CodePoints: []int{229}, Characters: []byte{0xc3, 0xa5}}, "ascr": {Name: "ascr", CodePoints: []int{119990}, Characters: []byte{0xf0, 0x9d, 0x92, 0xb6}}, "ast": {Name: "ast", CodePoints: []int{42}, Characters: []byte{0x2a}}, "asymp": {Name: "asymp", CodePoints: []int{8776}, Characters: []byte{0xe2, 0x89, 0x88}}, "asympeq": {Name: "asympeq", CodePoints: []int{8781}, Characters: []byte{0xe2, 0x89, 0x8d}}, "atilde": {Name: "atilde", CodePoints: []int{227}, Characters: []byte{0xc3, 0xa3}}, "auml": {Name: "auml", CodePoints: []int{228}, Characters: []byte{0xc3, 0xa4}}, "awconint": {Name: "awconint", CodePoints: []int{8755}, Characters: []byte{0xe2, 0x88, 0xb3}}, "awint": {Name: "awint", CodePoints: []int{10769}, Characters: []byte{0xe2, 0xa8, 0x91}}, "bNot": {Name: "bNot", CodePoints: []int{10989}, Characters: []byte{0xe2, 0xab, 0xad}}, "backcong": {Name: "backcong", CodePoints: []int{8780}, Characters: []byte{0xe2, 0x89, 0x8c}}, "backepsilon": {Name: "backepsilon", CodePoints: []int{1014}, Characters: []byte{0xcf, 0xb6}}, "backprime": {Name: "backprime", CodePoints: []int{8245}, Characters: []byte{0xe2, 0x80, 0xb5}}, "backsim": {Name: "backsim", CodePoints: []int{8765}, Characters: []byte{0xe2, 0x88, 0xbd}}, "backsimeq": {Name: "backsimeq", CodePoints: []int{8909}, Characters: []byte{0xe2, 0x8b, 0x8d}}, "barvee": {Name: "barvee", CodePoints: []int{8893}, Characters: []byte{0xe2, 0x8a, 0xbd}}, "barwed": {Name: "barwed", CodePoints: []int{8965}, Characters: []byte{0xe2, 0x8c, 0x85}}, "barwedge": {Name: "barwedge", CodePoints: []int{8965}, Characters: []byte{0xe2, 0x8c, 0x85}}, "bbrk": {Name: "bbrk", CodePoints: []int{9141}, Characters: []byte{0xe2, 0x8e, 0xb5}}, "bbrktbrk": {Name: "bbrktbrk", CodePoints: []int{9142}, Characters: []byte{0xe2, 0x8e, 0xb6}}, "bcong": {Name: "bcong", CodePoints: []int{8780}, Characters: []byte{0xe2, 0x89, 0x8c}}, "bcy": {Name: "bcy", CodePoints: []int{1073}, Characters: []byte{0xd0, 0xb1}}, "bdquo": {Name: "bdquo", CodePoints: []int{8222}, Characters: []byte{0xe2, 0x80, 0x9e}}, "becaus": {Name: "becaus", CodePoints: []int{8757}, Characters: []byte{0xe2, 0x88, 0xb5}}, "because": {Name: "because", CodePoints: []int{8757}, Characters: []byte{0xe2, 0x88, 0xb5}}, "bemptyv": {Name: "bemptyv", CodePoints: []int{10672}, Characters: []byte{0xe2, 0xa6, 0xb0}}, "bepsi": {Name: "bepsi", CodePoints: []int{1014}, Characters: []byte{0xcf, 0xb6}}, "bernou": {Name: "bernou", CodePoints: []int{8492}, Characters: []byte{0xe2, 0x84, 0xac}}, "beta": {Name: "beta", CodePoints: []int{946}, Characters: []byte{0xce, 0xb2}}, "beth": {Name: "beth", CodePoints: []int{8502}, Characters: []byte{0xe2, 0x84, 0xb6}}, "between": {Name: "between", CodePoints: []int{8812}, Characters: []byte{0xe2, 0x89, 0xac}}, "bfr": {Name: "bfr", CodePoints: []int{120095}, Characters: []byte{0xf0, 0x9d, 0x94, 0x9f}}, "bigcap": {Name: "bigcap", CodePoints: []int{8898}, Characters: []byte{0xe2, 0x8b, 0x82}}, "bigcirc": {Name: "bigcirc", CodePoints: []int{9711}, Characters: []byte{0xe2, 0x97, 0xaf}}, "bigcup": {Name: "bigcup", CodePoints: []int{8899}, Characters: []byte{0xe2, 0x8b, 0x83}}, "bigodot": {Name: "bigodot", CodePoints: []int{10752}, Characters: []byte{0xe2, 0xa8, 0x80}}, "bigoplus": {Name: "bigoplus", CodePoints: []int{10753}, Characters: []byte{0xe2, 0xa8, 0x81}}, "bigotimes": {Name: "bigotimes", CodePoints: []int{10754}, Characters: []byte{0xe2, 0xa8, 0x82}}, "bigsqcup": {Name: "bigsqcup", CodePoints: []int{10758}, Characters: []byte{0xe2, 0xa8, 0x86}}, "bigstar": {Name: "bigstar", CodePoints: []int{9733}, Characters: []byte{0xe2, 0x98, 0x85}}, "bigtriangledown": {Name: "bigtriangledown", CodePoints: []int{9661}, Characters: []byte{0xe2, 0x96, 0xbd}}, "bigtriangleup": {Name: "bigtriangleup", CodePoints: []int{9651}, Characters: []byte{0xe2, 0x96, 0xb3}}, "biguplus": {Name: "biguplus", CodePoints: []int{10756}, Characters: []byte{0xe2, 0xa8, 0x84}}, "bigvee": {Name: "bigvee", CodePoints: []int{8897}, Characters: []byte{0xe2, 0x8b, 0x81}}, "bigwedge": {Name: "bigwedge", CodePoints: []int{8896}, Characters: []byte{0xe2, 0x8b, 0x80}}, "bkarow": {Name: "bkarow", CodePoints: []int{10509}, Characters: []byte{0xe2, 0xa4, 0x8d}}, "blacklozenge": {Name: "blacklozenge", CodePoints: []int{10731}, Characters: []byte{0xe2, 0xa7, 0xab}}, "blacksquare": {Name: "blacksquare", CodePoints: []int{9642}, Characters: []byte{0xe2, 0x96, 0xaa}}, "blacktriangle": {Name: "blacktriangle", CodePoints: []int{9652}, Characters: []byte{0xe2, 0x96, 0xb4}}, "blacktriangledown": {Name: "blacktriangledown", CodePoints: []int{9662}, Characters: []byte{0xe2, 0x96, 0xbe}}, "blacktriangleleft": {Name: "blacktriangleleft", CodePoints: []int{9666}, Characters: []byte{0xe2, 0x97, 0x82}}, "blacktriangleright": {Name: "blacktriangleright", CodePoints: []int{9656}, Characters: []byte{0xe2, 0x96, 0xb8}}, "blank": {Name: "blank", CodePoints: []int{9251}, Characters: []byte{0xe2, 0x90, 0xa3}}, "blk12": {Name: "blk12", CodePoints: []int{9618}, Characters: []byte{0xe2, 0x96, 0x92}}, "blk14": {Name: "blk14", CodePoints: []int{9617}, Characters: []byte{0xe2, 0x96, 0x91}}, "blk34": {Name: "blk34", CodePoints: []int{9619}, Characters: []byte{0xe2, 0x96, 0x93}}, "block": {Name: "block", CodePoints: []int{9608}, Characters: []byte{0xe2, 0x96, 0x88}}, "bne": {Name: "bne", CodePoints: []int{61, 8421}, Characters: []byte{0x3d, 0xe2, 0x83, 0xa5}}, "bnequiv": {Name: "bnequiv", CodePoints: []int{8801, 8421}, Characters: []byte{0xe2, 0x89, 0xa1, 0xe2, 0x83, 0xa5}}, "bnot": {Name: "bnot", CodePoints: []int{8976}, Characters: []byte{0xe2, 0x8c, 0x90}}, "bopf": {Name: "bopf", CodePoints: []int{120147}, Characters: []byte{0xf0, 0x9d, 0x95, 0x93}}, "bot": {Name: "bot", CodePoints: []int{8869}, Characters: []byte{0xe2, 0x8a, 0xa5}}, "bottom": {Name: "bottom", CodePoints: []int{8869}, Characters: []byte{0xe2, 0x8a, 0xa5}}, "bowtie": {Name: "bowtie", CodePoints: []int{8904}, Characters: []byte{0xe2, 0x8b, 0x88}}, "boxDL": {Name: "boxDL", CodePoints: []int{9559}, Characters: []byte{0xe2, 0x95, 0x97}}, "boxDR": {Name: "boxDR", CodePoints: []int{9556}, Characters: []byte{0xe2, 0x95, 0x94}}, "boxDl": {Name: "boxDl", CodePoints: []int{9558}, Characters: []byte{0xe2, 0x95, 0x96}}, "boxDr": {Name: "boxDr", CodePoints: []int{9555}, Characters: []byte{0xe2, 0x95, 0x93}}, "boxH": {Name: "boxH", CodePoints: []int{9552}, Characters: []byte{0xe2, 0x95, 0x90}}, "boxHD": {Name: "boxHD", CodePoints: []int{9574}, Characters: []byte{0xe2, 0x95, 0xa6}}, "boxHU": {Name: "boxHU", CodePoints: []int{9577}, Characters: []byte{0xe2, 0x95, 0xa9}}, "boxHd": {Name: "boxHd", CodePoints: []int{9572}, Characters: []byte{0xe2, 0x95, 0xa4}}, "boxHu": {Name: "boxHu", CodePoints: []int{9575}, Characters: []byte{0xe2, 0x95, 0xa7}}, "boxUL": {Name: "boxUL", CodePoints: []int{9565}, Characters: []byte{0xe2, 0x95, 0x9d}}, "boxUR": {Name: "boxUR", CodePoints: []int{9562}, Characters: []byte{0xe2, 0x95, 0x9a}}, "boxUl": {Name: "boxUl", CodePoints: []int{9564}, Characters: []byte{0xe2, 0x95, 0x9c}}, "boxUr": {Name: "boxUr", CodePoints: []int{9561}, Characters: []byte{0xe2, 0x95, 0x99}}, "boxV": {Name: "boxV", CodePoints: []int{9553}, Characters: []byte{0xe2, 0x95, 0x91}}, "boxVH": {Name: "boxVH", CodePoints: []int{9580}, Characters: []byte{0xe2, 0x95, 0xac}}, "boxVL": {Name: "boxVL", CodePoints: []int{9571}, Characters: []byte{0xe2, 0x95, 0xa3}}, "boxVR": {Name: "boxVR", CodePoints: []int{9568}, Characters: []byte{0xe2, 0x95, 0xa0}}, "boxVh": {Name: "boxVh", CodePoints: []int{9579}, Characters: []byte{0xe2, 0x95, 0xab}}, "boxVl": {Name: "boxVl", CodePoints: []int{9570}, Characters: []byte{0xe2, 0x95, 0xa2}}, "boxVr": {Name: "boxVr", CodePoints: []int{9567}, Characters: []byte{0xe2, 0x95, 0x9f}}, "boxbox": {Name: "boxbox", CodePoints: []int{10697}, Characters: []byte{0xe2, 0xa7, 0x89}}, "boxdL": {Name: "boxdL", CodePoints: []int{9557}, Characters: []byte{0xe2, 0x95, 0x95}}, "boxdR": {Name: "boxdR", CodePoints: []int{9554}, Characters: []byte{0xe2, 0x95, 0x92}}, "boxdl": {Name: "boxdl", CodePoints: []int{9488}, Characters: []byte{0xe2, 0x94, 0x90}}, "boxdr": {Name: "boxdr", CodePoints: []int{9484}, Characters: []byte{0xe2, 0x94, 0x8c}}, "boxh": {Name: "boxh", CodePoints: []int{9472}, Characters: []byte{0xe2, 0x94, 0x80}}, "boxhD": {Name: "boxhD", CodePoints: []int{9573}, Characters: []byte{0xe2, 0x95, 0xa5}}, "boxhU": {Name: "boxhU", CodePoints: []int{9576}, Characters: []byte{0xe2, 0x95, 0xa8}}, "boxhd": {Name: "boxhd", CodePoints: []int{9516}, Characters: []byte{0xe2, 0x94, 0xac}}, "boxhu": {Name: "boxhu", CodePoints: []int{9524}, Characters: []byte{0xe2, 0x94, 0xb4}}, "boxminus": {Name: "boxminus", CodePoints: []int{8863}, Characters: []byte{0xe2, 0x8a, 0x9f}}, "boxplus": {Name: "boxplus", CodePoints: []int{8862}, Characters: []byte{0xe2, 0x8a, 0x9e}}, "boxtimes": {Name: "boxtimes", CodePoints: []int{8864}, Characters: []byte{0xe2, 0x8a, 0xa0}}, "boxuL": {Name: "boxuL", CodePoints: []int{9563}, Characters: []byte{0xe2, 0x95, 0x9b}}, "boxuR": {Name: "boxuR", CodePoints: []int{9560}, Characters: []byte{0xe2, 0x95, 0x98}}, "boxul": {Name: "boxul", CodePoints: []int{9496}, Characters: []byte{0xe2, 0x94, 0x98}}, "boxur": {Name: "boxur", CodePoints: []int{9492}, Characters: []byte{0xe2, 0x94, 0x94}}, "boxv": {Name: "boxv", CodePoints: []int{9474}, Characters: []byte{0xe2, 0x94, 0x82}}, "boxvH": {Name: "boxvH", CodePoints: []int{9578}, Characters: []byte{0xe2, 0x95, 0xaa}}, "boxvL": {Name: "boxvL", CodePoints: []int{9569}, Characters: []byte{0xe2, 0x95, 0xa1}}, "boxvR": {Name: "boxvR", CodePoints: []int{9566}, Characters: []byte{0xe2, 0x95, 0x9e}}, "boxvh": {Name: "boxvh", CodePoints: []int{9532}, Characters: []byte{0xe2, 0x94, 0xbc}}, "boxvl": {Name: "boxvl", CodePoints: []int{9508}, Characters: []byte{0xe2, 0x94, 0xa4}}, "boxvr": {Name: "boxvr", CodePoints: []int{9500}, Characters: []byte{0xe2, 0x94, 0x9c}}, "bprime": {Name: "bprime", CodePoints: []int{8245}, Characters: []byte{0xe2, 0x80, 0xb5}}, "breve": {Name: "breve", CodePoints: []int{728}, Characters: []byte{0xcb, 0x98}}, "brvbar": {Name: "brvbar", CodePoints: []int{166}, Characters: []byte{0xc2, 0xa6}}, "bscr": {Name: "bscr", CodePoints: []int{119991}, Characters: []byte{0xf0, 0x9d, 0x92, 0xb7}}, "bsemi": {Name: "bsemi", CodePoints: []int{8271}, Characters: []byte{0xe2, 0x81, 0x8f}}, "bsim": {Name: "bsim", CodePoints: []int{8765}, Characters: []byte{0xe2, 0x88, 0xbd}}, "bsime": {Name: "bsime", CodePoints: []int{8909}, Characters: []byte{0xe2, 0x8b, 0x8d}}, "bsol": {Name: "bsol", CodePoints: []int{92}, Characters: []byte{0x5c}}, "bsolb": {Name: "bsolb", CodePoints: []int{10693}, Characters: []byte{0xe2, 0xa7, 0x85}}, "bsolhsub": {Name: "bsolhsub", CodePoints: []int{10184}, Characters: []byte{0xe2, 0x9f, 0x88}}, "bull": {Name: "bull", CodePoints: []int{8226}, Characters: []byte{0xe2, 0x80, 0xa2}}, "bullet": {Name: "bullet", CodePoints: []int{8226}, Characters: []byte{0xe2, 0x80, 0xa2}}, "bump": {Name: "bump", CodePoints: []int{8782}, Characters: []byte{0xe2, 0x89, 0x8e}}, "bumpE": {Name: "bumpE", CodePoints: []int{10926}, Characters: []byte{0xe2, 0xaa, 0xae}}, "bumpe": {Name: "bumpe", CodePoints: []int{8783}, Characters: []byte{0xe2, 0x89, 0x8f}}, "bumpeq": {Name: "bumpeq", CodePoints: []int{8783}, Characters: []byte{0xe2, 0x89, 0x8f}}, "cacute": {Name: "cacute", CodePoints: []int{263}, Characters: []byte{0xc4, 0x87}}, "cap": {Name: "cap", CodePoints: []int{8745}, Characters: []byte{0xe2, 0x88, 0xa9}}, "capand": {Name: "capand", CodePoints: []int{10820}, Characters: []byte{0xe2, 0xa9, 0x84}}, "capbrcup": {Name: "capbrcup", CodePoints: []int{10825}, Characters: []byte{0xe2, 0xa9, 0x89}}, "capcap": {Name: "capcap", CodePoints: []int{10827}, Characters: []byte{0xe2, 0xa9, 0x8b}}, "capcup": {Name: "capcup", CodePoints: []int{10823}, Characters: []byte{0xe2, 0xa9, 0x87}}, "capdot": {Name: "capdot", CodePoints: []int{10816}, Characters: []byte{0xe2, 0xa9, 0x80}}, "caps": {Name: "caps", CodePoints: []int{8745, 65024}, Characters: []byte{0xe2, 0x88, 0xa9, 0xef, 0xb8, 0x80}}, "caret": {Name: "caret", CodePoints: []int{8257}, Characters: []byte{0xe2, 0x81, 0x81}}, "caron": {Name: "caron", CodePoints: []int{711}, Characters: []byte{0xcb, 0x87}}, "ccaps": {Name: "ccaps", CodePoints: []int{10829}, Characters: []byte{0xe2, 0xa9, 0x8d}}, "ccaron": {Name: "ccaron", CodePoints: []int{269}, Characters: []byte{0xc4, 0x8d}}, "ccedil": {Name: "ccedil", CodePoints: []int{231}, Characters: []byte{0xc3, 0xa7}}, "ccirc": {Name: "ccirc", CodePoints: []int{265}, Characters: []byte{0xc4, 0x89}}, "ccups": {Name: "ccups", CodePoints: []int{10828}, Characters: []byte{0xe2, 0xa9, 0x8c}}, "ccupssm": {Name: "ccupssm", CodePoints: []int{10832}, Characters: []byte{0xe2, 0xa9, 0x90}}, "cdot": {Name: "cdot", CodePoints: []int{267}, Characters: []byte{0xc4, 0x8b}}, "cedil": {Name: "cedil", CodePoints: []int{184}, Characters: []byte{0xc2, 0xb8}}, "cemptyv": {Name: "cemptyv", CodePoints: []int{10674}, Characters: []byte{0xe2, 0xa6, 0xb2}}, "cent": {Name: "cent", CodePoints: []int{162}, Characters: []byte{0xc2, 0xa2}}, "centerdot": {Name: "centerdot", CodePoints: []int{183}, Characters: []byte{0xc2, 0xb7}}, "cfr": {Name: "cfr", CodePoints: []int{120096}, Characters: []byte{0xf0, 0x9d, 0x94, 0xa0}}, "chcy": {Name: "chcy", CodePoints: []int{1095}, Characters: []byte{0xd1, 0x87}}, "check": {Name: "check", CodePoints: []int{10003}, Characters: []byte{0xe2, 0x9c, 0x93}}, "checkmark": {Name: "checkmark", CodePoints: []int{10003}, Characters: []byte{0xe2, 0x9c, 0x93}}, "chi": {Name: "chi", CodePoints: []int{967}, Characters: []byte{0xcf, 0x87}}, "cir": {Name: "cir", CodePoints: []int{9675}, Characters: []byte{0xe2, 0x97, 0x8b}}, "cirE": {Name: "cirE", CodePoints: []int{10691}, Characters: []byte{0xe2, 0xa7, 0x83}}, "circ": {Name: "circ", CodePoints: []int{710}, Characters: []byte{0xcb, 0x86}}, "circeq": {Name: "circeq", CodePoints: []int{8791}, Characters: []byte{0xe2, 0x89, 0x97}}, "circlearrowleft": {Name: "circlearrowleft", CodePoints: []int{8634}, Characters: []byte{0xe2, 0x86, 0xba}}, "circlearrowright": {Name: "circlearrowright", CodePoints: []int{8635}, Characters: []byte{0xe2, 0x86, 0xbb}}, "circledR": {Name: "circledR", CodePoints: []int{174}, Characters: []byte{0xc2, 0xae}}, "circledS": {Name: "circledS", CodePoints: []int{9416}, Characters: []byte{0xe2, 0x93, 0x88}}, "circledast": {Name: "circledast", CodePoints: []int{8859}, Characters: []byte{0xe2, 0x8a, 0x9b}}, "circledcirc": {Name: "circledcirc", CodePoints: []int{8858}, Characters: []byte{0xe2, 0x8a, 0x9a}}, "circleddash": {Name: "circleddash", CodePoints: []int{8861}, Characters: []byte{0xe2, 0x8a, 0x9d}}, "cire": {Name: "cire", CodePoints: []int{8791}, Characters: []byte{0xe2, 0x89, 0x97}}, "cirfnint": {Name: "cirfnint", CodePoints: []int{10768}, Characters: []byte{0xe2, 0xa8, 0x90}}, "cirmid": {Name: "cirmid", CodePoints: []int{10991}, Characters: []byte{0xe2, 0xab, 0xaf}}, "cirscir": {Name: "cirscir", CodePoints: []int{10690}, Characters: []byte{0xe2, 0xa7, 0x82}}, "clubs": {Name: "clubs", CodePoints: []int{9827}, Characters: []byte{0xe2, 0x99, 0xa3}}, "clubsuit": {Name: "clubsuit", CodePoints: []int{9827}, Characters: []byte{0xe2, 0x99, 0xa3}}, "colon": {Name: "colon", CodePoints: []int{58}, Characters: []byte{0x3a}}, "colone": {Name: "colone", CodePoints: []int{8788}, Characters: []byte{0xe2, 0x89, 0x94}}, "coloneq": {Name: "coloneq", CodePoints: []int{8788}, Characters: []byte{0xe2, 0x89, 0x94}}, "comma": {Name: "comma", CodePoints: []int{44}, Characters: []byte{0x2c}}, "commat": {Name: "commat", CodePoints: []int{64}, Characters: []byte{0x40}}, "comp": {Name: "comp", CodePoints: []int{8705}, Characters: []byte{0xe2, 0x88, 0x81}}, "compfn": {Name: "compfn", CodePoints: []int{8728}, Characters: []byte{0xe2, 0x88, 0x98}}, "complement": {Name: "complement", CodePoints: []int{8705}, Characters: []byte{0xe2, 0x88, 0x81}}, "complexes": {Name: "complexes", CodePoints: []int{8450}, Characters: []byte{0xe2, 0x84, 0x82}}, "cong": {Name: "cong", CodePoints: []int{8773}, Characters: []byte{0xe2, 0x89, 0x85}}, "congdot": {Name: "congdot", CodePoints: []int{10861}, Characters: []byte{0xe2, 0xa9, 0xad}}, "conint": {Name: "conint", CodePoints: []int{8750}, Characters: []byte{0xe2, 0x88, 0xae}}, "copf": {Name: "copf", CodePoints: []int{120148}, Characters: []byte{0xf0, 0x9d, 0x95, 0x94}}, "coprod": {Name: "coprod", CodePoints: []int{8720}, Characters: []byte{0xe2, 0x88, 0x90}}, "copy": {Name: "copy", CodePoints: []int{169}, Characters: []byte{0xc2, 0xa9}}, "copysr": {Name: "copysr", CodePoints: []int{8471}, Characters: []byte{0xe2, 0x84, 0x97}}, "crarr": {Name: "crarr", CodePoints: []int{8629}, Characters: []byte{0xe2, 0x86, 0xb5}}, "cross": {Name: "cross", CodePoints: []int{10007}, Characters: []byte{0xe2, 0x9c, 0x97}}, "cscr": {Name: "cscr", CodePoints: []int{119992}, Characters: []byte{0xf0, 0x9d, 0x92, 0xb8}}, "csub": {Name: "csub", CodePoints: []int{10959}, Characters: []byte{0xe2, 0xab, 0x8f}}, "csube": {Name: "csube", CodePoints: []int{10961}, Characters: []byte{0xe2, 0xab, 0x91}}, "csup": {Name: "csup", CodePoints: []int{10960}, Characters: []byte{0xe2, 0xab, 0x90}}, "csupe": {Name: "csupe", CodePoints: []int{10962}, Characters: []byte{0xe2, 0xab, 0x92}}, "ctdot": {Name: "ctdot", CodePoints: []int{8943}, Characters: []byte{0xe2, 0x8b, 0xaf}}, "cudarrl": {Name: "cudarrl", CodePoints: []int{10552}, Characters: []byte{0xe2, 0xa4, 0xb8}}, "cudarrr": {Name: "cudarrr", CodePoints: []int{10549}, Characters: []byte{0xe2, 0xa4, 0xb5}}, "cuepr": {Name: "cuepr", CodePoints: []int{8926}, Characters: []byte{0xe2, 0x8b, 0x9e}}, "cuesc": {Name: "cuesc", CodePoints: []int{8927}, Characters: []byte{0xe2, 0x8b, 0x9f}}, "cularr": {Name: "cularr", CodePoints: []int{8630}, Characters: []byte{0xe2, 0x86, 0xb6}}, "cularrp": {Name: "cularrp", CodePoints: []int{10557}, Characters: []byte{0xe2, 0xa4, 0xbd}}, "cup": {Name: "cup", CodePoints: []int{8746}, Characters: []byte{0xe2, 0x88, 0xaa}}, "cupbrcap": {Name: "cupbrcap", CodePoints: []int{10824}, Characters: []byte{0xe2, 0xa9, 0x88}}, "cupcap": {Name: "cupcap", CodePoints: []int{10822}, Characters: []byte{0xe2, 0xa9, 0x86}}, "cupcup": {Name: "cupcup", CodePoints: []int{10826}, Characters: []byte{0xe2, 0xa9, 0x8a}}, "cupdot": {Name: "cupdot", CodePoints: []int{8845}, Characters: []byte{0xe2, 0x8a, 0x8d}}, "cupor": {Name: "cupor", CodePoints: []int{10821}, Characters: []byte{0xe2, 0xa9, 0x85}}, "cups": {Name: "cups", CodePoints: []int{8746, 65024}, Characters: []byte{0xe2, 0x88, 0xaa, 0xef, 0xb8, 0x80}}, "curarr": {Name: "curarr", CodePoints: []int{8631}, Characters: []byte{0xe2, 0x86, 0xb7}}, "curarrm": {Name: "curarrm", CodePoints: []int{10556}, Characters: []byte{0xe2, 0xa4, 0xbc}}, "curlyeqprec": {Name: "curlyeqprec", CodePoints: []int{8926}, Characters: []byte{0xe2, 0x8b, 0x9e}}, "curlyeqsucc": {Name: "curlyeqsucc", CodePoints: []int{8927}, Characters: []byte{0xe2, 0x8b, 0x9f}}, "curlyvee": {Name: "curlyvee", CodePoints: []int{8910}, Characters: []byte{0xe2, 0x8b, 0x8e}}, "curlywedge": {Name: "curlywedge", CodePoints: []int{8911}, Characters: []byte{0xe2, 0x8b, 0x8f}}, "curren": {Name: "curren", CodePoints: []int{164}, Characters: []byte{0xc2, 0xa4}}, "curvearrowleft": {Name: "curvearrowleft", CodePoints: []int{8630}, Characters: []byte{0xe2, 0x86, 0xb6}}, "curvearrowright": {Name: "curvearrowright", CodePoints: []int{8631}, Characters: []byte{0xe2, 0x86, 0xb7}}, "cuvee": {Name: "cuvee", CodePoints: []int{8910}, Characters: []byte{0xe2, 0x8b, 0x8e}}, "cuwed": {Name: "cuwed", CodePoints: []int{8911}, Characters: []byte{0xe2, 0x8b, 0x8f}}, "cwconint": {Name: "cwconint", CodePoints: []int{8754}, Characters: []byte{0xe2, 0x88, 0xb2}}, "cwint": {Name: "cwint", CodePoints: []int{8753}, Characters: []byte{0xe2, 0x88, 0xb1}}, "cylcty": {Name: "cylcty", CodePoints: []int{9005}, Characters: []byte{0xe2, 0x8c, 0xad}}, "dArr": {Name: "dArr", CodePoints: []int{8659}, Characters: []byte{0xe2, 0x87, 0x93}}, "dHar": {Name: "dHar", CodePoints: []int{10597}, Characters: []byte{0xe2, 0xa5, 0xa5}}, "dagger": {Name: "dagger", CodePoints: []int{8224}, Characters: []byte{0xe2, 0x80, 0xa0}}, "daleth": {Name: "daleth", CodePoints: []int{8504}, Characters: []byte{0xe2, 0x84, 0xb8}}, "darr": {Name: "darr", CodePoints: []int{8595}, Characters: []byte{0xe2, 0x86, 0x93}}, "dash": {Name: "dash", CodePoints: []int{8208}, Characters: []byte{0xe2, 0x80, 0x90}}, "dashv": {Name: "dashv", CodePoints: []int{8867}, Characters: []byte{0xe2, 0x8a, 0xa3}}, "dbkarow": {Name: "dbkarow", CodePoints: []int{10511}, Characters: []byte{0xe2, 0xa4, 0x8f}}, "dblac": {Name: "dblac", CodePoints: []int{733}, Characters: []byte{0xcb, 0x9d}}, "dcaron": {Name: "dcaron", CodePoints: []int{271}, Characters: []byte{0xc4, 0x8f}}, "dcy": {Name: "dcy", CodePoints: []int{1076}, Characters: []byte{0xd0, 0xb4}}, "dd": {Name: "dd", CodePoints: []int{8518}, Characters: []byte{0xe2, 0x85, 0x86}}, "ddagger": {Name: "ddagger", CodePoints: []int{8225}, Characters: []byte{0xe2, 0x80, 0xa1}}, "ddarr": {Name: "ddarr", CodePoints: []int{8650}, Characters: []byte{0xe2, 0x87, 0x8a}}, "ddotseq": {Name: "ddotseq", CodePoints: []int{10871}, Characters: []byte{0xe2, 0xa9, 0xb7}}, "deg": {Name: "deg", CodePoints: []int{176}, Characters: []byte{0xc2, 0xb0}}, "delta": {Name: "delta", CodePoints: []int{948}, Characters: []byte{0xce, 0xb4}}, "demptyv": {Name: "demptyv", CodePoints: []int{10673}, Characters: []byte{0xe2, 0xa6, 0xb1}}, "dfisht": {Name: "dfisht", CodePoints: []int{10623}, Characters: []byte{0xe2, 0xa5, 0xbf}}, "dfr": {Name: "dfr", CodePoints: []int{120097}, Characters: []byte{0xf0, 0x9d, 0x94, 0xa1}}, "dharl": {Name: "dharl", CodePoints: []int{8643}, Characters: []byte{0xe2, 0x87, 0x83}}, "dharr": {Name: "dharr", CodePoints: []int{8642}, Characters: []byte{0xe2, 0x87, 0x82}}, "diam": {Name: "diam", CodePoints: []int{8900}, Characters: []byte{0xe2, 0x8b, 0x84}}, "diamond": {Name: "diamond", CodePoints: []int{8900}, Characters: []byte{0xe2, 0x8b, 0x84}}, "diamondsuit": {Name: "diamondsuit", CodePoints: []int{9830}, Characters: []byte{0xe2, 0x99, 0xa6}}, "diams": {Name: "diams", CodePoints: []int{9830}, Characters: []byte{0xe2, 0x99, 0xa6}}, "die": {Name: "die", CodePoints: []int{168}, Characters: []byte{0xc2, 0xa8}}, "digamma": {Name: "digamma", CodePoints: []int{989}, Characters: []byte{0xcf, 0x9d}}, "disin": {Name: "disin", CodePoints: []int{8946}, Characters: []byte{0xe2, 0x8b, 0xb2}}, "div": {Name: "div", CodePoints: []int{247}, Characters: []byte{0xc3, 0xb7}}, "divide": {Name: "divide", CodePoints: []int{247}, Characters: []byte{0xc3, 0xb7}}, "divideontimes": {Name: "divideontimes", CodePoints: []int{8903}, Characters: []byte{0xe2, 0x8b, 0x87}}, "divonx": {Name: "divonx", CodePoints: []int{8903}, Characters: []byte{0xe2, 0x8b, 0x87}}, "djcy": {Name: "djcy", CodePoints: []int{1106}, Characters: []byte{0xd1, 0x92}}, "dlcorn": {Name: "dlcorn", CodePoints: []int{8990}, Characters: []byte{0xe2, 0x8c, 0x9e}}, "dlcrop": {Name: "dlcrop", CodePoints: []int{8973}, Characters: []byte{0xe2, 0x8c, 0x8d}}, "dollar": {Name: "dollar", CodePoints: []int{36}, Characters: []byte{0x24}}, "dopf": {Name: "dopf", CodePoints: []int{120149}, Characters: []byte{0xf0, 0x9d, 0x95, 0x95}}, "dot": {Name: "dot", CodePoints: []int{729}, Characters: []byte{0xcb, 0x99}}, "doteq": {Name: "doteq", CodePoints: []int{8784}, Characters: []byte{0xe2, 0x89, 0x90}}, "doteqdot": {Name: "doteqdot", CodePoints: []int{8785}, Characters: []byte{0xe2, 0x89, 0x91}}, "dotminus": {Name: "dotminus", CodePoints: []int{8760}, Characters: []byte{0xe2, 0x88, 0xb8}}, "dotplus": {Name: "dotplus", CodePoints: []int{8724}, Characters: []byte{0xe2, 0x88, 0x94}}, "dotsquare": {Name: "dotsquare", CodePoints: []int{8865}, Characters: []byte{0xe2, 0x8a, 0xa1}}, "doublebarwedge": {Name: "doublebarwedge", CodePoints: []int{8966}, Characters: []byte{0xe2, 0x8c, 0x86}}, "downarrow": {Name: "downarrow", CodePoints: []int{8595}, Characters: []byte{0xe2, 0x86, 0x93}}, "downdownarrows": {Name: "downdownarrows", CodePoints: []int{8650}, Characters: []byte{0xe2, 0x87, 0x8a}}, "downharpoonleft": {Name: "downharpoonleft", CodePoints: []int{8643}, Characters: []byte{0xe2, 0x87, 0x83}}, "downharpoonright": {Name: "downharpoonright", CodePoints: []int{8642}, Characters: []byte{0xe2, 0x87, 0x82}}, "drbkarow": {Name: "drbkarow", CodePoints: []int{10512}, Characters: []byte{0xe2, 0xa4, 0x90}}, "drcorn": {Name: "drcorn", CodePoints: []int{8991}, Characters: []byte{0xe2, 0x8c, 0x9f}}, "drcrop": {Name: "drcrop", CodePoints: []int{8972}, Characters: []byte{0xe2, 0x8c, 0x8c}}, "dscr": {Name: "dscr", CodePoints: []int{119993}, Characters: []byte{0xf0, 0x9d, 0x92, 0xb9}}, "dscy": {Name: "dscy", CodePoints: []int{1109}, Characters: []byte{0xd1, 0x95}}, "dsol": {Name: "dsol", CodePoints: []int{10742}, Characters: []byte{0xe2, 0xa7, 0xb6}}, "dstrok": {Name: "dstrok", CodePoints: []int{273}, Characters: []byte{0xc4, 0x91}}, "dtdot": {Name: "dtdot", CodePoints: []int{8945}, Characters: []byte{0xe2, 0x8b, 0xb1}}, "dtri": {Name: "dtri", CodePoints: []int{9663}, Characters: []byte{0xe2, 0x96, 0xbf}}, "dtrif": {Name: "dtrif", CodePoints: []int{9662}, Characters: []byte{0xe2, 0x96, 0xbe}}, "duarr": {Name: "duarr", CodePoints: []int{8693}, Characters: []byte{0xe2, 0x87, 0xb5}}, "duhar": {Name: "duhar", CodePoints: []int{10607}, Characters: []byte{0xe2, 0xa5, 0xaf}}, "dwangle": {Name: "dwangle", CodePoints: []int{10662}, Characters: []byte{0xe2, 0xa6, 0xa6}}, "dzcy": {Name: "dzcy", CodePoints: []int{1119}, Characters: []byte{0xd1, 0x9f}}, "dzigrarr": {Name: "dzigrarr", CodePoints: []int{10239}, Characters: []byte{0xe2, 0x9f, 0xbf}}, "eDDot": {Name: "eDDot", CodePoints: []int{10871}, Characters: []byte{0xe2, 0xa9, 0xb7}}, "eDot": {Name: "eDot", CodePoints: []int{8785}, Characters: []byte{0xe2, 0x89, 0x91}}, "eacute": {Name: "eacute", CodePoints: []int{233}, Characters: []byte{0xc3, 0xa9}}, "easter": {Name: "easter", CodePoints: []int{10862}, Characters: []byte{0xe2, 0xa9, 0xae}}, "ecaron": {Name: "ecaron", CodePoints: []int{283}, Characters: []byte{0xc4, 0x9b}}, "ecir": {Name: "ecir", CodePoints: []int{8790}, Characters: []byte{0xe2, 0x89, 0x96}}, "ecirc": {Name: "ecirc", CodePoints: []int{234}, Characters: []byte{0xc3, 0xaa}}, "ecolon": {Name: "ecolon", CodePoints: []int{8789}, Characters: []byte{0xe2, 0x89, 0x95}}, "ecy": {Name: "ecy", CodePoints: []int{1101}, Characters: []byte{0xd1, 0x8d}}, "edot": {Name: "edot", CodePoints: []int{279}, Characters: []byte{0xc4, 0x97}}, "ee": {Name: "ee", CodePoints: []int{8519}, Characters: []byte{0xe2, 0x85, 0x87}}, "efDot": {Name: "efDot", CodePoints: []int{8786}, Characters: []byte{0xe2, 0x89, 0x92}}, "efr": {Name: "efr", CodePoints: []int{120098}, Characters: []byte{0xf0, 0x9d, 0x94, 0xa2}}, "eg": {Name: "eg", CodePoints: []int{10906}, Characters: []byte{0xe2, 0xaa, 0x9a}}, "egrave": {Name: "egrave", CodePoints: []int{232}, Characters: []byte{0xc3, 0xa8}}, "egs": {Name: "egs", CodePoints: []int{10902}, Characters: []byte{0xe2, 0xaa, 0x96}}, "egsdot": {Name: "egsdot", CodePoints: []int{10904}, Characters: []byte{0xe2, 0xaa, 0x98}}, "el": {Name: "el", CodePoints: []int{10905}, Characters: []byte{0xe2, 0xaa, 0x99}}, "elinters": {Name: "elinters", CodePoints: []int{9191}, Characters: []byte{0xe2, 0x8f, 0xa7}}, "ell": {Name: "ell", CodePoints: []int{8467}, Characters: []byte{0xe2, 0x84, 0x93}}, "els": {Name: "els", CodePoints: []int{10901}, Characters: []byte{0xe2, 0xaa, 0x95}}, "elsdot": {Name: "elsdot", CodePoints: []int{10903}, Characters: []byte{0xe2, 0xaa, 0x97}}, "emacr": {Name: "emacr", CodePoints: []int{275}, Characters: []byte{0xc4, 0x93}}, "empty": {Name: "empty", CodePoints: []int{8709}, Characters: []byte{0xe2, 0x88, 0x85}}, "emptyset": {Name: "emptyset", CodePoints: []int{8709}, Characters: []byte{0xe2, 0x88, 0x85}}, "emptyv": {Name: "emptyv", CodePoints: []int{8709}, Characters: []byte{0xe2, 0x88, 0x85}}, "emsp": {Name: "emsp", CodePoints: []int{8195}, Characters: []byte{0xe2, 0x80, 0x83}}, "emsp13": {Name: "emsp13", CodePoints: []int{8196}, Characters: []byte{0xe2, 0x80, 0x84}}, "emsp14": {Name: "emsp14", CodePoints: []int{8197}, Characters: []byte{0xe2, 0x80, 0x85}}, "eng": {Name: "eng", CodePoints: []int{331}, Characters: []byte{0xc5, 0x8b}}, "ensp": {Name: "ensp", CodePoints: []int{8194}, Characters: []byte{0xe2, 0x80, 0x82}}, "eogon": {Name: "eogon", CodePoints: []int{281}, Characters: []byte{0xc4, 0x99}}, "eopf": {Name: "eopf", CodePoints: []int{120150}, Characters: []byte{0xf0, 0x9d, 0x95, 0x96}}, "epar": {Name: "epar", CodePoints: []int{8917}, Characters: []byte{0xe2, 0x8b, 0x95}}, "eparsl": {Name: "eparsl", CodePoints: []int{10723}, Characters: []byte{0xe2, 0xa7, 0xa3}}, "eplus": {Name: "eplus", CodePoints: []int{10865}, Characters: []byte{0xe2, 0xa9, 0xb1}}, "epsi": {Name: "epsi", CodePoints: []int{949}, Characters: []byte{0xce, 0xb5}}, "epsilon": {Name: "epsilon", CodePoints: []int{949}, Characters: []byte{0xce, 0xb5}}, "epsiv": {Name: "epsiv", CodePoints: []int{1013}, Characters: []byte{0xcf, 0xb5}}, "eqcirc": {Name: "eqcirc", CodePoints: []int{8790}, Characters: []byte{0xe2, 0x89, 0x96}}, "eqcolon": {Name: "eqcolon", CodePoints: []int{8789}, Characters: []byte{0xe2, 0x89, 0x95}}, "eqsim": {Name: "eqsim", CodePoints: []int{8770}, Characters: []byte{0xe2, 0x89, 0x82}}, "eqslantgtr": {Name: "eqslantgtr", CodePoints: []int{10902}, Characters: []byte{0xe2, 0xaa, 0x96}}, "eqslantless": {Name: "eqslantless", CodePoints: []int{10901}, Characters: []byte{0xe2, 0xaa, 0x95}}, "equals": {Name: "equals", CodePoints: []int{61}, Characters: []byte{0x3d}}, "equest": {Name: "equest", CodePoints: []int{8799}, Characters: []byte{0xe2, 0x89, 0x9f}}, "equiv": {Name: "equiv", CodePoints: []int{8801}, Characters: []byte{0xe2, 0x89, 0xa1}}, "equivDD": {Name: "equivDD", CodePoints: []int{10872}, Characters: []byte{0xe2, 0xa9, 0xb8}}, "eqvparsl": {Name: "eqvparsl", CodePoints: []int{10725}, Characters: []byte{0xe2, 0xa7, 0xa5}}, "erDot": {Name: "erDot", CodePoints: []int{8787}, Characters: []byte{0xe2, 0x89, 0x93}}, "erarr": {Name: "erarr", CodePoints: []int{10609}, Characters: []byte{0xe2, 0xa5, 0xb1}}, "escr": {Name: "escr", CodePoints: []int{8495}, Characters: []byte{0xe2, 0x84, 0xaf}}, "esdot": {Name: "esdot", CodePoints: []int{8784}, Characters: []byte{0xe2, 0x89, 0x90}}, "esim": {Name: "esim", CodePoints: []int{8770}, Characters: []byte{0xe2, 0x89, 0x82}}, "eta": {Name: "eta", CodePoints: []int{951}, Characters: []byte{0xce, 0xb7}}, "eth": {Name: "eth", CodePoints: []int{240}, Characters: []byte{0xc3, 0xb0}}, "euml": {Name: "euml", CodePoints: []int{235}, Characters: []byte{0xc3, 0xab}}, "euro": {Name: "euro", CodePoints: []int{8364}, Characters: []byte{0xe2, 0x82, 0xac}}, "excl": {Name: "excl", CodePoints: []int{33}, Characters: []byte{0x21}}, "exist": {Name: "exist", CodePoints: []int{8707}, Characters: []byte{0xe2, 0x88, 0x83}}, "expectation": {Name: "expectation", CodePoints: []int{8496}, Characters: []byte{0xe2, 0x84, 0xb0}}, "exponentiale": {Name: "exponentiale", CodePoints: []int{8519}, Characters: []byte{0xe2, 0x85, 0x87}}, "fallingdotseq": {Name: "fallingdotseq", CodePoints: []int{8786}, Characters: []byte{0xe2, 0x89, 0x92}}, "fcy": {Name: "fcy", CodePoints: []int{1092}, Characters: []byte{0xd1, 0x84}}, "female": {Name: "female", CodePoints: []int{9792}, Characters: []byte{0xe2, 0x99, 0x80}}, "ffilig": {Name: "ffilig", CodePoints: []int{64259}, Characters: []byte{0xef, 0xac, 0x83}}, "fflig": {Name: "fflig", CodePoints: []int{64256}, Characters: []byte{0xef, 0xac, 0x80}}, "ffllig": {Name: "ffllig", CodePoints: []int{64260}, Characters: []byte{0xef, 0xac, 0x84}}, "ffr": {Name: "ffr", CodePoints: []int{120099}, Characters: []byte{0xf0, 0x9d, 0x94, 0xa3}}, "filig": {Name: "filig", CodePoints: []int{64257}, Characters: []byte{0xef, 0xac, 0x81}}, "fjlig": {Name: "fjlig", CodePoints: []int{102, 106}, Characters: []byte{0x66, 0x6a}}, "flat": {Name: "flat", CodePoints: []int{9837}, Characters: []byte{0xe2, 0x99, 0xad}}, "fllig": {Name: "fllig", CodePoints: []int{64258}, Characters: []byte{0xef, 0xac, 0x82}}, "fltns": {Name: "fltns", CodePoints: []int{9649}, Characters: []byte{0xe2, 0x96, 0xb1}}, "fnof": {Name: "fnof", CodePoints: []int{402}, Characters: []byte{0xc6, 0x92}}, "fopf": {Name: "fopf", CodePoints: []int{120151}, Characters: []byte{0xf0, 0x9d, 0x95, 0x97}}, "forall": {Name: "forall", CodePoints: []int{8704}, Characters: []byte{0xe2, 0x88, 0x80}}, "fork": {Name: "fork", CodePoints: []int{8916}, Characters: []byte{0xe2, 0x8b, 0x94}}, "forkv": {Name: "forkv", CodePoints: []int{10969}, Characters: []byte{0xe2, 0xab, 0x99}}, "fpartint": {Name: "fpartint", CodePoints: []int{10765}, Characters: []byte{0xe2, 0xa8, 0x8d}}, "frac12": {Name: "frac12", CodePoints: []int{189}, Characters: []byte{0xc2, 0xbd}}, "frac13": {Name: "frac13", CodePoints: []int{8531}, Characters: []byte{0xe2, 0x85, 0x93}}, "frac14": {Name: "frac14", CodePoints: []int{188}, Characters: []byte{0xc2, 0xbc}}, "frac15": {Name: "frac15", CodePoints: []int{8533}, Characters: []byte{0xe2, 0x85, 0x95}}, "frac16": {Name: "frac16", CodePoints: []int{8537}, Characters: []byte{0xe2, 0x85, 0x99}}, "frac18": {Name: "frac18", CodePoints: []int{8539}, Characters: []byte{0xe2, 0x85, 0x9b}}, "frac23": {Name: "frac23", CodePoints: []int{8532}, Characters: []byte{0xe2, 0x85, 0x94}}, "frac25": {Name: "frac25", CodePoints: []int{8534}, Characters: []byte{0xe2, 0x85, 0x96}}, "frac34": {Name: "frac34", CodePoints: []int{190}, Characters: []byte{0xc2, 0xbe}}, "frac35": {Name: "frac35", CodePoints: []int{8535}, Characters: []byte{0xe2, 0x85, 0x97}}, "frac38": {Name: "frac38", CodePoints: []int{8540}, Characters: []byte{0xe2, 0x85, 0x9c}}, "frac45": {Name: "frac45", CodePoints: []int{8536}, Characters: []byte{0xe2, 0x85, 0x98}}, "frac56": {Name: "frac56", CodePoints: []int{8538}, Characters: []byte{0xe2, 0x85, 0x9a}}, "frac58": {Name: "frac58", CodePoints: []int{8541}, Characters: []byte{0xe2, 0x85, 0x9d}}, "frac78": {Name: "frac78", CodePoints: []int{8542}, Characters: []byte{0xe2, 0x85, 0x9e}}, "frasl": {Name: "frasl", CodePoints: []int{8260}, Characters: []byte{0xe2, 0x81, 0x84}}, "frown": {Name: "frown", CodePoints: []int{8994}, Characters: []byte{0xe2, 0x8c, 0xa2}}, "fscr": {Name: "fscr", CodePoints: []int{119995}, Characters: []byte{0xf0, 0x9d, 0x92, 0xbb}}, "gE": {Name: "gE", CodePoints: []int{8807}, Characters: []byte{0xe2, 0x89, 0xa7}}, "gEl": {Name: "gEl", CodePoints: []int{10892}, Characters: []byte{0xe2, 0xaa, 0x8c}}, "gacute": {Name: "gacute", CodePoints: []int{501}, Characters: []byte{0xc7, 0xb5}}, "gamma": {Name: "gamma", CodePoints: []int{947}, Characters: []byte{0xce, 0xb3}}, "gammad": {Name: "gammad", CodePoints: []int{989}, Characters: []byte{0xcf, 0x9d}}, "gap": {Name: "gap", CodePoints: []int{10886}, Characters: []byte{0xe2, 0xaa, 0x86}}, "gbreve": {Name: "gbreve", CodePoints: []int{287}, Characters: []byte{0xc4, 0x9f}}, "gcirc": {Name: "gcirc", CodePoints: []int{285}, Characters: []byte{0xc4, 0x9d}}, "gcy": {Name: "gcy", CodePoints: []int{1075}, Characters: []byte{0xd0, 0xb3}}, "gdot": {Name: "gdot", CodePoints: []int{289}, Characters: []byte{0xc4, 0xa1}}, "ge": {Name: "ge", CodePoints: []int{8805}, Characters: []byte{0xe2, 0x89, 0xa5}}, "gel": {Name: "gel", CodePoints: []int{8923}, Characters: []byte{0xe2, 0x8b, 0x9b}}, "geq": {Name: "geq", CodePoints: []int{8805}, Characters: []byte{0xe2, 0x89, 0xa5}}, "geqq": {Name: "geqq", CodePoints: []int{8807}, Characters: []byte{0xe2, 0x89, 0xa7}}, "geqslant": {Name: "geqslant", CodePoints: []int{10878}, Characters: []byte{0xe2, 0xa9, 0xbe}}, "ges": {Name: "ges", CodePoints: []int{10878}, Characters: []byte{0xe2, 0xa9, 0xbe}}, "gescc": {Name: "gescc", CodePoints: []int{10921}, Characters: []byte{0xe2, 0xaa, 0xa9}}, "gesdot": {Name: "gesdot", CodePoints: []int{10880}, Characters: []byte{0xe2, 0xaa, 0x80}}, "gesdoto": {Name: "gesdoto", CodePoints: []int{10882}, Characters: []byte{0xe2, 0xaa, 0x82}}, "gesdotol": {Name: "gesdotol", CodePoints: []int{10884}, Characters: []byte{0xe2, 0xaa, 0x84}}, "gesl": {Name: "gesl", CodePoints: []int{8923, 65024}, Characters: []byte{0xe2, 0x8b, 0x9b, 0xef, 0xb8, 0x80}}, "gesles": {Name: "gesles", CodePoints: []int{10900}, Characters: []byte{0xe2, 0xaa, 0x94}}, "gfr": {Name: "gfr", CodePoints: []int{120100}, Characters: []byte{0xf0, 0x9d, 0x94, 0xa4}}, "gg": {Name: "gg", CodePoints: []int{8811}, Characters: []byte{0xe2, 0x89, 0xab}}, "ggg": {Name: "ggg", CodePoints: []int{8921}, Characters: []byte{0xe2, 0x8b, 0x99}}, "gimel": {Name: "gimel", CodePoints: []int{8503}, Characters: []byte{0xe2, 0x84, 0xb7}}, "gjcy": {Name: "gjcy", CodePoints: []int{1107}, Characters: []byte{0xd1, 0x93}}, "gl": {Name: "gl", CodePoints: []int{8823}, Characters: []byte{0xe2, 0x89, 0xb7}}, "glE": {Name: "glE", CodePoints: []int{10898}, Characters: []byte{0xe2, 0xaa, 0x92}}, "gla": {Name: "gla", CodePoints: []int{10917}, Characters: []byte{0xe2, 0xaa, 0xa5}}, "glj": {Name: "glj", CodePoints: []int{10916}, Characters: []byte{0xe2, 0xaa, 0xa4}}, "gnE": {Name: "gnE", CodePoints: []int{8809}, Characters: []byte{0xe2, 0x89, 0xa9}}, "gnap": {Name: "gnap", CodePoints: []int{10890}, Characters: []byte{0xe2, 0xaa, 0x8a}}, "gnapprox": {Name: "gnapprox", CodePoints: []int{10890}, Characters: []byte{0xe2, 0xaa, 0x8a}}, "gne": {Name: "gne", CodePoints: []int{10888}, Characters: []byte{0xe2, 0xaa, 0x88}}, "gneq": {Name: "gneq", CodePoints: []int{10888}, Characters: []byte{0xe2, 0xaa, 0x88}}, "gneqq": {Name: "gneqq", CodePoints: []int{8809}, Characters: []byte{0xe2, 0x89, 0xa9}}, "gnsim": {Name: "gnsim", CodePoints: []int{8935}, Characters: []byte{0xe2, 0x8b, 0xa7}}, "gopf": {Name: "gopf", CodePoints: []int{120152}, Characters: []byte{0xf0, 0x9d, 0x95, 0x98}}, "grave": {Name: "grave", CodePoints: []int{96}, Characters: []byte{0x60}}, "gscr": {Name: "gscr", CodePoints: []int{8458}, Characters: []byte{0xe2, 0x84, 0x8a}}, "gsim": {Name: "gsim", CodePoints: []int{8819}, Characters: []byte{0xe2, 0x89, 0xb3}}, "gsime": {Name: "gsime", CodePoints: []int{10894}, Characters: []byte{0xe2, 0xaa, 0x8e}}, "gsiml": {Name: "gsiml", CodePoints: []int{10896}, Characters: []byte{0xe2, 0xaa, 0x90}}, "gt": {Name: "gt", CodePoints: []int{62}, Characters: []byte{0x3e}}, "gtcc": {Name: "gtcc", CodePoints: []int{10919}, Characters: []byte{0xe2, 0xaa, 0xa7}}, "gtcir": {Name: "gtcir", CodePoints: []int{10874}, Characters: []byte{0xe2, 0xa9, 0xba}}, "gtdot": {Name: "gtdot", CodePoints: []int{8919}, Characters: []byte{0xe2, 0x8b, 0x97}}, "gtlPar": {Name: "gtlPar", CodePoints: []int{10645}, Characters: []byte{0xe2, 0xa6, 0x95}}, "gtquest": {Name: "gtquest", CodePoints: []int{10876}, Characters: []byte{0xe2, 0xa9, 0xbc}}, "gtrapprox": {Name: "gtrapprox", CodePoints: []int{10886}, Characters: []byte{0xe2, 0xaa, 0x86}}, "gtrarr": {Name: "gtrarr", CodePoints: []int{10616}, Characters: []byte{0xe2, 0xa5, 0xb8}}, "gtrdot": {Name: "gtrdot", CodePoints: []int{8919}, Characters: []byte{0xe2, 0x8b, 0x97}}, "gtreqless": {Name: "gtreqless", CodePoints: []int{8923}, Characters: []byte{0xe2, 0x8b, 0x9b}}, "gtreqqless": {Name: "gtreqqless", CodePoints: []int{10892}, Characters: []byte{0xe2, 0xaa, 0x8c}}, "gtrless": {Name: "gtrless", CodePoints: []int{8823}, Characters: []byte{0xe2, 0x89, 0xb7}}, "gtrsim": {Name: "gtrsim", CodePoints: []int{8819}, Characters: []byte{0xe2, 0x89, 0xb3}}, "gvertneqq": {Name: "gvertneqq", CodePoints: []int{8809, 65024}, Characters: []byte{0xe2, 0x89, 0xa9, 0xef, 0xb8, 0x80}}, "gvnE": {Name: "gvnE", CodePoints: []int{8809, 65024}, Characters: []byte{0xe2, 0x89, 0xa9, 0xef, 0xb8, 0x80}}, "hArr": {Name: "hArr", CodePoints: []int{8660}, Characters: []byte{0xe2, 0x87, 0x94}}, "hairsp": {Name: "hairsp", CodePoints: []int{8202}, Characters: []byte{0xe2, 0x80, 0x8a}}, "half": {Name: "half", CodePoints: []int{189}, Characters: []byte{0xc2, 0xbd}}, "hamilt": {Name: "hamilt", CodePoints: []int{8459}, Characters: []byte{0xe2, 0x84, 0x8b}}, "hardcy": {Name: "hardcy", CodePoints: []int{1098}, Characters: []byte{0xd1, 0x8a}}, "harr": {Name: "harr", CodePoints: []int{8596}, Characters: []byte{0xe2, 0x86, 0x94}}, "harrcir": {Name: "harrcir", CodePoints: []int{10568}, Characters: []byte{0xe2, 0xa5, 0x88}}, "harrw": {Name: "harrw", CodePoints: []int{8621}, Characters: []byte{0xe2, 0x86, 0xad}}, "hbar": {Name: "hbar", CodePoints: []int{8463}, Characters: []byte{0xe2, 0x84, 0x8f}}, "hcirc": {Name: "hcirc", CodePoints: []int{293}, Characters: []byte{0xc4, 0xa5}}, "hearts": {Name: "hearts", CodePoints: []int{9829}, Characters: []byte{0xe2, 0x99, 0xa5}}, "heartsuit": {Name: "heartsuit", CodePoints: []int{9829}, Characters: []byte{0xe2, 0x99, 0xa5}}, "hellip": {Name: "hellip", CodePoints: []int{8230}, Characters: []byte{0xe2, 0x80, 0xa6}}, "hercon": {Name: "hercon", CodePoints: []int{8889}, Characters: []byte{0xe2, 0x8a, 0xb9}}, "hfr": {Name: "hfr", CodePoints: []int{120101}, Characters: []byte{0xf0, 0x9d, 0x94, 0xa5}}, "hksearow": {Name: "hksearow", CodePoints: []int{10533}, Characters: []byte{0xe2, 0xa4, 0xa5}}, "hkswarow": {Name: "hkswarow", CodePoints: []int{10534}, Characters: []byte{0xe2, 0xa4, 0xa6}}, "hoarr": {Name: "hoarr", CodePoints: []int{8703}, Characters: []byte{0xe2, 0x87, 0xbf}}, "homtht": {Name: "homtht", CodePoints: []int{8763}, Characters: []byte{0xe2, 0x88, 0xbb}}, "hookleftarrow": {Name: "hookleftarrow", CodePoints: []int{8617}, Characters: []byte{0xe2, 0x86, 0xa9}}, "hookrightarrow": {Name: "hookrightarrow", CodePoints: []int{8618}, Characters: []byte{0xe2, 0x86, 0xaa}}, "hopf": {Name: "hopf", CodePoints: []int{120153}, Characters: []byte{0xf0, 0x9d, 0x95, 0x99}}, "horbar": {Name: "horbar", CodePoints: []int{8213}, Characters: []byte{0xe2, 0x80, 0x95}}, "hscr": {Name: "hscr", CodePoints: []int{119997}, Characters: []byte{0xf0, 0x9d, 0x92, 0xbd}}, "hslash": {Name: "hslash", CodePoints: []int{8463}, Characters: []byte{0xe2, 0x84, 0x8f}}, "hstrok": {Name: "hstrok", CodePoints: []int{295}, Characters: []byte{0xc4, 0xa7}}, "hybull": {Name: "hybull", CodePoints: []int{8259}, Characters: []byte{0xe2, 0x81, 0x83}}, "hyphen": {Name: "hyphen", CodePoints: []int{8208}, Characters: []byte{0xe2, 0x80, 0x90}}, "iacute": {Name: "iacute", CodePoints: []int{237}, Characters: []byte{0xc3, 0xad}}, "ic": {Name: "ic", CodePoints: []int{8291}, Characters: []byte{0xe2, 0x81, 0xa3}}, "icirc": {Name: "icirc", CodePoints: []int{238}, Characters: []byte{0xc3, 0xae}}, "icy": {Name: "icy", CodePoints: []int{1080}, Characters: []byte{0xd0, 0xb8}}, "iecy": {Name: "iecy", CodePoints: []int{1077}, Characters: []byte{0xd0, 0xb5}}, "iexcl": {Name: "iexcl", CodePoints: []int{161}, Characters: []byte{0xc2, 0xa1}}, "iff": {Name: "iff", CodePoints: []int{8660}, Characters: []byte{0xe2, 0x87, 0x94}}, "ifr": {Name: "ifr", CodePoints: []int{120102}, Characters: []byte{0xf0, 0x9d, 0x94, 0xa6}}, "igrave": {Name: "igrave", CodePoints: []int{236}, Characters: []byte{0xc3, 0xac}}, "ii": {Name: "ii", CodePoints: []int{8520}, Characters: []byte{0xe2, 0x85, 0x88}}, "iiiint": {Name: "iiiint", CodePoints: []int{10764}, Characters: []byte{0xe2, 0xa8, 0x8c}}, "iiint": {Name: "iiint", CodePoints: []int{8749}, Characters: []byte{0xe2, 0x88, 0xad}}, "iinfin": {Name: "iinfin", CodePoints: []int{10716}, Characters: []byte{0xe2, 0xa7, 0x9c}}, "iiota": {Name: "iiota", CodePoints: []int{8489}, Characters: []byte{0xe2, 0x84, 0xa9}}, "ijlig": {Name: "ijlig", CodePoints: []int{307}, Characters: []byte{0xc4, 0xb3}}, "imacr": {Name: "imacr", CodePoints: []int{299}, Characters: []byte{0xc4, 0xab}}, "image": {Name: "image", CodePoints: []int{8465}, Characters: []byte{0xe2, 0x84, 0x91}}, "imagline": {Name: "imagline", CodePoints: []int{8464}, Characters: []byte{0xe2, 0x84, 0x90}}, "imagpart": {Name: "imagpart", CodePoints: []int{8465}, Characters: []byte{0xe2, 0x84, 0x91}}, "imath": {Name: "imath", CodePoints: []int{305}, Characters: []byte{0xc4, 0xb1}}, "imof": {Name: "imof", CodePoints: []int{8887}, Characters: []byte{0xe2, 0x8a, 0xb7}}, "imped": {Name: "imped", CodePoints: []int{437}, Characters: []byte{0xc6, 0xb5}}, "in": {Name: "in", CodePoints: []int{8712}, Characters: []byte{0xe2, 0x88, 0x88}}, "incare": {Name: "incare", CodePoints: []int{8453}, Characters: []byte{0xe2, 0x84, 0x85}}, "infin": {Name: "infin", CodePoints: []int{8734}, Characters: []byte{0xe2, 0x88, 0x9e}}, "infintie": {Name: "infintie", CodePoints: []int{10717}, Characters: []byte{0xe2, 0xa7, 0x9d}}, "inodot": {Name: "inodot", CodePoints: []int{305}, Characters: []byte{0xc4, 0xb1}}, "int": {Name: "int", CodePoints: []int{8747}, Characters: []byte{0xe2, 0x88, 0xab}}, "intcal": {Name: "intcal", CodePoints: []int{8890}, Characters: []byte{0xe2, 0x8a, 0xba}}, "integers": {Name: "integers", CodePoints: []int{8484}, Characters: []byte{0xe2, 0x84, 0xa4}}, "intercal": {Name: "intercal", CodePoints: []int{8890}, Characters: []byte{0xe2, 0x8a, 0xba}}, "intlarhk": {Name: "intlarhk", CodePoints: []int{10775}, Characters: []byte{0xe2, 0xa8, 0x97}}, "intprod": {Name: "intprod", CodePoints: []int{10812}, Characters: []byte{0xe2, 0xa8, 0xbc}}, "iocy": {Name: "iocy", CodePoints: []int{1105}, Characters: []byte{0xd1, 0x91}}, "iogon": {Name: "iogon", CodePoints: []int{303}, Characters: []byte{0xc4, 0xaf}}, "iopf": {Name: "iopf", CodePoints: []int{120154}, Characters: []byte{0xf0, 0x9d, 0x95, 0x9a}}, "iota": {Name: "iota", CodePoints: []int{953}, Characters: []byte{0xce, 0xb9}}, "iprod": {Name: "iprod", CodePoints: []int{10812}, Characters: []byte{0xe2, 0xa8, 0xbc}}, "iquest": {Name: "iquest", CodePoints: []int{191}, Characters: []byte{0xc2, 0xbf}}, "iscr": {Name: "iscr", CodePoints: []int{119998}, Characters: []byte{0xf0, 0x9d, 0x92, 0xbe}}, "isin": {Name: "isin", CodePoints: []int{8712}, Characters: []byte{0xe2, 0x88, 0x88}}, "isinE": {Name: "isinE", CodePoints: []int{8953}, Characters: []byte{0xe2, 0x8b, 0xb9}}, "isindot": {Name: "isindot", CodePoints: []int{8949}, Characters: []byte{0xe2, 0x8b, 0xb5}}, "isins": {Name: "isins", CodePoints: []int{8948}, Characters: []byte{0xe2, 0x8b, 0xb4}}, "isinsv": {Name: "isinsv", CodePoints: []int{8947}, Characters: []byte{0xe2, 0x8b, 0xb3}}, "isinv": {Name: "isinv", CodePoints: []int{8712}, Characters: []byte{0xe2, 0x88, 0x88}}, "it": {Name: "it", CodePoints: []int{8290}, Characters: []byte{0xe2, 0x81, 0xa2}}, "itilde": {Name: "itilde", CodePoints: []int{297}, Characters: []byte{0xc4, 0xa9}}, "iukcy": {Name: "iukcy", CodePoints: []int{1110}, Characters: []byte{0xd1, 0x96}}, "iuml": {Name: "iuml", CodePoints: []int{239}, Characters: []byte{0xc3, 0xaf}}, "jcirc": {Name: "jcirc", CodePoints: []int{309}, Characters: []byte{0xc4, 0xb5}}, "jcy": {Name: "jcy", CodePoints: []int{1081}, Characters: []byte{0xd0, 0xb9}}, "jfr": {Name: "jfr", CodePoints: []int{120103}, Characters: []byte{0xf0, 0x9d, 0x94, 0xa7}}, "jmath": {Name: "jmath", CodePoints: []int{567}, Characters: []byte{0xc8, 0xb7}}, "jopf": {Name: "jopf", CodePoints: []int{120155}, Characters: []byte{0xf0, 0x9d, 0x95, 0x9b}}, "jscr": {Name: "jscr", CodePoints: []int{119999}, Characters: []byte{0xf0, 0x9d, 0x92, 0xbf}}, "jsercy": {Name: "jsercy", CodePoints: []int{1112}, Characters: []byte{0xd1, 0x98}}, "jukcy": {Name: "jukcy", CodePoints: []int{1108}, Characters: []byte{0xd1, 0x94}}, "kappa": {Name: "kappa", CodePoints: []int{954}, Characters: []byte{0xce, 0xba}}, "kappav": {Name: "kappav", CodePoints: []int{1008}, Characters: []byte{0xcf, 0xb0}}, "kcedil": {Name: "kcedil", CodePoints: []int{311}, Characters: []byte{0xc4, 0xb7}}, "kcy": {Name: "kcy", CodePoints: []int{1082}, Characters: []byte{0xd0, 0xba}}, "kfr": {Name: "kfr", CodePoints: []int{120104}, Characters: []byte{0xf0, 0x9d, 0x94, 0xa8}}, "kgreen": {Name: "kgreen", CodePoints: []int{312}, Characters: []byte{0xc4, 0xb8}}, "khcy": {Name: "khcy", CodePoints: []int{1093}, Characters: []byte{0xd1, 0x85}}, "kjcy": {Name: "kjcy", CodePoints: []int{1116}, Characters: []byte{0xd1, 0x9c}}, "kopf": {Name: "kopf", CodePoints: []int{120156}, Characters: []byte{0xf0, 0x9d, 0x95, 0x9c}}, "kscr": {Name: "kscr", CodePoints: []int{120000}, Characters: []byte{0xf0, 0x9d, 0x93, 0x80}}, "lAarr": {Name: "lAarr", CodePoints: []int{8666}, Characters: []byte{0xe2, 0x87, 0x9a}}, "lArr": {Name: "lArr", CodePoints: []int{8656}, Characters: []byte{0xe2, 0x87, 0x90}}, "lAtail": {Name: "lAtail", CodePoints: []int{10523}, Characters: []byte{0xe2, 0xa4, 0x9b}}, "lBarr": {Name: "lBarr", CodePoints: []int{10510}, Characters: []byte{0xe2, 0xa4, 0x8e}}, "lE": {Name: "lE", CodePoints: []int{8806}, Characters: []byte{0xe2, 0x89, 0xa6}}, "lEg": {Name: "lEg", CodePoints: []int{10891}, Characters: []byte{0xe2, 0xaa, 0x8b}}, "lHar": {Name: "lHar", CodePoints: []int{10594}, Characters: []byte{0xe2, 0xa5, 0xa2}}, "lacute": {Name: "lacute", CodePoints: []int{314}, Characters: []byte{0xc4, 0xba}}, "laemptyv": {Name: "laemptyv", CodePoints: []int{10676}, Characters: []byte{0xe2, 0xa6, 0xb4}}, "lagran": {Name: "lagran", CodePoints: []int{8466}, Characters: []byte{0xe2, 0x84, 0x92}}, "lambda": {Name: "lambda", CodePoints: []int{955}, Characters: []byte{0xce, 0xbb}}, "lang": {Name: "lang", CodePoints: []int{10216}, Characters: []byte{0xe2, 0x9f, 0xa8}}, "langd": {Name: "langd", CodePoints: []int{10641}, Characters: []byte{0xe2, 0xa6, 0x91}}, "langle": {Name: "langle", CodePoints: []int{10216}, Characters: []byte{0xe2, 0x9f, 0xa8}}, "lap": {Name: "lap", CodePoints: []int{10885}, Characters: []byte{0xe2, 0xaa, 0x85}}, "laquo": {Name: "laquo", CodePoints: []int{171}, Characters: []byte{0xc2, 0xab}}, "larr": {Name: "larr", CodePoints: []int{8592}, Characters: []byte{0xe2, 0x86, 0x90}}, "larrb": {Name: "larrb", CodePoints: []int{8676}, Characters: []byte{0xe2, 0x87, 0xa4}}, "larrbfs": {Name: "larrbfs", CodePoints: []int{10527}, Characters: []byte{0xe2, 0xa4, 0x9f}}, "larrfs": {Name: "larrfs", CodePoints: []int{10525}, Characters: []byte{0xe2, 0xa4, 0x9d}}, "larrhk": {Name: "larrhk", CodePoints: []int{8617}, Characters: []byte{0xe2, 0x86, 0xa9}}, "larrlp": {Name: "larrlp", CodePoints: []int{8619}, Characters: []byte{0xe2, 0x86, 0xab}}, "larrpl": {Name: "larrpl", CodePoints: []int{10553}, Characters: []byte{0xe2, 0xa4, 0xb9}}, "larrsim": {Name: "larrsim", CodePoints: []int{10611}, Characters: []byte{0xe2, 0xa5, 0xb3}}, "larrtl": {Name: "larrtl", CodePoints: []int{8610}, Characters: []byte{0xe2, 0x86, 0xa2}}, "lat": {Name: "lat", CodePoints: []int{10923}, Characters: []byte{0xe2, 0xaa, 0xab}}, "latail": {Name: "latail", CodePoints: []int{10521}, Characters: []byte{0xe2, 0xa4, 0x99}}, "late": {Name: "late", CodePoints: []int{10925}, Characters: []byte{0xe2, 0xaa, 0xad}}, "lates": {Name: "lates", CodePoints: []int{10925, 65024}, Characters: []byte{0xe2, 0xaa, 0xad, 0xef, 0xb8, 0x80}}, "lbarr": {Name: "lbarr", CodePoints: []int{10508}, Characters: []byte{0xe2, 0xa4, 0x8c}}, "lbbrk": {Name: "lbbrk", CodePoints: []int{10098}, Characters: []byte{0xe2, 0x9d, 0xb2}}, "lbrace": {Name: "lbrace", CodePoints: []int{123}, Characters: []byte{0x7b}}, "lbrack": {Name: "lbrack", CodePoints: []int{91}, Characters: []byte{0x5b}}, "lbrke": {Name: "lbrke", CodePoints: []int{10635}, Characters: []byte{0xe2, 0xa6, 0x8b}}, "lbrksld": {Name: "lbrksld", CodePoints: []int{10639}, Characters: []byte{0xe2, 0xa6, 0x8f}}, "lbrkslu": {Name: "lbrkslu", CodePoints: []int{10637}, Characters: []byte{0xe2, 0xa6, 0x8d}}, "lcaron": {Name: "lcaron", CodePoints: []int{318}, Characters: []byte{0xc4, 0xbe}}, "lcedil": {Name: "lcedil", CodePoints: []int{316}, Characters: []byte{0xc4, 0xbc}}, "lceil": {Name: "lceil", CodePoints: []int{8968}, Characters: []byte{0xe2, 0x8c, 0x88}}, "lcub": {Name: "lcub", CodePoints: []int{123}, Characters: []byte{0x7b}}, "lcy": {Name: "lcy", CodePoints: []int{1083}, Characters: []byte{0xd0, 0xbb}}, "ldca": {Name: "ldca", CodePoints: []int{10550}, Characters: []byte{0xe2, 0xa4, 0xb6}}, "ldquo": {Name: "ldquo", CodePoints: []int{8220}, Characters: []byte{0xe2, 0x80, 0x9c}}, "ldquor": {Name: "ldquor", CodePoints: []int{8222}, Characters: []byte{0xe2, 0x80, 0x9e}}, "ldrdhar": {Name: "ldrdhar", CodePoints: []int{10599}, Characters: []byte{0xe2, 0xa5, 0xa7}}, "ldrushar": {Name: "ldrushar", CodePoints: []int{10571}, Characters: []byte{0xe2, 0xa5, 0x8b}}, "ldsh": {Name: "ldsh", CodePoints: []int{8626}, Characters: []byte{0xe2, 0x86, 0xb2}}, "le": {Name: "le", CodePoints: []int{8804}, Characters: []byte{0xe2, 0x89, 0xa4}}, "leftarrow": {Name: "leftarrow", CodePoints: []int{8592}, Characters: []byte{0xe2, 0x86, 0x90}}, "leftarrowtail": {Name: "leftarrowtail", CodePoints: []int{8610}, Characters: []byte{0xe2, 0x86, 0xa2}}, "leftharpoondown": {Name: "leftharpoondown", CodePoints: []int{8637}, Characters: []byte{0xe2, 0x86, 0xbd}}, "leftharpoonup": {Name: "leftharpoonup", CodePoints: []int{8636}, Characters: []byte{0xe2, 0x86, 0xbc}}, "leftleftarrows": {Name: "leftleftarrows", CodePoints: []int{8647}, Characters: []byte{0xe2, 0x87, 0x87}}, "leftrightarrow": {Name: "leftrightarrow", CodePoints: []int{8596}, Characters: []byte{0xe2, 0x86, 0x94}}, "leftrightarrows": {Name: "leftrightarrows", CodePoints: []int{8646}, Characters: []byte{0xe2, 0x87, 0x86}}, "leftrightharpoons": {Name: "leftrightharpoons", CodePoints: []int{8651}, Characters: []byte{0xe2, 0x87, 0x8b}}, "leftrightsquigarrow": {Name: "leftrightsquigarrow", CodePoints: []int{8621}, Characters: []byte{0xe2, 0x86, 0xad}}, "leftthreetimes": {Name: "leftthreetimes", CodePoints: []int{8907}, Characters: []byte{0xe2, 0x8b, 0x8b}}, "leg": {Name: "leg", CodePoints: []int{8922}, Characters: []byte{0xe2, 0x8b, 0x9a}}, "leq": {Name: "leq", CodePoints: []int{8804}, Characters: []byte{0xe2, 0x89, 0xa4}}, "leqq": {Name: "leqq", CodePoints: []int{8806}, Characters: []byte{0xe2, 0x89, 0xa6}}, "leqslant": {Name: "leqslant", CodePoints: []int{10877}, Characters: []byte{0xe2, 0xa9, 0xbd}}, "les": {Name: "les", CodePoints: []int{10877}, Characters: []byte{0xe2, 0xa9, 0xbd}}, "lescc": {Name: "lescc", CodePoints: []int{10920}, Characters: []byte{0xe2, 0xaa, 0xa8}}, "lesdot": {Name: "lesdot", CodePoints: []int{10879}, Characters: []byte{0xe2, 0xa9, 0xbf}}, "lesdoto": {Name: "lesdoto", CodePoints: []int{10881}, Characters: []byte{0xe2, 0xaa, 0x81}}, "lesdotor": {Name: "lesdotor", CodePoints: []int{10883}, Characters: []byte{0xe2, 0xaa, 0x83}}, "lesg": {Name: "lesg", CodePoints: []int{8922, 65024}, Characters: []byte{0xe2, 0x8b, 0x9a, 0xef, 0xb8, 0x80}}, "lesges": {Name: "lesges", CodePoints: []int{10899}, Characters: []byte{0xe2, 0xaa, 0x93}}, "lessapprox": {Name: "lessapprox", CodePoints: []int{10885}, Characters: []byte{0xe2, 0xaa, 0x85}}, "lessdot": {Name: "lessdot", CodePoints: []int{8918}, Characters: []byte{0xe2, 0x8b, 0x96}}, "lesseqgtr": {Name: "lesseqgtr", CodePoints: []int{8922}, Characters: []byte{0xe2, 0x8b, 0x9a}}, "lesseqqgtr": {Name: "lesseqqgtr", CodePoints: []int{10891}, Characters: []byte{0xe2, 0xaa, 0x8b}}, "lessgtr": {Name: "lessgtr", CodePoints: []int{8822}, Characters: []byte{0xe2, 0x89, 0xb6}}, "lesssim": {Name: "lesssim", CodePoints: []int{8818}, Characters: []byte{0xe2, 0x89, 0xb2}}, "lfisht": {Name: "lfisht", CodePoints: []int{10620}, Characters: []byte{0xe2, 0xa5, 0xbc}}, "lfloor": {Name: "lfloor", CodePoints: []int{8970}, Characters: []byte{0xe2, 0x8c, 0x8a}}, "lfr": {Name: "lfr", CodePoints: []int{120105}, Characters: []byte{0xf0, 0x9d, 0x94, 0xa9}}, "lg": {Name: "lg", CodePoints: []int{8822}, Characters: []byte{0xe2, 0x89, 0xb6}}, "lgE": {Name: "lgE", CodePoints: []int{10897}, Characters: []byte{0xe2, 0xaa, 0x91}}, "lhard": {Name: "lhard", CodePoints: []int{8637}, Characters: []byte{0xe2, 0x86, 0xbd}}, "lharu": {Name: "lharu", CodePoints: []int{8636}, Characters: []byte{0xe2, 0x86, 0xbc}}, "lharul": {Name: "lharul", CodePoints: []int{10602}, Characters: []byte{0xe2, 0xa5, 0xaa}}, "lhblk": {Name: "lhblk", CodePoints: []int{9604}, Characters: []byte{0xe2, 0x96, 0x84}}, "ljcy": {Name: "ljcy", CodePoints: []int{1113}, Characters: []byte{0xd1, 0x99}}, "ll": {Name: "ll", CodePoints: []int{8810}, Characters: []byte{0xe2, 0x89, 0xaa}}, "llarr": {Name: "llarr", CodePoints: []int{8647}, Characters: []byte{0xe2, 0x87, 0x87}}, "llcorner": {Name: "llcorner", CodePoints: []int{8990}, Characters: []byte{0xe2, 0x8c, 0x9e}}, "llhard": {Name: "llhard", CodePoints: []int{10603}, Characters: []byte{0xe2, 0xa5, 0xab}}, "lltri": {Name: "lltri", CodePoints: []int{9722}, Characters: []byte{0xe2, 0x97, 0xba}}, "lmidot": {Name: "lmidot", CodePoints: []int{320}, Characters: []byte{0xc5, 0x80}}, "lmoust": {Name: "lmoust", CodePoints: []int{9136}, Characters: []byte{0xe2, 0x8e, 0xb0}}, "lmoustache": {Name: "lmoustache", CodePoints: []int{9136}, Characters: []byte{0xe2, 0x8e, 0xb0}}, "lnE": {Name: "lnE", CodePoints: []int{8808}, Characters: []byte{0xe2, 0x89, 0xa8}}, "lnap": {Name: "lnap", CodePoints: []int{10889}, Characters: []byte{0xe2, 0xaa, 0x89}}, "lnapprox": {Name: "lnapprox", CodePoints: []int{10889}, Characters: []byte{0xe2, 0xaa, 0x89}}, "lne": {Name: "lne", CodePoints: []int{10887}, Characters: []byte{0xe2, 0xaa, 0x87}}, "lneq": {Name: "lneq", CodePoints: []int{10887}, Characters: []byte{0xe2, 0xaa, 0x87}}, "lneqq": {Name: "lneqq", CodePoints: []int{8808}, Characters: []byte{0xe2, 0x89, 0xa8}}, "lnsim": {Name: "lnsim", CodePoints: []int{8934}, Characters: []byte{0xe2, 0x8b, 0xa6}}, "loang": {Name: "loang", CodePoints: []int{10220}, Characters: []byte{0xe2, 0x9f, 0xac}}, "loarr": {Name: "loarr", CodePoints: []int{8701}, Characters: []byte{0xe2, 0x87, 0xbd}}, "lobrk": {Name: "lobrk", CodePoints: []int{10214}, Characters: []byte{0xe2, 0x9f, 0xa6}}, "longleftarrow": {Name: "longleftarrow", CodePoints: []int{10229}, Characters: []byte{0xe2, 0x9f, 0xb5}}, "longleftrightarrow": {Name: "longleftrightarrow", CodePoints: []int{10231}, Characters: []byte{0xe2, 0x9f, 0xb7}}, "longmapsto": {Name: "longmapsto", CodePoints: []int{10236}, Characters: []byte{0xe2, 0x9f, 0xbc}}, "longrightarrow": {Name: "longrightarrow", CodePoints: []int{10230}, Characters: []byte{0xe2, 0x9f, 0xb6}}, "looparrowleft": {Name: "looparrowleft", CodePoints: []int{8619}, Characters: []byte{0xe2, 0x86, 0xab}}, "looparrowright": {Name: "looparrowright", CodePoints: []int{8620}, Characters: []byte{0xe2, 0x86, 0xac}}, "lopar": {Name: "lopar", CodePoints: []int{10629}, Characters: []byte{0xe2, 0xa6, 0x85}}, "lopf": {Name: "lopf", CodePoints: []int{120157}, Characters: []byte{0xf0, 0x9d, 0x95, 0x9d}}, "loplus": {Name: "loplus", CodePoints: []int{10797}, Characters: []byte{0xe2, 0xa8, 0xad}}, "lotimes": {Name: "lotimes", CodePoints: []int{10804}, Characters: []byte{0xe2, 0xa8, 0xb4}}, "lowast": {Name: "lowast", CodePoints: []int{8727}, Characters: []byte{0xe2, 0x88, 0x97}}, "lowbar": {Name: "lowbar", CodePoints: []int{95}, Characters: []byte{0x5f}}, "loz": {Name: "loz", CodePoints: []int{9674}, Characters: []byte{0xe2, 0x97, 0x8a}}, "lozenge": {Name: "lozenge", CodePoints: []int{9674}, Characters: []byte{0xe2, 0x97, 0x8a}}, "lozf": {Name: "lozf", CodePoints: []int{10731}, Characters: []byte{0xe2, 0xa7, 0xab}}, "lpar": {Name: "lpar", CodePoints: []int{40}, Characters: []byte{0x28}}, "lparlt": {Name: "lparlt", CodePoints: []int{10643}, Characters: []byte{0xe2, 0xa6, 0x93}}, "lrarr": {Name: "lrarr", CodePoints: []int{8646}, Characters: []byte{0xe2, 0x87, 0x86}}, "lrcorner": {Name: "lrcorner", CodePoints: []int{8991}, Characters: []byte{0xe2, 0x8c, 0x9f}}, "lrhar": {Name: "lrhar", CodePoints: []int{8651}, Characters: []byte{0xe2, 0x87, 0x8b}}, "lrhard": {Name: "lrhard", CodePoints: []int{10605}, Characters: []byte{0xe2, 0xa5, 0xad}}, "lrm": {Name: "lrm", CodePoints: []int{8206}, Characters: []byte{0xe2, 0x80, 0x8e}}, "lrtri": {Name: "lrtri", CodePoints: []int{8895}, Characters: []byte{0xe2, 0x8a, 0xbf}}, "lsaquo": {Name: "lsaquo", CodePoints: []int{8249}, Characters: []byte{0xe2, 0x80, 0xb9}}, "lscr": {Name: "lscr", CodePoints: []int{120001}, Characters: []byte{0xf0, 0x9d, 0x93, 0x81}}, "lsh": {Name: "lsh", CodePoints: []int{8624}, Characters: []byte{0xe2, 0x86, 0xb0}}, "lsim": {Name: "lsim", CodePoints: []int{8818}, Characters: []byte{0xe2, 0x89, 0xb2}}, "lsime": {Name: "lsime", CodePoints: []int{10893}, Characters: []byte{0xe2, 0xaa, 0x8d}}, "lsimg": {Name: "lsimg", CodePoints: []int{10895}, Characters: []byte{0xe2, 0xaa, 0x8f}}, "lsqb": {Name: "lsqb", CodePoints: []int{91}, Characters: []byte{0x5b}}, "lsquo": {Name: "lsquo", CodePoints: []int{8216}, Characters: []byte{0xe2, 0x80, 0x98}}, "lsquor": {Name: "lsquor", CodePoints: []int{8218}, Characters: []byte{0xe2, 0x80, 0x9a}}, "lstrok": {Name: "lstrok", CodePoints: []int{322}, Characters: []byte{0xc5, 0x82}}, "lt": {Name: "lt", CodePoints: []int{60}, Characters: []byte{0x3c}}, "ltcc": {Name: "ltcc", CodePoints: []int{10918}, Characters: []byte{0xe2, 0xaa, 0xa6}}, "ltcir": {Name: "ltcir", CodePoints: []int{10873}, Characters: []byte{0xe2, 0xa9, 0xb9}}, "ltdot": {Name: "ltdot", CodePoints: []int{8918}, Characters: []byte{0xe2, 0x8b, 0x96}}, "lthree": {Name: "lthree", CodePoints: []int{8907}, Characters: []byte{0xe2, 0x8b, 0x8b}}, "ltimes": {Name: "ltimes", CodePoints: []int{8905}, Characters: []byte{0xe2, 0x8b, 0x89}}, "ltlarr": {Name: "ltlarr", CodePoints: []int{10614}, Characters: []byte{0xe2, 0xa5, 0xb6}}, "ltquest": {Name: "ltquest", CodePoints: []int{10875}, Characters: []byte{0xe2, 0xa9, 0xbb}}, "ltrPar": {Name: "ltrPar", CodePoints: []int{10646}, Characters: []byte{0xe2, 0xa6, 0x96}}, "ltri": {Name: "ltri", CodePoints: []int{9667}, Characters: []byte{0xe2, 0x97, 0x83}}, "ltrie": {Name: "ltrie", CodePoints: []int{8884}, Characters: []byte{0xe2, 0x8a, 0xb4}}, "ltrif": {Name: "ltrif", CodePoints: []int{9666}, Characters: []byte{0xe2, 0x97, 0x82}}, "lurdshar": {Name: "lurdshar", CodePoints: []int{10570}, Characters: []byte{0xe2, 0xa5, 0x8a}}, "luruhar": {Name: "luruhar", CodePoints: []int{10598}, Characters: []byte{0xe2, 0xa5, 0xa6}}, "lvertneqq": {Name: "lvertneqq", CodePoints: []int{8808, 65024}, Characters: []byte{0xe2, 0x89, 0xa8, 0xef, 0xb8, 0x80}}, "lvnE": {Name: "lvnE", CodePoints: []int{8808, 65024}, Characters: []byte{0xe2, 0x89, 0xa8, 0xef, 0xb8, 0x80}}, "mDDot": {Name: "mDDot", CodePoints: []int{8762}, Characters: []byte{0xe2, 0x88, 0xba}}, "macr": {Name: "macr", CodePoints: []int{175}, Characters: []byte{0xc2, 0xaf}}, "male": {Name: "male", CodePoints: []int{9794}, Characters: []byte{0xe2, 0x99, 0x82}}, "malt": {Name: "malt", CodePoints: []int{10016}, Characters: []byte{0xe2, 0x9c, 0xa0}}, "maltese": {Name: "maltese", CodePoints: []int{10016}, Characters: []byte{0xe2, 0x9c, 0xa0}}, "map": {Name: "map", CodePoints: []int{8614}, Characters: []byte{0xe2, 0x86, 0xa6}}, "mapsto": {Name: "mapsto", CodePoints: []int{8614}, Characters: []byte{0xe2, 0x86, 0xa6}}, "mapstodown": {Name: "mapstodown", CodePoints: []int{8615}, Characters: []byte{0xe2, 0x86, 0xa7}}, "mapstoleft": {Name: "mapstoleft", CodePoints: []int{8612}, Characters: []byte{0xe2, 0x86, 0xa4}}, "mapstoup": {Name: "mapstoup", CodePoints: []int{8613}, Characters: []byte{0xe2, 0x86, 0xa5}}, "marker": {Name: "marker", CodePoints: []int{9646}, Characters: []byte{0xe2, 0x96, 0xae}}, "mcomma": {Name: "mcomma", CodePoints: []int{10793}, Characters: []byte{0xe2, 0xa8, 0xa9}}, "mcy": {Name: "mcy", CodePoints: []int{1084}, Characters: []byte{0xd0, 0xbc}}, "mdash": {Name: "mdash", CodePoints: []int{8212}, Characters: []byte{0xe2, 0x80, 0x94}}, "measuredangle": {Name: "measuredangle", CodePoints: []int{8737}, Characters: []byte{0xe2, 0x88, 0xa1}}, "mfr": {Name: "mfr", CodePoints: []int{120106}, Characters: []byte{0xf0, 0x9d, 0x94, 0xaa}}, "mho": {Name: "mho", CodePoints: []int{8487}, Characters: []byte{0xe2, 0x84, 0xa7}}, "micro": {Name: "micro", CodePoints: []int{181}, Characters: []byte{0xc2, 0xb5}}, "mid": {Name: "mid", CodePoints: []int{8739}, Characters: []byte{0xe2, 0x88, 0xa3}}, "midast": {Name: "midast", CodePoints: []int{42}, Characters: []byte{0x2a}}, "midcir": {Name: "midcir", CodePoints: []int{10992}, Characters: []byte{0xe2, 0xab, 0xb0}}, "middot": {Name: "middot", CodePoints: []int{183}, Characters: []byte{0xc2, 0xb7}}, "minus": {Name: "minus", CodePoints: []int{8722}, Characters: []byte{0xe2, 0x88, 0x92}}, "minusb": {Name: "minusb", CodePoints: []int{8863}, Characters: []byte{0xe2, 0x8a, 0x9f}}, "minusd": {Name: "minusd", CodePoints: []int{8760}, Characters: []byte{0xe2, 0x88, 0xb8}}, "minusdu": {Name: "minusdu", CodePoints: []int{10794}, Characters: []byte{0xe2, 0xa8, 0xaa}}, "mlcp": {Name: "mlcp", CodePoints: []int{10971}, Characters: []byte{0xe2, 0xab, 0x9b}}, "mldr": {Name: "mldr", CodePoints: []int{8230}, Characters: []byte{0xe2, 0x80, 0xa6}}, "mnplus": {Name: "mnplus", CodePoints: []int{8723}, Characters: []byte{0xe2, 0x88, 0x93}}, "models": {Name: "models", CodePoints: []int{8871}, Characters: []byte{0xe2, 0x8a, 0xa7}}, "mopf": {Name: "mopf", CodePoints: []int{120158}, Characters: []byte{0xf0, 0x9d, 0x95, 0x9e}}, "mp": {Name: "mp", CodePoints: []int{8723}, Characters: []byte{0xe2, 0x88, 0x93}}, "mscr": {Name: "mscr", CodePoints: []int{120002}, Characters: []byte{0xf0, 0x9d, 0x93, 0x82}}, "mstpos": {Name: "mstpos", CodePoints: []int{8766}, Characters: []byte{0xe2, 0x88, 0xbe}}, "mu": {Name: "mu", CodePoints: []int{956}, Characters: []byte{0xce, 0xbc}}, "multimap": {Name: "multimap", CodePoints: []int{8888}, Characters: []byte{0xe2, 0x8a, 0xb8}}, "mumap": {Name: "mumap", CodePoints: []int{8888}, Characters: []byte{0xe2, 0x8a, 0xb8}}, "nGg": {Name: "nGg", CodePoints: []int{8921, 824}, Characters: []byte{0xe2, 0x8b, 0x99, 0xcc, 0xb8}}, "nGt": {Name: "nGt", CodePoints: []int{8811, 8402}, Characters: []byte{0xe2, 0x89, 0xab, 0xe2, 0x83, 0x92}}, "nGtv": {Name: "nGtv", CodePoints: []int{8811, 824}, Characters: []byte{0xe2, 0x89, 0xab, 0xcc, 0xb8}}, "nLeftarrow": {Name: "nLeftarrow", CodePoints: []int{8653}, Characters: []byte{0xe2, 0x87, 0x8d}}, "nLeftrightarrow": {Name: "nLeftrightarrow", CodePoints: []int{8654}, Characters: []byte{0xe2, 0x87, 0x8e}}, "nLl": {Name: "nLl", CodePoints: []int{8920, 824}, Characters: []byte{0xe2, 0x8b, 0x98, 0xcc, 0xb8}}, "nLt": {Name: "nLt", CodePoints: []int{8810, 8402}, Characters: []byte{0xe2, 0x89, 0xaa, 0xe2, 0x83, 0x92}}, "nLtv": {Name: "nLtv", CodePoints: []int{8810, 824}, Characters: []byte{0xe2, 0x89, 0xaa, 0xcc, 0xb8}}, "nRightarrow": {Name: "nRightarrow", CodePoints: []int{8655}, Characters: []byte{0xe2, 0x87, 0x8f}}, "nVDash": {Name: "nVDash", CodePoints: []int{8879}, Characters: []byte{0xe2, 0x8a, 0xaf}}, "nVdash": {Name: "nVdash", CodePoints: []int{8878}, Characters: []byte{0xe2, 0x8a, 0xae}}, "nabla": {Name: "nabla", CodePoints: []int{8711}, Characters: []byte{0xe2, 0x88, 0x87}}, "nacute": {Name: "nacute", CodePoints: []int{324}, Characters: []byte{0xc5, 0x84}}, "nang": {Name: "nang", CodePoints: []int{8736, 8402}, Characters: []byte{0xe2, 0x88, 0xa0, 0xe2, 0x83, 0x92}}, "nap": {Name: "nap", CodePoints: []int{8777}, Characters: []byte{0xe2, 0x89, 0x89}}, "napE": {Name: "napE", CodePoints: []int{10864, 824}, Characters: []byte{0xe2, 0xa9, 0xb0, 0xcc, 0xb8}}, "napid": {Name: "napid", CodePoints: []int{8779, 824}, Characters: []byte{0xe2, 0x89, 0x8b, 0xcc, 0xb8}}, "napos": {Name: "napos", CodePoints: []int{329}, Characters: []byte{0xc5, 0x89}}, "napprox": {Name: "napprox", CodePoints: []int{8777}, Characters: []byte{0xe2, 0x89, 0x89}}, "natur": {Name: "natur", CodePoints: []int{9838}, Characters: []byte{0xe2, 0x99, 0xae}}, "natural": {Name: "natural", CodePoints: []int{9838}, Characters: []byte{0xe2, 0x99, 0xae}}, "naturals": {Name: "naturals", CodePoints: []int{8469}, Characters: []byte{0xe2, 0x84, 0x95}}, "nbsp": {Name: "nbsp", CodePoints: []int{160}, Characters: []byte{0xc2, 0xa0}}, "nbump": {Name: "nbump", CodePoints: []int{8782, 824}, Characters: []byte{0xe2, 0x89, 0x8e, 0xcc, 0xb8}}, "nbumpe": {Name: "nbumpe", CodePoints: []int{8783, 824}, Characters: []byte{0xe2, 0x89, 0x8f, 0xcc, 0xb8}}, "ncap": {Name: "ncap", CodePoints: []int{10819}, Characters: []byte{0xe2, 0xa9, 0x83}}, "ncaron": {Name: "ncaron", CodePoints: []int{328}, Characters: []byte{0xc5, 0x88}}, "ncedil": {Name: "ncedil", CodePoints: []int{326}, Characters: []byte{0xc5, 0x86}}, "ncong": {Name: "ncong", CodePoints: []int{8775}, Characters: []byte{0xe2, 0x89, 0x87}}, "ncongdot": {Name: "ncongdot", CodePoints: []int{10861, 824}, Characters: []byte{0xe2, 0xa9, 0xad, 0xcc, 0xb8}}, "ncup": {Name: "ncup", CodePoints: []int{10818}, Characters: []byte{0xe2, 0xa9, 0x82}}, "ncy": {Name: "ncy", CodePoints: []int{1085}, Characters: []byte{0xd0, 0xbd}}, "ndash": {Name: "ndash", CodePoints: []int{8211}, Characters: []byte{0xe2, 0x80, 0x93}}, "ne": {Name: "ne", CodePoints: []int{8800}, Characters: []byte{0xe2, 0x89, 0xa0}}, "neArr": {Name: "neArr", CodePoints: []int{8663}, Characters: []byte{0xe2, 0x87, 0x97}}, "nearhk": {Name: "nearhk", CodePoints: []int{10532}, Characters: []byte{0xe2, 0xa4, 0xa4}}, "nearr": {Name: "nearr", CodePoints: []int{8599}, Characters: []byte{0xe2, 0x86, 0x97}}, "nearrow": {Name: "nearrow", CodePoints: []int{8599}, Characters: []byte{0xe2, 0x86, 0x97}}, "nedot": {Name: "nedot", CodePoints: []int{8784, 824}, Characters: []byte{0xe2, 0x89, 0x90, 0xcc, 0xb8}}, "nequiv": {Name: "nequiv", CodePoints: []int{8802}, Characters: []byte{0xe2, 0x89, 0xa2}}, "nesear": {Name: "nesear", CodePoints: []int{10536}, Characters: []byte{0xe2, 0xa4, 0xa8}}, "nesim": {Name: "nesim", CodePoints: []int{8770, 824}, Characters: []byte{0xe2, 0x89, 0x82, 0xcc, 0xb8}}, "nexist": {Name: "nexist", CodePoints: []int{8708}, Characters: []byte{0xe2, 0x88, 0x84}}, "nexists": {Name: "nexists", CodePoints: []int{8708}, Characters: []byte{0xe2, 0x88, 0x84}}, "nfr": {Name: "nfr", CodePoints: []int{120107}, Characters: []byte{0xf0, 0x9d, 0x94, 0xab}}, "ngE": {Name: "ngE", CodePoints: []int{8807, 824}, Characters: []byte{0xe2, 0x89, 0xa7, 0xcc, 0xb8}}, "nge": {Name: "nge", CodePoints: []int{8817}, Characters: []byte{0xe2, 0x89, 0xb1}}, "ngeq": {Name: "ngeq", CodePoints: []int{8817}, Characters: []byte{0xe2, 0x89, 0xb1}}, "ngeqq": {Name: "ngeqq", CodePoints: []int{8807, 824}, Characters: []byte{0xe2, 0x89, 0xa7, 0xcc, 0xb8}}, "ngeqslant": {Name: "ngeqslant", CodePoints: []int{10878, 824}, Characters: []byte{0xe2, 0xa9, 0xbe, 0xcc, 0xb8}}, "nges": {Name: "nges", CodePoints: []int{10878, 824}, Characters: []byte{0xe2, 0xa9, 0xbe, 0xcc, 0xb8}}, "ngsim": {Name: "ngsim", CodePoints: []int{8821}, Characters: []byte{0xe2, 0x89, 0xb5}}, "ngt": {Name: "ngt", CodePoints: []int{8815}, Characters: []byte{0xe2, 0x89, 0xaf}}, "ngtr": {Name: "ngtr", CodePoints: []int{8815}, Characters: []byte{0xe2, 0x89, 0xaf}}, "nhArr": {Name: "nhArr", CodePoints: []int{8654}, Characters: []byte{0xe2, 0x87, 0x8e}}, "nharr": {Name: "nharr", CodePoints: []int{8622}, Characters: []byte{0xe2, 0x86, 0xae}}, "nhpar": {Name: "nhpar", CodePoints: []int{10994}, Characters: []byte{0xe2, 0xab, 0xb2}}, "ni": {Name: "ni", CodePoints: []int{8715}, Characters: []byte{0xe2, 0x88, 0x8b}}, "nis": {Name: "nis", CodePoints: []int{8956}, Characters: []byte{0xe2, 0x8b, 0xbc}}, "nisd": {Name: "nisd", CodePoints: []int{8954}, Characters: []byte{0xe2, 0x8b, 0xba}}, "niv": {Name: "niv", CodePoints: []int{8715}, Characters: []byte{0xe2, 0x88, 0x8b}}, "njcy": {Name: "njcy", CodePoints: []int{1114}, Characters: []byte{0xd1, 0x9a}}, "nlArr": {Name: "nlArr", CodePoints: []int{8653}, Characters: []byte{0xe2, 0x87, 0x8d}}, "nlE": {Name: "nlE", CodePoints: []int{8806, 824}, Characters: []byte{0xe2, 0x89, 0xa6, 0xcc, 0xb8}}, "nlarr": {Name: "nlarr", CodePoints: []int{8602}, Characters: []byte{0xe2, 0x86, 0x9a}}, "nldr": {Name: "nldr", CodePoints: []int{8229}, Characters: []byte{0xe2, 0x80, 0xa5}}, "nle": {Name: "nle", CodePoints: []int{8816}, Characters: []byte{0xe2, 0x89, 0xb0}}, "nleftarrow": {Name: "nleftarrow", CodePoints: []int{8602}, Characters: []byte{0xe2, 0x86, 0x9a}}, "nleftrightarrow": {Name: "nleftrightarrow", CodePoints: []int{8622}, Characters: []byte{0xe2, 0x86, 0xae}}, "nleq": {Name: "nleq", CodePoints: []int{8816}, Characters: []byte{0xe2, 0x89, 0xb0}}, "nleqq": {Name: "nleqq", CodePoints: []int{8806, 824}, Characters: []byte{0xe2, 0x89, 0xa6, 0xcc, 0xb8}}, "nleqslant": {Name: "nleqslant", CodePoints: []int{10877, 824}, Characters: []byte{0xe2, 0xa9, 0xbd, 0xcc, 0xb8}}, "nles": {Name: "nles", CodePoints: []int{10877, 824}, Characters: []byte{0xe2, 0xa9, 0xbd, 0xcc, 0xb8}}, "nless": {Name: "nless", CodePoints: []int{8814}, Characters: []byte{0xe2, 0x89, 0xae}}, "nlsim": {Name: "nlsim", CodePoints: []int{8820}, Characters: []byte{0xe2, 0x89, 0xb4}}, "nlt": {Name: "nlt", CodePoints: []int{8814}, Characters: []byte{0xe2, 0x89, 0xae}}, "nltri": {Name: "nltri", CodePoints: []int{8938}, Characters: []byte{0xe2, 0x8b, 0xaa}}, "nltrie": {Name: "nltrie", CodePoints: []int{8940}, Characters: []byte{0xe2, 0x8b, 0xac}}, "nmid": {Name: "nmid", CodePoints: []int{8740}, Characters: []byte{0xe2, 0x88, 0xa4}}, "nopf": {Name: "nopf", CodePoints: []int{120159}, Characters: []byte{0xf0, 0x9d, 0x95, 0x9f}}, "not": {Name: "not", CodePoints: []int{172}, Characters: []byte{0xc2, 0xac}}, "notin": {Name: "notin", CodePoints: []int{8713}, Characters: []byte{0xe2, 0x88, 0x89}}, "notinE": {Name: "notinE", CodePoints: []int{8953, 824}, Characters: []byte{0xe2, 0x8b, 0xb9, 0xcc, 0xb8}}, "notindot": {Name: "notindot", CodePoints: []int{8949, 824}, Characters: []byte{0xe2, 0x8b, 0xb5, 0xcc, 0xb8}}, "notinva": {Name: "notinva", CodePoints: []int{8713}, Characters: []byte{0xe2, 0x88, 0x89}}, "notinvb": {Name: "notinvb", CodePoints: []int{8951}, Characters: []byte{0xe2, 0x8b, 0xb7}}, "notinvc": {Name: "notinvc", CodePoints: []int{8950}, Characters: []byte{0xe2, 0x8b, 0xb6}}, "notni": {Name: "notni", CodePoints: []int{8716}, Characters: []byte{0xe2, 0x88, 0x8c}}, "notniva": {Name: "notniva", CodePoints: []int{8716}, Characters: []byte{0xe2, 0x88, 0x8c}}, "notnivb": {Name: "notnivb", CodePoints: []int{8958}, Characters: []byte{0xe2, 0x8b, 0xbe}}, "notnivc": {Name: "notnivc", CodePoints: []int{8957}, Characters: []byte{0xe2, 0x8b, 0xbd}}, "npar": {Name: "npar", CodePoints: []int{8742}, Characters: []byte{0xe2, 0x88, 0xa6}}, "nparallel": {Name: "nparallel", CodePoints: []int{8742}, Characters: []byte{0xe2, 0x88, 0xa6}}, "nparsl": {Name: "nparsl", CodePoints: []int{11005, 8421}, Characters: []byte{0xe2, 0xab, 0xbd, 0xe2, 0x83, 0xa5}}, "npart": {Name: "npart", CodePoints: []int{8706, 824}, Characters: []byte{0xe2, 0x88, 0x82, 0xcc, 0xb8}}, "npolint": {Name: "npolint", CodePoints: []int{10772}, Characters: []byte{0xe2, 0xa8, 0x94}}, "npr": {Name: "npr", CodePoints: []int{8832}, Characters: []byte{0xe2, 0x8a, 0x80}}, "nprcue": {Name: "nprcue", CodePoints: []int{8928}, Characters: []byte{0xe2, 0x8b, 0xa0}}, "npre": {Name: "npre", CodePoints: []int{10927, 824}, Characters: []byte{0xe2, 0xaa, 0xaf, 0xcc, 0xb8}}, "nprec": {Name: "nprec", CodePoints: []int{8832}, Characters: []byte{0xe2, 0x8a, 0x80}}, "npreceq": {Name: "npreceq", CodePoints: []int{10927, 824}, Characters: []byte{0xe2, 0xaa, 0xaf, 0xcc, 0xb8}}, "nrArr": {Name: "nrArr", CodePoints: []int{8655}, Characters: []byte{0xe2, 0x87, 0x8f}}, "nrarr": {Name: "nrarr", CodePoints: []int{8603}, Characters: []byte{0xe2, 0x86, 0x9b}}, "nrarrc": {Name: "nrarrc", CodePoints: []int{10547, 824}, Characters: []byte{0xe2, 0xa4, 0xb3, 0xcc, 0xb8}}, "nrarrw": {Name: "nrarrw", CodePoints: []int{8605, 824}, Characters: []byte{0xe2, 0x86, 0x9d, 0xcc, 0xb8}}, "nrightarrow": {Name: "nrightarrow", CodePoints: []int{8603}, Characters: []byte{0xe2, 0x86, 0x9b}}, "nrtri": {Name: "nrtri", CodePoints: []int{8939}, Characters: []byte{0xe2, 0x8b, 0xab}}, "nrtrie": {Name: "nrtrie", CodePoints: []int{8941}, Characters: []byte{0xe2, 0x8b, 0xad}}, "nsc": {Name: "nsc", CodePoints: []int{8833}, Characters: []byte{0xe2, 0x8a, 0x81}}, "nsccue": {Name: "nsccue", CodePoints: []int{8929}, Characters: []byte{0xe2, 0x8b, 0xa1}}, "nsce": {Name: "nsce", CodePoints: []int{10928, 824}, Characters: []byte{0xe2, 0xaa, 0xb0, 0xcc, 0xb8}}, "nscr": {Name: "nscr", CodePoints: []int{120003}, Characters: []byte{0xf0, 0x9d, 0x93, 0x83}}, "nshortmid": {Name: "nshortmid", CodePoints: []int{8740}, Characters: []byte{0xe2, 0x88, 0xa4}}, "nshortparallel": {Name: "nshortparallel", CodePoints: []int{8742}, Characters: []byte{0xe2, 0x88, 0xa6}}, "nsim": {Name: "nsim", CodePoints: []int{8769}, Characters: []byte{0xe2, 0x89, 0x81}}, "nsime": {Name: "nsime", CodePoints: []int{8772}, Characters: []byte{0xe2, 0x89, 0x84}}, "nsimeq": {Name: "nsimeq", CodePoints: []int{8772}, Characters: []byte{0xe2, 0x89, 0x84}}, "nsmid": {Name: "nsmid", CodePoints: []int{8740}, Characters: []byte{0xe2, 0x88, 0xa4}}, "nspar": {Name: "nspar", CodePoints: []int{8742}, Characters: []byte{0xe2, 0x88, 0xa6}}, "nsqsube": {Name: "nsqsube", CodePoints: []int{8930}, Characters: []byte{0xe2, 0x8b, 0xa2}}, "nsqsupe": {Name: "nsqsupe", CodePoints: []int{8931}, Characters: []byte{0xe2, 0x8b, 0xa3}}, "nsub": {Name: "nsub", CodePoints: []int{8836}, Characters: []byte{0xe2, 0x8a, 0x84}}, "nsubE": {Name: "nsubE", CodePoints: []int{10949, 824}, Characters: []byte{0xe2, 0xab, 0x85, 0xcc, 0xb8}}, "nsube": {Name: "nsube", CodePoints: []int{8840}, Characters: []byte{0xe2, 0x8a, 0x88}}, "nsubset": {Name: "nsubset", CodePoints: []int{8834, 8402}, Characters: []byte{0xe2, 0x8a, 0x82, 0xe2, 0x83, 0x92}}, "nsubseteq": {Name: "nsubseteq", CodePoints: []int{8840}, Characters: []byte{0xe2, 0x8a, 0x88}}, "nsubseteqq": {Name: "nsubseteqq", CodePoints: []int{10949, 824}, Characters: []byte{0xe2, 0xab, 0x85, 0xcc, 0xb8}}, "nsucc": {Name: "nsucc", CodePoints: []int{8833}, Characters: []byte{0xe2, 0x8a, 0x81}}, "nsucceq": {Name: "nsucceq", CodePoints: []int{10928, 824}, Characters: []byte{0xe2, 0xaa, 0xb0, 0xcc, 0xb8}}, "nsup": {Name: "nsup", CodePoints: []int{8837}, Characters: []byte{0xe2, 0x8a, 0x85}}, "nsupE": {Name: "nsupE", CodePoints: []int{10950, 824}, Characters: []byte{0xe2, 0xab, 0x86, 0xcc, 0xb8}}, "nsupe": {Name: "nsupe", CodePoints: []int{8841}, Characters: []byte{0xe2, 0x8a, 0x89}}, "nsupset": {Name: "nsupset", CodePoints: []int{8835, 8402}, Characters: []byte{0xe2, 0x8a, 0x83, 0xe2, 0x83, 0x92}}, "nsupseteq": {Name: "nsupseteq", CodePoints: []int{8841}, Characters: []byte{0xe2, 0x8a, 0x89}}, "nsupseteqq": {Name: "nsupseteqq", CodePoints: []int{10950, 824}, Characters: []byte{0xe2, 0xab, 0x86, 0xcc, 0xb8}}, "ntgl": {Name: "ntgl", CodePoints: []int{8825}, Characters: []byte{0xe2, 0x89, 0xb9}}, "ntilde": {Name: "ntilde", CodePoints: []int{241}, Characters: []byte{0xc3, 0xb1}}, "ntlg": {Name: "ntlg", CodePoints: []int{8824}, Characters: []byte{0xe2, 0x89, 0xb8}}, "ntriangleleft": {Name: "ntriangleleft", CodePoints: []int{8938}, Characters: []byte{0xe2, 0x8b, 0xaa}}, "ntrianglelefteq": {Name: "ntrianglelefteq", CodePoints: []int{8940}, Characters: []byte{0xe2, 0x8b, 0xac}}, "ntriangleright": {Name: "ntriangleright", CodePoints: []int{8939}, Characters: []byte{0xe2, 0x8b, 0xab}}, "ntrianglerighteq": {Name: "ntrianglerighteq", CodePoints: []int{8941}, Characters: []byte{0xe2, 0x8b, 0xad}}, "nu": {Name: "nu", CodePoints: []int{957}, Characters: []byte{0xce, 0xbd}}, "num": {Name: "num", CodePoints: []int{35}, Characters: []byte{0x23}}, "numero": {Name: "numero", CodePoints: []int{8470}, Characters: []byte{0xe2, 0x84, 0x96}}, "numsp": {Name: "numsp", CodePoints: []int{8199}, Characters: []byte{0xe2, 0x80, 0x87}}, "nvDash": {Name: "nvDash", CodePoints: []int{8877}, Characters: []byte{0xe2, 0x8a, 0xad}}, "nvHarr": {Name: "nvHarr", CodePoints: []int{10500}, Characters: []byte{0xe2, 0xa4, 0x84}}, "nvap": {Name: "nvap", CodePoints: []int{8781, 8402}, Characters: []byte{0xe2, 0x89, 0x8d, 0xe2, 0x83, 0x92}}, "nvdash": {Name: "nvdash", CodePoints: []int{8876}, Characters: []byte{0xe2, 0x8a, 0xac}}, "nvge": {Name: "nvge", CodePoints: []int{8805, 8402}, Characters: []byte{0xe2, 0x89, 0xa5, 0xe2, 0x83, 0x92}}, "nvgt": {Name: "nvgt", CodePoints: []int{62, 8402}, Characters: []byte{0x3e, 0xe2, 0x83, 0x92}}, "nvinfin": {Name: "nvinfin", CodePoints: []int{10718}, Characters: []byte{0xe2, 0xa7, 0x9e}}, "nvlArr": {Name: "nvlArr", CodePoints: []int{10498}, Characters: []byte{0xe2, 0xa4, 0x82}}, "nvle": {Name: "nvle", CodePoints: []int{8804, 8402}, Characters: []byte{0xe2, 0x89, 0xa4, 0xe2, 0x83, 0x92}}, "nvlt": {Name: "nvlt", CodePoints: []int{60, 8402}, Characters: []byte{0x3c, 0xe2, 0x83, 0x92}}, "nvltrie": {Name: "nvltrie", CodePoints: []int{8884, 8402}, Characters: []byte{0xe2, 0x8a, 0xb4, 0xe2, 0x83, 0x92}}, "nvrArr": {Name: "nvrArr", CodePoints: []int{10499}, Characters: []byte{0xe2, 0xa4, 0x83}}, "nvrtrie": {Name: "nvrtrie", CodePoints: []int{8885, 8402}, Characters: []byte{0xe2, 0x8a, 0xb5, 0xe2, 0x83, 0x92}}, "nvsim": {Name: "nvsim", CodePoints: []int{8764, 8402}, Characters: []byte{0xe2, 0x88, 0xbc, 0xe2, 0x83, 0x92}}, "nwArr": {Name: "nwArr", CodePoints: []int{8662}, Characters: []byte{0xe2, 0x87, 0x96}}, "nwarhk": {Name: "nwarhk", CodePoints: []int{10531}, Characters: []byte{0xe2, 0xa4, 0xa3}}, "nwarr": {Name: "nwarr", CodePoints: []int{8598}, Characters: []byte{0xe2, 0x86, 0x96}}, "nwarrow": {Name: "nwarrow", CodePoints: []int{8598}, Characters: []byte{0xe2, 0x86, 0x96}}, "nwnear": {Name: "nwnear", CodePoints: []int{10535}, Characters: []byte{0xe2, 0xa4, 0xa7}}, "oS": {Name: "oS", CodePoints: []int{9416}, Characters: []byte{0xe2, 0x93, 0x88}}, "oacute": {Name: "oacute", CodePoints: []int{243}, Characters: []byte{0xc3, 0xb3}}, "oast": {Name: "oast", CodePoints: []int{8859}, Characters: []byte{0xe2, 0x8a, 0x9b}}, "ocir": {Name: "ocir", CodePoints: []int{8858}, Characters: []byte{0xe2, 0x8a, 0x9a}}, "ocirc": {Name: "ocirc", CodePoints: []int{244}, Characters: []byte{0xc3, 0xb4}}, "ocy": {Name: "ocy", CodePoints: []int{1086}, Characters: []byte{0xd0, 0xbe}}, "odash": {Name: "odash", CodePoints: []int{8861}, Characters: []byte{0xe2, 0x8a, 0x9d}}, "odblac": {Name: "odblac", CodePoints: []int{337}, Characters: []byte{0xc5, 0x91}}, "odiv": {Name: "odiv", CodePoints: []int{10808}, Characters: []byte{0xe2, 0xa8, 0xb8}}, "odot": {Name: "odot", CodePoints: []int{8857}, Characters: []byte{0xe2, 0x8a, 0x99}}, "odsold": {Name: "odsold", CodePoints: []int{10684}, Characters: []byte{0xe2, 0xa6, 0xbc}}, "oelig": {Name: "oelig", CodePoints: []int{339}, Characters: []byte{0xc5, 0x93}}, "ofcir": {Name: "ofcir", CodePoints: []int{10687}, Characters: []byte{0xe2, 0xa6, 0xbf}}, "ofr": {Name: "ofr", CodePoints: []int{120108}, Characters: []byte{0xf0, 0x9d, 0x94, 0xac}}, "ogon": {Name: "ogon", CodePoints: []int{731}, Characters: []byte{0xcb, 0x9b}}, "ograve": {Name: "ograve", CodePoints: []int{242}, Characters: []byte{0xc3, 0xb2}}, "ogt": {Name: "ogt", CodePoints: []int{10689}, Characters: []byte{0xe2, 0xa7, 0x81}}, "ohbar": {Name: "ohbar", CodePoints: []int{10677}, Characters: []byte{0xe2, 0xa6, 0xb5}}, "ohm": {Name: "ohm", CodePoints: []int{937}, Characters: []byte{0xce, 0xa9}}, "oint": {Name: "oint", CodePoints: []int{8750}, Characters: []byte{0xe2, 0x88, 0xae}}, "olarr": {Name: "olarr", CodePoints: []int{8634}, Characters: []byte{0xe2, 0x86, 0xba}}, "olcir": {Name: "olcir", CodePoints: []int{10686}, Characters: []byte{0xe2, 0xa6, 0xbe}}, "olcross": {Name: "olcross", CodePoints: []int{10683}, Characters: []byte{0xe2, 0xa6, 0xbb}}, "oline": {Name: "oline", CodePoints: []int{8254}, Characters: []byte{0xe2, 0x80, 0xbe}}, "olt": {Name: "olt", CodePoints: []int{10688}, Characters: []byte{0xe2, 0xa7, 0x80}}, "omacr": {Name: "omacr", CodePoints: []int{333}, Characters: []byte{0xc5, 0x8d}}, "omega": {Name: "omega", CodePoints: []int{969}, Characters: []byte{0xcf, 0x89}}, "omicron": {Name: "omicron", CodePoints: []int{959}, Characters: []byte{0xce, 0xbf}}, "omid": {Name: "omid", CodePoints: []int{10678}, Characters: []byte{0xe2, 0xa6, 0xb6}}, "ominus": {Name: "ominus", CodePoints: []int{8854}, Characters: []byte{0xe2, 0x8a, 0x96}}, "oopf": {Name: "oopf", CodePoints: []int{120160}, Characters: []byte{0xf0, 0x9d, 0x95, 0xa0}}, "opar": {Name: "opar", CodePoints: []int{10679}, Characters: []byte{0xe2, 0xa6, 0xb7}}, "operp": {Name: "operp", CodePoints: []int{10681}, Characters: []byte{0xe2, 0xa6, 0xb9}}, "oplus": {Name: "oplus", CodePoints: []int{8853}, Characters: []byte{0xe2, 0x8a, 0x95}}, "or": {Name: "or", CodePoints: []int{8744}, Characters: []byte{0xe2, 0x88, 0xa8}}, "orarr": {Name: "orarr", CodePoints: []int{8635}, Characters: []byte{0xe2, 0x86, 0xbb}}, "ord": {Name: "ord", CodePoints: []int{10845}, Characters: []byte{0xe2, 0xa9, 0x9d}}, "order": {Name: "order", CodePoints: []int{8500}, Characters: []byte{0xe2, 0x84, 0xb4}}, "orderof": {Name: "orderof", CodePoints: []int{8500}, Characters: []byte{0xe2, 0x84, 0xb4}}, "ordf": {Name: "ordf", CodePoints: []int{170}, Characters: []byte{0xc2, 0xaa}}, "ordm": {Name: "ordm", CodePoints: []int{186}, Characters: []byte{0xc2, 0xba}}, "origof": {Name: "origof", CodePoints: []int{8886}, Characters: []byte{0xe2, 0x8a, 0xb6}}, "oror": {Name: "oror", CodePoints: []int{10838}, Characters: []byte{0xe2, 0xa9, 0x96}}, "orslope": {Name: "orslope", CodePoints: []int{10839}, Characters: []byte{0xe2, 0xa9, 0x97}}, "orv": {Name: "orv", CodePoints: []int{10843}, Characters: []byte{0xe2, 0xa9, 0x9b}}, "oscr": {Name: "oscr", CodePoints: []int{8500}, Characters: []byte{0xe2, 0x84, 0xb4}}, "oslash": {Name: "oslash", CodePoints: []int{248}, Characters: []byte{0xc3, 0xb8}}, "osol": {Name: "osol", CodePoints: []int{8856}, Characters: []byte{0xe2, 0x8a, 0x98}}, "otilde": {Name: "otilde", CodePoints: []int{245}, Characters: []byte{0xc3, 0xb5}}, "otimes": {Name: "otimes", CodePoints: []int{8855}, Characters: []byte{0xe2, 0x8a, 0x97}}, "otimesas": {Name: "otimesas", CodePoints: []int{10806}, Characters: []byte{0xe2, 0xa8, 0xb6}}, "ouml": {Name: "ouml", CodePoints: []int{246}, Characters: []byte{0xc3, 0xb6}}, "ovbar": {Name: "ovbar", CodePoints: []int{9021}, Characters: []byte{0xe2, 0x8c, 0xbd}}, "par": {Name: "par", CodePoints: []int{8741}, Characters: []byte{0xe2, 0x88, 0xa5}}, "para": {Name: "para", CodePoints: []int{182}, Characters: []byte{0xc2, 0xb6}}, "parallel": {Name: "parallel", CodePoints: []int{8741}, Characters: []byte{0xe2, 0x88, 0xa5}}, "parsim": {Name: "parsim", CodePoints: []int{10995}, Characters: []byte{0xe2, 0xab, 0xb3}}, "parsl": {Name: "parsl", CodePoints: []int{11005}, Characters: []byte{0xe2, 0xab, 0xbd}}, "part": {Name: "part", CodePoints: []int{8706}, Characters: []byte{0xe2, 0x88, 0x82}}, "pcy": {Name: "pcy", CodePoints: []int{1087}, Characters: []byte{0xd0, 0xbf}}, "percnt": {Name: "percnt", CodePoints: []int{37}, Characters: []byte{0x25}}, "period": {Name: "period", CodePoints: []int{46}, Characters: []byte{0x2e}}, "permil": {Name: "permil", CodePoints: []int{8240}, Characters: []byte{0xe2, 0x80, 0xb0}}, "perp": {Name: "perp", CodePoints: []int{8869}, Characters: []byte{0xe2, 0x8a, 0xa5}}, "pertenk": {Name: "pertenk", CodePoints: []int{8241}, Characters: []byte{0xe2, 0x80, 0xb1}}, "pfr": {Name: "pfr", CodePoints: []int{120109}, Characters: []byte{0xf0, 0x9d, 0x94, 0xad}}, "phi": {Name: "phi", CodePoints: []int{966}, Characters: []byte{0xcf, 0x86}}, "phiv": {Name: "phiv", CodePoints: []int{981}, Characters: []byte{0xcf, 0x95}}, "phmmat": {Name: "phmmat", CodePoints: []int{8499}, Characters: []byte{0xe2, 0x84, 0xb3}}, "phone": {Name: "phone", CodePoints: []int{9742}, Characters: []byte{0xe2, 0x98, 0x8e}}, "pi": {Name: "pi", CodePoints: []int{960}, Characters: []byte{0xcf, 0x80}}, "pitchfork": {Name: "pitchfork", CodePoints: []int{8916}, Characters: []byte{0xe2, 0x8b, 0x94}}, "piv": {Name: "piv", CodePoints: []int{982}, Characters: []byte{0xcf, 0x96}}, "planck": {Name: "planck", CodePoints: []int{8463}, Characters: []byte{0xe2, 0x84, 0x8f}}, "planckh": {Name: "planckh", CodePoints: []int{8462}, Characters: []byte{0xe2, 0x84, 0x8e}}, "plankv": {Name: "plankv", CodePoints: []int{8463}, Characters: []byte{0xe2, 0x84, 0x8f}}, "plus": {Name: "plus", CodePoints: []int{43}, Characters: []byte{0x2b}}, "plusacir": {Name: "plusacir", CodePoints: []int{10787}, Characters: []byte{0xe2, 0xa8, 0xa3}}, "plusb": {Name: "plusb", CodePoints: []int{8862}, Characters: []byte{0xe2, 0x8a, 0x9e}}, "pluscir": {Name: "pluscir", CodePoints: []int{10786}, Characters: []byte{0xe2, 0xa8, 0xa2}}, "plusdo": {Name: "plusdo", CodePoints: []int{8724}, Characters: []byte{0xe2, 0x88, 0x94}}, "plusdu": {Name: "plusdu", CodePoints: []int{10789}, Characters: []byte{0xe2, 0xa8, 0xa5}}, "pluse": {Name: "pluse", CodePoints: []int{10866}, Characters: []byte{0xe2, 0xa9, 0xb2}}, "plusmn": {Name: "plusmn", CodePoints: []int{177}, Characters: []byte{0xc2, 0xb1}}, "plussim": {Name: "plussim", CodePoints: []int{10790}, Characters: []byte{0xe2, 0xa8, 0xa6}}, "plustwo": {Name: "plustwo", CodePoints: []int{10791}, Characters: []byte{0xe2, 0xa8, 0xa7}}, "pm": {Name: "pm", CodePoints: []int{177}, Characters: []byte{0xc2, 0xb1}}, "pointint": {Name: "pointint", CodePoints: []int{10773}, Characters: []byte{0xe2, 0xa8, 0x95}}, "popf": {Name: "popf", CodePoints: []int{120161}, Characters: []byte{0xf0, 0x9d, 0x95, 0xa1}}, "pound": {Name: "pound", CodePoints: []int{163}, Characters: []byte{0xc2, 0xa3}}, "pr": {Name: "pr", CodePoints: []int{8826}, Characters: []byte{0xe2, 0x89, 0xba}}, "prE": {Name: "prE", CodePoints: []int{10931}, Characters: []byte{0xe2, 0xaa, 0xb3}}, "prap": {Name: "prap", CodePoints: []int{10935}, Characters: []byte{0xe2, 0xaa, 0xb7}}, "prcue": {Name: "prcue", CodePoints: []int{8828}, Characters: []byte{0xe2, 0x89, 0xbc}}, "pre": {Name: "pre", CodePoints: []int{10927}, Characters: []byte{0xe2, 0xaa, 0xaf}}, "prec": {Name: "prec", CodePoints: []int{8826}, Characters: []byte{0xe2, 0x89, 0xba}}, "precapprox": {Name: "precapprox", CodePoints: []int{10935}, Characters: []byte{0xe2, 0xaa, 0xb7}}, "preccurlyeq": {Name: "preccurlyeq", CodePoints: []int{8828}, Characters: []byte{0xe2, 0x89, 0xbc}}, "preceq": {Name: "preceq", CodePoints: []int{10927}, Characters: []byte{0xe2, 0xaa, 0xaf}}, "precnapprox": {Name: "precnapprox", CodePoints: []int{10937}, Characters: []byte{0xe2, 0xaa, 0xb9}}, "precneqq": {Name: "precneqq", CodePoints: []int{10933}, Characters: []byte{0xe2, 0xaa, 0xb5}}, "precnsim": {Name: "precnsim", CodePoints: []int{8936}, Characters: []byte{0xe2, 0x8b, 0xa8}}, "precsim": {Name: "precsim", CodePoints: []int{8830}, Characters: []byte{0xe2, 0x89, 0xbe}}, "prime": {Name: "prime", CodePoints: []int{8242}, Characters: []byte{0xe2, 0x80, 0xb2}}, "primes": {Name: "primes", CodePoints: []int{8473}, Characters: []byte{0xe2, 0x84, 0x99}}, "prnE": {Name: "prnE", CodePoints: []int{10933}, Characters: []byte{0xe2, 0xaa, 0xb5}}, "prnap": {Name: "prnap", CodePoints: []int{10937}, Characters: []byte{0xe2, 0xaa, 0xb9}}, "prnsim": {Name: "prnsim", CodePoints: []int{8936}, Characters: []byte{0xe2, 0x8b, 0xa8}}, "prod": {Name: "prod", CodePoints: []int{8719}, Characters: []byte{0xe2, 0x88, 0x8f}}, "profalar": {Name: "profalar", CodePoints: []int{9006}, Characters: []byte{0xe2, 0x8c, 0xae}}, "profline": {Name: "profline", CodePoints: []int{8978}, Characters: []byte{0xe2, 0x8c, 0x92}}, "profsurf": {Name: "profsurf", CodePoints: []int{8979}, Characters: []byte{0xe2, 0x8c, 0x93}}, "prop": {Name: "prop", CodePoints: []int{8733}, Characters: []byte{0xe2, 0x88, 0x9d}}, "propto": {Name: "propto", CodePoints: []int{8733}, Characters: []byte{0xe2, 0x88, 0x9d}}, "prsim": {Name: "prsim", CodePoints: []int{8830}, Characters: []byte{0xe2, 0x89, 0xbe}}, "prurel": {Name: "prurel", CodePoints: []int{8880}, Characters: []byte{0xe2, 0x8a, 0xb0}}, "pscr": {Name: "pscr", CodePoints: []int{120005}, Characters: []byte{0xf0, 0x9d, 0x93, 0x85}}, "psi": {Name: "psi", CodePoints: []int{968}, Characters: []byte{0xcf, 0x88}}, "puncsp": {Name: "puncsp", CodePoints: []int{8200}, Characters: []byte{0xe2, 0x80, 0x88}}, "qfr": {Name: "qfr", CodePoints: []int{120110}, Characters: []byte{0xf0, 0x9d, 0x94, 0xae}}, "qint": {Name: "qint", CodePoints: []int{10764}, Characters: []byte{0xe2, 0xa8, 0x8c}}, "qopf": {Name: "qopf", CodePoints: []int{120162}, Characters: []byte{0xf0, 0x9d, 0x95, 0xa2}}, "qprime": {Name: "qprime", CodePoints: []int{8279}, Characters: []byte{0xe2, 0x81, 0x97}}, "qscr": {Name: "qscr", CodePoints: []int{120006}, Characters: []byte{0xf0, 0x9d, 0x93, 0x86}}, "quaternions": {Name: "quaternions", CodePoints: []int{8461}, Characters: []byte{0xe2, 0x84, 0x8d}}, "quatint": {Name: "quatint", CodePoints: []int{10774}, Characters: []byte{0xe2, 0xa8, 0x96}}, "quest": {Name: "quest", CodePoints: []int{63}, Characters: []byte{0x3f}}, "questeq": {Name: "questeq", CodePoints: []int{8799}, Characters: []byte{0xe2, 0x89, 0x9f}}, "quot": {Name: "quot", CodePoints: []int{34}, Characters: []byte{0x22}}, "rAarr": {Name: "rAarr", CodePoints: []int{8667}, Characters: []byte{0xe2, 0x87, 0x9b}}, "rArr": {Name: "rArr", CodePoints: []int{8658}, Characters: []byte{0xe2, 0x87, 0x92}}, "rAtail": {Name: "rAtail", CodePoints: []int{10524}, Characters: []byte{0xe2, 0xa4, 0x9c}}, "rBarr": {Name: "rBarr", CodePoints: []int{10511}, Characters: []byte{0xe2, 0xa4, 0x8f}}, "rHar": {Name: "rHar", CodePoints: []int{10596}, Characters: []byte{0xe2, 0xa5, 0xa4}}, "race": {Name: "race", CodePoints: []int{8765, 817}, Characters: []byte{0xe2, 0x88, 0xbd, 0xcc, 0xb1}}, "racute": {Name: "racute", CodePoints: []int{341}, Characters: []byte{0xc5, 0x95}}, "radic": {Name: "radic", CodePoints: []int{8730}, Characters: []byte{0xe2, 0x88, 0x9a}}, "raemptyv": {Name: "raemptyv", CodePoints: []int{10675}, Characters: []byte{0xe2, 0xa6, 0xb3}}, "rang": {Name: "rang", CodePoints: []int{10217}, Characters: []byte{0xe2, 0x9f, 0xa9}}, "rangd": {Name: "rangd", CodePoints: []int{10642}, Characters: []byte{0xe2, 0xa6, 0x92}}, "range": {Name: "range", CodePoints: []int{10661}, Characters: []byte{0xe2, 0xa6, 0xa5}}, "rangle": {Name: "rangle", CodePoints: []int{10217}, Characters: []byte{0xe2, 0x9f, 0xa9}}, "raquo": {Name: "raquo", CodePoints: []int{187}, Characters: []byte{0xc2, 0xbb}}, "rarr": {Name: "rarr", CodePoints: []int{8594}, Characters: []byte{0xe2, 0x86, 0x92}}, "rarrap": {Name: "rarrap", CodePoints: []int{10613}, Characters: []byte{0xe2, 0xa5, 0xb5}}, "rarrb": {Name: "rarrb", CodePoints: []int{8677}, Characters: []byte{0xe2, 0x87, 0xa5}}, "rarrbfs": {Name: "rarrbfs", CodePoints: []int{10528}, Characters: []byte{0xe2, 0xa4, 0xa0}}, "rarrc": {Name: "rarrc", CodePoints: []int{10547}, Characters: []byte{0xe2, 0xa4, 0xb3}}, "rarrfs": {Name: "rarrfs", CodePoints: []int{10526}, Characters: []byte{0xe2, 0xa4, 0x9e}}, "rarrhk": {Name: "rarrhk", CodePoints: []int{8618}, Characters: []byte{0xe2, 0x86, 0xaa}}, "rarrlp": {Name: "rarrlp", CodePoints: []int{8620}, Characters: []byte{0xe2, 0x86, 0xac}}, "rarrpl": {Name: "rarrpl", CodePoints: []int{10565}, Characters: []byte{0xe2, 0xa5, 0x85}}, "rarrsim": {Name: "rarrsim", CodePoints: []int{10612}, Characters: []byte{0xe2, 0xa5, 0xb4}}, "rarrtl": {Name: "rarrtl", CodePoints: []int{8611}, Characters: []byte{0xe2, 0x86, 0xa3}}, "rarrw": {Name: "rarrw", CodePoints: []int{8605}, Characters: []byte{0xe2, 0x86, 0x9d}}, "ratail": {Name: "ratail", CodePoints: []int{10522}, Characters: []byte{0xe2, 0xa4, 0x9a}}, "ratio": {Name: "ratio", CodePoints: []int{8758}, Characters: []byte{0xe2, 0x88, 0xb6}}, "rationals": {Name: "rationals", CodePoints: []int{8474}, Characters: []byte{0xe2, 0x84, 0x9a}}, "rbarr": {Name: "rbarr", CodePoints: []int{10509}, Characters: []byte{0xe2, 0xa4, 0x8d}}, "rbbrk": {Name: "rbbrk", CodePoints: []int{10099}, Characters: []byte{0xe2, 0x9d, 0xb3}}, "rbrace": {Name: "rbrace", CodePoints: []int{125}, Characters: []byte{0x7d}}, "rbrack": {Name: "rbrack", CodePoints: []int{93}, Characters: []byte{0x5d}}, "rbrke": {Name: "rbrke", CodePoints: []int{10636}, Characters: []byte{0xe2, 0xa6, 0x8c}}, "rbrksld": {Name: "rbrksld", CodePoints: []int{10638}, Characters: []byte{0xe2, 0xa6, 0x8e}}, "rbrkslu": {Name: "rbrkslu", CodePoints: []int{10640}, Characters: []byte{0xe2, 0xa6, 0x90}}, "rcaron": {Name: "rcaron", CodePoints: []int{345}, Characters: []byte{0xc5, 0x99}}, "rcedil": {Name: "rcedil", CodePoints: []int{343}, Characters: []byte{0xc5, 0x97}}, "rceil": {Name: "rceil", CodePoints: []int{8969}, Characters: []byte{0xe2, 0x8c, 0x89}}, "rcub": {Name: "rcub", CodePoints: []int{125}, Characters: []byte{0x7d}}, "rcy": {Name: "rcy", CodePoints: []int{1088}, Characters: []byte{0xd1, 0x80}}, "rdca": {Name: "rdca", CodePoints: []int{10551}, Characters: []byte{0xe2, 0xa4, 0xb7}}, "rdldhar": {Name: "rdldhar", CodePoints: []int{10601}, Characters: []byte{0xe2, 0xa5, 0xa9}}, "rdquo": {Name: "rdquo", CodePoints: []int{8221}, Characters: []byte{0xe2, 0x80, 0x9d}}, "rdquor": {Name: "rdquor", CodePoints: []int{8221}, Characters: []byte{0xe2, 0x80, 0x9d}}, "rdsh": {Name: "rdsh", CodePoints: []int{8627}, Characters: []byte{0xe2, 0x86, 0xb3}}, "real": {Name: "real", CodePoints: []int{8476}, Characters: []byte{0xe2, 0x84, 0x9c}}, "realine": {Name: "realine", CodePoints: []int{8475}, Characters: []byte{0xe2, 0x84, 0x9b}}, "realpart": {Name: "realpart", CodePoints: []int{8476}, Characters: []byte{0xe2, 0x84, 0x9c}}, "reals": {Name: "reals", CodePoints: []int{8477}, Characters: []byte{0xe2, 0x84, 0x9d}}, "rect": {Name: "rect", CodePoints: []int{9645}, Characters: []byte{0xe2, 0x96, 0xad}}, "reg": {Name: "reg", CodePoints: []int{174}, Characters: []byte{0xc2, 0xae}}, "rfisht": {Name: "rfisht", CodePoints: []int{10621}, Characters: []byte{0xe2, 0xa5, 0xbd}}, "rfloor": {Name: "rfloor", CodePoints: []int{8971}, Characters: []byte{0xe2, 0x8c, 0x8b}}, "rfr": {Name: "rfr", CodePoints: []int{120111}, Characters: []byte{0xf0, 0x9d, 0x94, 0xaf}}, "rhard": {Name: "rhard", CodePoints: []int{8641}, Characters: []byte{0xe2, 0x87, 0x81}}, "rharu": {Name: "rharu", CodePoints: []int{8640}, Characters: []byte{0xe2, 0x87, 0x80}}, "rharul": {Name: "rharul", CodePoints: []int{10604}, Characters: []byte{0xe2, 0xa5, 0xac}}, "rho": {Name: "rho", CodePoints: []int{961}, Characters: []byte{0xcf, 0x81}}, "rhov": {Name: "rhov", CodePoints: []int{1009}, Characters: []byte{0xcf, 0xb1}}, "rightarrow": {Name: "rightarrow", CodePoints: []int{8594}, Characters: []byte{0xe2, 0x86, 0x92}}, "rightarrowtail": {Name: "rightarrowtail", CodePoints: []int{8611}, Characters: []byte{0xe2, 0x86, 0xa3}}, "rightharpoondown": {Name: "rightharpoondown", CodePoints: []int{8641}, Characters: []byte{0xe2, 0x87, 0x81}}, "rightharpoonup": {Name: "rightharpoonup", CodePoints: []int{8640}, Characters: []byte{0xe2, 0x87, 0x80}}, "rightleftarrows": {Name: "rightleftarrows", CodePoints: []int{8644}, Characters: []byte{0xe2, 0x87, 0x84}}, "rightleftharpoons": {Name: "rightleftharpoons", CodePoints: []int{8652}, Characters: []byte{0xe2, 0x87, 0x8c}}, "rightrightarrows": {Name: "rightrightarrows", CodePoints: []int{8649}, Characters: []byte{0xe2, 0x87, 0x89}}, "rightsquigarrow": {Name: "rightsquigarrow", CodePoints: []int{8605}, Characters: []byte{0xe2, 0x86, 0x9d}}, "rightthreetimes": {Name: "rightthreetimes", CodePoints: []int{8908}, Characters: []byte{0xe2, 0x8b, 0x8c}}, "ring": {Name: "ring", CodePoints: []int{730}, Characters: []byte{0xcb, 0x9a}}, "risingdotseq": {Name: "risingdotseq", CodePoints: []int{8787}, Characters: []byte{0xe2, 0x89, 0x93}}, "rlarr": {Name: "rlarr", CodePoints: []int{8644}, Characters: []byte{0xe2, 0x87, 0x84}}, "rlhar": {Name: "rlhar", CodePoints: []int{8652}, Characters: []byte{0xe2, 0x87, 0x8c}}, "rlm": {Name: "rlm", CodePoints: []int{8207}, Characters: []byte{0xe2, 0x80, 0x8f}}, "rmoust": {Name: "rmoust", CodePoints: []int{9137}, Characters: []byte{0xe2, 0x8e, 0xb1}}, "rmoustache": {Name: "rmoustache", CodePoints: []int{9137}, Characters: []byte{0xe2, 0x8e, 0xb1}}, "rnmid": {Name: "rnmid", CodePoints: []int{10990}, Characters: []byte{0xe2, 0xab, 0xae}}, "roang": {Name: "roang", CodePoints: []int{10221}, Characters: []byte{0xe2, 0x9f, 0xad}}, "roarr": {Name: "roarr", CodePoints: []int{8702}, Characters: []byte{0xe2, 0x87, 0xbe}}, "robrk": {Name: "robrk", CodePoints: []int{10215}, Characters: []byte{0xe2, 0x9f, 0xa7}}, "ropar": {Name: "ropar", CodePoints: []int{10630}, Characters: []byte{0xe2, 0xa6, 0x86}}, "ropf": {Name: "ropf", CodePoints: []int{120163}, Characters: []byte{0xf0, 0x9d, 0x95, 0xa3}}, "roplus": {Name: "roplus", CodePoints: []int{10798}, Characters: []byte{0xe2, 0xa8, 0xae}}, "rotimes": {Name: "rotimes", CodePoints: []int{10805}, Characters: []byte{0xe2, 0xa8, 0xb5}}, "rpar": {Name: "rpar", CodePoints: []int{41}, Characters: []byte{0x29}}, "rpargt": {Name: "rpargt", CodePoints: []int{10644}, Characters: []byte{0xe2, 0xa6, 0x94}}, "rppolint": {Name: "rppolint", CodePoints: []int{10770}, Characters: []byte{0xe2, 0xa8, 0x92}}, "rrarr": {Name: "rrarr", CodePoints: []int{8649}, Characters: []byte{0xe2, 0x87, 0x89}}, "rsaquo": {Name: "rsaquo", CodePoints: []int{8250}, Characters: []byte{0xe2, 0x80, 0xba}}, "rscr": {Name: "rscr", CodePoints: []int{120007}, Characters: []byte{0xf0, 0x9d, 0x93, 0x87}}, "rsh": {Name: "rsh", CodePoints: []int{8625}, Characters: []byte{0xe2, 0x86, 0xb1}}, "rsqb": {Name: "rsqb", CodePoints: []int{93}, Characters: []byte{0x5d}}, "rsquo": {Name: "rsquo", CodePoints: []int{8217}, Characters: []byte{0xe2, 0x80, 0x99}}, "rsquor": {Name: "rsquor", CodePoints: []int{8217}, Characters: []byte{0xe2, 0x80, 0x99}}, "rthree": {Name: "rthree", CodePoints: []int{8908}, Characters: []byte{0xe2, 0x8b, 0x8c}}, "rtimes": {Name: "rtimes", CodePoints: []int{8906}, Characters: []byte{0xe2, 0x8b, 0x8a}}, "rtri": {Name: "rtri", CodePoints: []int{9657}, Characters: []byte{0xe2, 0x96, 0xb9}}, "rtrie": {Name: "rtrie", CodePoints: []int{8885}, Characters: []byte{0xe2, 0x8a, 0xb5}}, "rtrif": {Name: "rtrif", CodePoints: []int{9656}, Characters: []byte{0xe2, 0x96, 0xb8}}, "rtriltri": {Name: "rtriltri", CodePoints: []int{10702}, Characters: []byte{0xe2, 0xa7, 0x8e}}, "ruluhar": {Name: "ruluhar", CodePoints: []int{10600}, Characters: []byte{0xe2, 0xa5, 0xa8}}, "rx": {Name: "rx", CodePoints: []int{8478}, Characters: []byte{0xe2, 0x84, 0x9e}}, "sacute": {Name: "sacute", CodePoints: []int{347}, Characters: []byte{0xc5, 0x9b}}, "sbquo": {Name: "sbquo", CodePoints: []int{8218}, Characters: []byte{0xe2, 0x80, 0x9a}}, "sc": {Name: "sc", CodePoints: []int{8827}, Characters: []byte{0xe2, 0x89, 0xbb}}, "scE": {Name: "scE", CodePoints: []int{10932}, Characters: []byte{0xe2, 0xaa, 0xb4}}, "scap": {Name: "scap", CodePoints: []int{10936}, Characters: []byte{0xe2, 0xaa, 0xb8}}, "scaron": {Name: "scaron", CodePoints: []int{353}, Characters: []byte{0xc5, 0xa1}}, "sccue": {Name: "sccue", CodePoints: []int{8829}, Characters: []byte{0xe2, 0x89, 0xbd}}, "sce": {Name: "sce", CodePoints: []int{10928}, Characters: []byte{0xe2, 0xaa, 0xb0}}, "scedil": {Name: "scedil", CodePoints: []int{351}, Characters: []byte{0xc5, 0x9f}}, "scirc": {Name: "scirc", CodePoints: []int{349}, Characters: []byte{0xc5, 0x9d}}, "scnE": {Name: "scnE", CodePoints: []int{10934}, Characters: []byte{0xe2, 0xaa, 0xb6}}, "scnap": {Name: "scnap", CodePoints: []int{10938}, Characters: []byte{0xe2, 0xaa, 0xba}}, "scnsim": {Name: "scnsim", CodePoints: []int{8937}, Characters: []byte{0xe2, 0x8b, 0xa9}}, "scpolint": {Name: "scpolint", CodePoints: []int{10771}, Characters: []byte{0xe2, 0xa8, 0x93}}, "scsim": {Name: "scsim", CodePoints: []int{8831}, Characters: []byte{0xe2, 0x89, 0xbf}}, "scy": {Name: "scy", CodePoints: []int{1089}, Characters: []byte{0xd1, 0x81}}, "sdot": {Name: "sdot", CodePoints: []int{8901}, Characters: []byte{0xe2, 0x8b, 0x85}}, "sdotb": {Name: "sdotb", CodePoints: []int{8865}, Characters: []byte{0xe2, 0x8a, 0xa1}}, "sdote": {Name: "sdote", CodePoints: []int{10854}, Characters: []byte{0xe2, 0xa9, 0xa6}}, "seArr": {Name: "seArr", CodePoints: []int{8664}, Characters: []byte{0xe2, 0x87, 0x98}}, "searhk": {Name: "searhk", CodePoints: []int{10533}, Characters: []byte{0xe2, 0xa4, 0xa5}}, "searr": {Name: "searr", CodePoints: []int{8600}, Characters: []byte{0xe2, 0x86, 0x98}}, "searrow": {Name: "searrow", CodePoints: []int{8600}, Characters: []byte{0xe2, 0x86, 0x98}}, "sect": {Name: "sect", CodePoints: []int{167}, Characters: []byte{0xc2, 0xa7}}, "semi": {Name: "semi", CodePoints: []int{59}, Characters: []byte{0x3b}}, "seswar": {Name: "seswar", CodePoints: []int{10537}, Characters: []byte{0xe2, 0xa4, 0xa9}}, "setminus": {Name: "setminus", CodePoints: []int{8726}, Characters: []byte{0xe2, 0x88, 0x96}}, "setmn": {Name: "setmn", CodePoints: []int{8726}, Characters: []byte{0xe2, 0x88, 0x96}}, "sext": {Name: "sext", CodePoints: []int{10038}, Characters: []byte{0xe2, 0x9c, 0xb6}}, "sfr": {Name: "sfr", CodePoints: []int{120112}, Characters: []byte{0xf0, 0x9d, 0x94, 0xb0}}, "sfrown": {Name: "sfrown", CodePoints: []int{8994}, Characters: []byte{0xe2, 0x8c, 0xa2}}, "sharp": {Name: "sharp", CodePoints: []int{9839}, Characters: []byte{0xe2, 0x99, 0xaf}}, "shchcy": {Name: "shchcy", CodePoints: []int{1097}, Characters: []byte{0xd1, 0x89}}, "shcy": {Name: "shcy", CodePoints: []int{1096}, Characters: []byte{0xd1, 0x88}}, "shortmid": {Name: "shortmid", CodePoints: []int{8739}, Characters: []byte{0xe2, 0x88, 0xa3}}, "shortparallel": {Name: "shortparallel", CodePoints: []int{8741}, Characters: []byte{0xe2, 0x88, 0xa5}}, "shy": {Name: "shy", CodePoints: []int{173}, Characters: []byte{0xc2, 0xad}}, "sigma": {Name: "sigma", CodePoints: []int{963}, Characters: []byte{0xcf, 0x83}}, "sigmaf": {Name: "sigmaf", CodePoints: []int{962}, Characters: []byte{0xcf, 0x82}}, "sigmav": {Name: "sigmav", CodePoints: []int{962}, Characters: []byte{0xcf, 0x82}}, "sim": {Name: "sim", CodePoints: []int{8764}, Characters: []byte{0xe2, 0x88, 0xbc}}, "simdot": {Name: "simdot", CodePoints: []int{10858}, Characters: []byte{0xe2, 0xa9, 0xaa}}, "sime": {Name: "sime", CodePoints: []int{8771}, Characters: []byte{0xe2, 0x89, 0x83}}, "simeq": {Name: "simeq", CodePoints: []int{8771}, Characters: []byte{0xe2, 0x89, 0x83}}, "simg": {Name: "simg", CodePoints: []int{10910}, Characters: []byte{0xe2, 0xaa, 0x9e}}, "simgE": {Name: "simgE", CodePoints: []int{10912}, Characters: []byte{0xe2, 0xaa, 0xa0}}, "siml": {Name: "siml", CodePoints: []int{10909}, Characters: []byte{0xe2, 0xaa, 0x9d}}, "simlE": {Name: "simlE", CodePoints: []int{10911}, Characters: []byte{0xe2, 0xaa, 0x9f}}, "simne": {Name: "simne", CodePoints: []int{8774}, Characters: []byte{0xe2, 0x89, 0x86}}, "simplus": {Name: "simplus", CodePoints: []int{10788}, Characters: []byte{0xe2, 0xa8, 0xa4}}, "simrarr": {Name: "simrarr", CodePoints: []int{10610}, Characters: []byte{0xe2, 0xa5, 0xb2}}, "slarr": {Name: "slarr", CodePoints: []int{8592}, Characters: []byte{0xe2, 0x86, 0x90}}, "smallsetminus": {Name: "smallsetminus", CodePoints: []int{8726}, Characters: []byte{0xe2, 0x88, 0x96}}, "smashp": {Name: "smashp", CodePoints: []int{10803}, Characters: []byte{0xe2, 0xa8, 0xb3}}, "smeparsl": {Name: "smeparsl", CodePoints: []int{10724}, Characters: []byte{0xe2, 0xa7, 0xa4}}, "smid": {Name: "smid", CodePoints: []int{8739}, Characters: []byte{0xe2, 0x88, 0xa3}}, "smile": {Name: "smile", CodePoints: []int{8995}, Characters: []byte{0xe2, 0x8c, 0xa3}}, "smt": {Name: "smt", CodePoints: []int{10922}, Characters: []byte{0xe2, 0xaa, 0xaa}}, "smte": {Name: "smte", CodePoints: []int{10924}, Characters: []byte{0xe2, 0xaa, 0xac}}, "smtes": {Name: "smtes", CodePoints: []int{10924, 65024}, Characters: []byte{0xe2, 0xaa, 0xac, 0xef, 0xb8, 0x80}}, "softcy": {Name: "softcy", CodePoints: []int{1100}, Characters: []byte{0xd1, 0x8c}}, "sol": {Name: "sol", CodePoints: []int{47}, Characters: []byte{0x2f}}, "solb": {Name: "solb", CodePoints: []int{10692}, Characters: []byte{0xe2, 0xa7, 0x84}}, "solbar": {Name: "solbar", CodePoints: []int{9023}, Characters: []byte{0xe2, 0x8c, 0xbf}}, "sopf": {Name: "sopf", CodePoints: []int{120164}, Characters: []byte{0xf0, 0x9d, 0x95, 0xa4}}, "spades": {Name: "spades", CodePoints: []int{9824}, Characters: []byte{0xe2, 0x99, 0xa0}}, "spadesuit": {Name: "spadesuit", CodePoints: []int{9824}, Characters: []byte{0xe2, 0x99, 0xa0}}, "spar": {Name: "spar", CodePoints: []int{8741}, Characters: []byte{0xe2, 0x88, 0xa5}}, "sqcap": {Name: "sqcap", CodePoints: []int{8851}, Characters: []byte{0xe2, 0x8a, 0x93}}, "sqcaps": {Name: "sqcaps", CodePoints: []int{8851, 65024}, Characters: []byte{0xe2, 0x8a, 0x93, 0xef, 0xb8, 0x80}}, "sqcup": {Name: "sqcup", CodePoints: []int{8852}, Characters: []byte{0xe2, 0x8a, 0x94}}, "sqcups": {Name: "sqcups", CodePoints: []int{8852, 65024}, Characters: []byte{0xe2, 0x8a, 0x94, 0xef, 0xb8, 0x80}}, "sqsub": {Name: "sqsub", CodePoints: []int{8847}, Characters: []byte{0xe2, 0x8a, 0x8f}}, "sqsube": {Name: "sqsube", CodePoints: []int{8849}, Characters: []byte{0xe2, 0x8a, 0x91}}, "sqsubset": {Name: "sqsubset", CodePoints: []int{8847}, Characters: []byte{0xe2, 0x8a, 0x8f}}, "sqsubseteq": {Name: "sqsubseteq", CodePoints: []int{8849}, Characters: []byte{0xe2, 0x8a, 0x91}}, "sqsup": {Name: "sqsup", CodePoints: []int{8848}, Characters: []byte{0xe2, 0x8a, 0x90}}, "sqsupe": {Name: "sqsupe", CodePoints: []int{8850}, Characters: []byte{0xe2, 0x8a, 0x92}}, "sqsupset": {Name: "sqsupset", CodePoints: []int{8848}, Characters: []byte{0xe2, 0x8a, 0x90}}, "sqsupseteq": {Name: "sqsupseteq", CodePoints: []int{8850}, Characters: []byte{0xe2, 0x8a, 0x92}}, "squ": {Name: "squ", CodePoints: []int{9633}, Characters: []byte{0xe2, 0x96, 0xa1}}, "square": {Name: "square", CodePoints: []int{9633}, Characters: []byte{0xe2, 0x96, 0xa1}}, "squarf": {Name: "squarf", CodePoints: []int{9642}, Characters: []byte{0xe2, 0x96, 0xaa}}, "squf": {Name: "squf", CodePoints: []int{9642}, Characters: []byte{0xe2, 0x96, 0xaa}}, "srarr": {Name: "srarr", CodePoints: []int{8594}, Characters: []byte{0xe2, 0x86, 0x92}}, "sscr": {Name: "sscr", CodePoints: []int{120008}, Characters: []byte{0xf0, 0x9d, 0x93, 0x88}}, "ssetmn": {Name: "ssetmn", CodePoints: []int{8726}, Characters: []byte{0xe2, 0x88, 0x96}}, "ssmile": {Name: "ssmile", CodePoints: []int{8995}, Characters: []byte{0xe2, 0x8c, 0xa3}}, "sstarf": {Name: "sstarf", CodePoints: []int{8902}, Characters: []byte{0xe2, 0x8b, 0x86}}, "star": {Name: "star", CodePoints: []int{9734}, Characters: []byte{0xe2, 0x98, 0x86}}, "starf": {Name: "starf", CodePoints: []int{9733}, Characters: []byte{0xe2, 0x98, 0x85}}, "straightepsilon": {Name: "straightepsilon", CodePoints: []int{1013}, Characters: []byte{0xcf, 0xb5}}, "straightphi": {Name: "straightphi", CodePoints: []int{981}, Characters: []byte{0xcf, 0x95}}, "strns": {Name: "strns", CodePoints: []int{175}, Characters: []byte{0xc2, 0xaf}}, "sub": {Name: "sub", CodePoints: []int{8834}, Characters: []byte{0xe2, 0x8a, 0x82}}, "subE": {Name: "subE", CodePoints: []int{10949}, Characters: []byte{0xe2, 0xab, 0x85}}, "subdot": {Name: "subdot", CodePoints: []int{10941}, Characters: []byte{0xe2, 0xaa, 0xbd}}, "sube": {Name: "sube", CodePoints: []int{8838}, Characters: []byte{0xe2, 0x8a, 0x86}}, "subedot": {Name: "subedot", CodePoints: []int{10947}, Characters: []byte{0xe2, 0xab, 0x83}}, "submult": {Name: "submult", CodePoints: []int{10945}, Characters: []byte{0xe2, 0xab, 0x81}}, "subnE": {Name: "subnE", CodePoints: []int{10955}, Characters: []byte{0xe2, 0xab, 0x8b}}, "subne": {Name: "subne", CodePoints: []int{8842}, Characters: []byte{0xe2, 0x8a, 0x8a}}, "subplus": {Name: "subplus", CodePoints: []int{10943}, Characters: []byte{0xe2, 0xaa, 0xbf}}, "subrarr": {Name: "subrarr", CodePoints: []int{10617}, Characters: []byte{0xe2, 0xa5, 0xb9}}, "subset": {Name: "subset", CodePoints: []int{8834}, Characters: []byte{0xe2, 0x8a, 0x82}}, "subseteq": {Name: "subseteq", CodePoints: []int{8838}, Characters: []byte{0xe2, 0x8a, 0x86}}, "subseteqq": {Name: "subseteqq", CodePoints: []int{10949}, Characters: []byte{0xe2, 0xab, 0x85}}, "subsetneq": {Name: "subsetneq", CodePoints: []int{8842}, Characters: []byte{0xe2, 0x8a, 0x8a}}, "subsetneqq": {Name: "subsetneqq", CodePoints: []int{10955}, Characters: []byte{0xe2, 0xab, 0x8b}}, "subsim": {Name: "subsim", CodePoints: []int{10951}, Characters: []byte{0xe2, 0xab, 0x87}}, "subsub": {Name: "subsub", CodePoints: []int{10965}, Characters: []byte{0xe2, 0xab, 0x95}}, "subsup": {Name: "subsup", CodePoints: []int{10963}, Characters: []byte{0xe2, 0xab, 0x93}}, "succ": {Name: "succ", CodePoints: []int{8827}, Characters: []byte{0xe2, 0x89, 0xbb}}, "succapprox": {Name: "succapprox", CodePoints: []int{10936}, Characters: []byte{0xe2, 0xaa, 0xb8}}, "succcurlyeq": {Name: "succcurlyeq", CodePoints: []int{8829}, Characters: []byte{0xe2, 0x89, 0xbd}}, "succeq": {Name: "succeq", CodePoints: []int{10928}, Characters: []byte{0xe2, 0xaa, 0xb0}}, "succnapprox": {Name: "succnapprox", CodePoints: []int{10938}, Characters: []byte{0xe2, 0xaa, 0xba}}, "succneqq": {Name: "succneqq", CodePoints: []int{10934}, Characters: []byte{0xe2, 0xaa, 0xb6}}, "succnsim": {Name: "succnsim", CodePoints: []int{8937}, Characters: []byte{0xe2, 0x8b, 0xa9}}, "succsim": {Name: "succsim", CodePoints: []int{8831}, Characters: []byte{0xe2, 0x89, 0xbf}}, "sum": {Name: "sum", CodePoints: []int{8721}, Characters: []byte{0xe2, 0x88, 0x91}}, "sung": {Name: "sung", CodePoints: []int{9834}, Characters: []byte{0xe2, 0x99, 0xaa}}, "sup": {Name: "sup", CodePoints: []int{8835}, Characters: []byte{0xe2, 0x8a, 0x83}}, "sup1": {Name: "sup1", CodePoints: []int{185}, Characters: []byte{0xc2, 0xb9}}, "sup2": {Name: "sup2", CodePoints: []int{178}, Characters: []byte{0xc2, 0xb2}}, "sup3": {Name: "sup3", CodePoints: []int{179}, Characters: []byte{0xc2, 0xb3}}, "supE": {Name: "supE", CodePoints: []int{10950}, Characters: []byte{0xe2, 0xab, 0x86}}, "supdot": {Name: "supdot", CodePoints: []int{10942}, Characters: []byte{0xe2, 0xaa, 0xbe}}, "supdsub": {Name: "supdsub", CodePoints: []int{10968}, Characters: []byte{0xe2, 0xab, 0x98}}, "supe": {Name: "supe", CodePoints: []int{8839}, Characters: []byte{0xe2, 0x8a, 0x87}}, "supedot": {Name: "supedot", CodePoints: []int{10948}, Characters: []byte{0xe2, 0xab, 0x84}}, "suphsol": {Name: "suphsol", CodePoints: []int{10185}, Characters: []byte{0xe2, 0x9f, 0x89}}, "suphsub": {Name: "suphsub", CodePoints: []int{10967}, Characters: []byte{0xe2, 0xab, 0x97}}, "suplarr": {Name: "suplarr", CodePoints: []int{10619}, Characters: []byte{0xe2, 0xa5, 0xbb}}, "supmult": {Name: "supmult", CodePoints: []int{10946}, Characters: []byte{0xe2, 0xab, 0x82}}, "supnE": {Name: "supnE", CodePoints: []int{10956}, Characters: []byte{0xe2, 0xab, 0x8c}}, "supne": {Name: "supne", CodePoints: []int{8843}, Characters: []byte{0xe2, 0x8a, 0x8b}}, "supplus": {Name: "supplus", CodePoints: []int{10944}, Characters: []byte{0xe2, 0xab, 0x80}}, "supset": {Name: "supset", CodePoints: []int{8835}, Characters: []byte{0xe2, 0x8a, 0x83}}, "supseteq": {Name: "supseteq", CodePoints: []int{8839}, Characters: []byte{0xe2, 0x8a, 0x87}}, "supseteqq": {Name: "supseteqq", CodePoints: []int{10950}, Characters: []byte{0xe2, 0xab, 0x86}}, "supsetneq": {Name: "supsetneq", CodePoints: []int{8843}, Characters: []byte{0xe2, 0x8a, 0x8b}}, "supsetneqq": {Name: "supsetneqq", CodePoints: []int{10956}, Characters: []byte{0xe2, 0xab, 0x8c}}, "supsim": {Name: "supsim", CodePoints: []int{10952}, Characters: []byte{0xe2, 0xab, 0x88}}, "supsub": {Name: "supsub", CodePoints: []int{10964}, Characters: []byte{0xe2, 0xab, 0x94}}, "supsup": {Name: "supsup", CodePoints: []int{10966}, Characters: []byte{0xe2, 0xab, 0x96}}, "swArr": {Name: "swArr", CodePoints: []int{8665}, Characters: []byte{0xe2, 0x87, 0x99}}, "swarhk": {Name: "swarhk", CodePoints: []int{10534}, Characters: []byte{0xe2, 0xa4, 0xa6}}, "swarr": {Name: "swarr", CodePoints: []int{8601}, Characters: []byte{0xe2, 0x86, 0x99}}, "swarrow": {Name: "swarrow", CodePoints: []int{8601}, Characters: []byte{0xe2, 0x86, 0x99}}, "swnwar": {Name: "swnwar", CodePoints: []int{10538}, Characters: []byte{0xe2, 0xa4, 0xaa}}, "szlig": {Name: "szlig", CodePoints: []int{223}, Characters: []byte{0xc3, 0x9f}}, "target": {Name: "target", CodePoints: []int{8982}, Characters: []byte{0xe2, 0x8c, 0x96}}, "tau": {Name: "tau", CodePoints: []int{964}, Characters: []byte{0xcf, 0x84}}, "tbrk": {Name: "tbrk", CodePoints: []int{9140}, Characters: []byte{0xe2, 0x8e, 0xb4}}, "tcaron": {Name: "tcaron", CodePoints: []int{357}, Characters: []byte{0xc5, 0xa5}}, "tcedil": {Name: "tcedil", CodePoints: []int{355}, Characters: []byte{0xc5, 0xa3}}, "tcy": {Name: "tcy", CodePoints: []int{1090}, Characters: []byte{0xd1, 0x82}}, "tdot": {Name: "tdot", CodePoints: []int{8411}, Characters: []byte{0xe2, 0x83, 0x9b}}, "telrec": {Name: "telrec", CodePoints: []int{8981}, Characters: []byte{0xe2, 0x8c, 0x95}}, "tfr": {Name: "tfr", CodePoints: []int{120113}, Characters: []byte{0xf0, 0x9d, 0x94, 0xb1}}, "there4": {Name: "there4", CodePoints: []int{8756}, Characters: []byte{0xe2, 0x88, 0xb4}}, "therefore": {Name: "therefore", CodePoints: []int{8756}, Characters: []byte{0xe2, 0x88, 0xb4}}, "theta": {Name: "theta", CodePoints: []int{952}, Characters: []byte{0xce, 0xb8}}, "thetasym": {Name: "thetasym", CodePoints: []int{977}, Characters: []byte{0xcf, 0x91}}, "thetav": {Name: "thetav", CodePoints: []int{977}, Characters: []byte{0xcf, 0x91}}, "thickapprox": {Name: "thickapprox", CodePoints: []int{8776}, Characters: []byte{0xe2, 0x89, 0x88}}, "thicksim": {Name: "thicksim", CodePoints: []int{8764}, Characters: []byte{0xe2, 0x88, 0xbc}}, "thinsp": {Name: "thinsp", CodePoints: []int{8201}, Characters: []byte{0xe2, 0x80, 0x89}}, "thkap": {Name: "thkap", CodePoints: []int{8776}, Characters: []byte{0xe2, 0x89, 0x88}}, "thksim": {Name: "thksim", CodePoints: []int{8764}, Characters: []byte{0xe2, 0x88, 0xbc}}, "thorn": {Name: "thorn", CodePoints: []int{254}, Characters: []byte{0xc3, 0xbe}}, "tilde": {Name: "tilde", CodePoints: []int{732}, Characters: []byte{0xcb, 0x9c}}, "times": {Name: "times", CodePoints: []int{215}, Characters: []byte{0xc3, 0x97}}, "timesb": {Name: "timesb", CodePoints: []int{8864}, Characters: []byte{0xe2, 0x8a, 0xa0}}, "timesbar": {Name: "timesbar", CodePoints: []int{10801}, Characters: []byte{0xe2, 0xa8, 0xb1}}, "timesd": {Name: "timesd", CodePoints: []int{10800}, Characters: []byte{0xe2, 0xa8, 0xb0}}, "tint": {Name: "tint", CodePoints: []int{8749}, Characters: []byte{0xe2, 0x88, 0xad}}, "toea": {Name: "toea", CodePoints: []int{10536}, Characters: []byte{0xe2, 0xa4, 0xa8}}, "top": {Name: "top", CodePoints: []int{8868}, Characters: []byte{0xe2, 0x8a, 0xa4}}, "topbot": {Name: "topbot", CodePoints: []int{9014}, Characters: []byte{0xe2, 0x8c, 0xb6}}, "topcir": {Name: "topcir", CodePoints: []int{10993}, Characters: []byte{0xe2, 0xab, 0xb1}}, "topf": {Name: "topf", CodePoints: []int{120165}, Characters: []byte{0xf0, 0x9d, 0x95, 0xa5}}, "topfork": {Name: "topfork", CodePoints: []int{10970}, Characters: []byte{0xe2, 0xab, 0x9a}}, "tosa": {Name: "tosa", CodePoints: []int{10537}, Characters: []byte{0xe2, 0xa4, 0xa9}}, "tprime": {Name: "tprime", CodePoints: []int{8244}, Characters: []byte{0xe2, 0x80, 0xb4}}, "trade": {Name: "trade", CodePoints: []int{8482}, Characters: []byte{0xe2, 0x84, 0xa2}}, "triangle": {Name: "triangle", CodePoints: []int{9653}, Characters: []byte{0xe2, 0x96, 0xb5}}, "triangledown": {Name: "triangledown", CodePoints: []int{9663}, Characters: []byte{0xe2, 0x96, 0xbf}}, "triangleleft": {Name: "triangleleft", CodePoints: []int{9667}, Characters: []byte{0xe2, 0x97, 0x83}}, "trianglelefteq": {Name: "trianglelefteq", CodePoints: []int{8884}, Characters: []byte{0xe2, 0x8a, 0xb4}}, "triangleq": {Name: "triangleq", CodePoints: []int{8796}, Characters: []byte{0xe2, 0x89, 0x9c}}, "triangleright": {Name: "triangleright", CodePoints: []int{9657}, Characters: []byte{0xe2, 0x96, 0xb9}}, "trianglerighteq": {Name: "trianglerighteq", CodePoints: []int{8885}, Characters: []byte{0xe2, 0x8a, 0xb5}}, "tridot": {Name: "tridot", CodePoints: []int{9708}, Characters: []byte{0xe2, 0x97, 0xac}}, "trie": {Name: "trie", CodePoints: []int{8796}, Characters: []byte{0xe2, 0x89, 0x9c}}, "triminus": {Name: "triminus", CodePoints: []int{10810}, Characters: []byte{0xe2, 0xa8, 0xba}}, "triplus": {Name: "triplus", CodePoints: []int{10809}, Characters: []byte{0xe2, 0xa8, 0xb9}}, "trisb": {Name: "trisb", CodePoints: []int{10701}, Characters: []byte{0xe2, 0xa7, 0x8d}}, "tritime": {Name: "tritime", CodePoints: []int{10811}, Characters: []byte{0xe2, 0xa8, 0xbb}}, "trpezium": {Name: "trpezium", CodePoints: []int{9186}, Characters: []byte{0xe2, 0x8f, 0xa2}}, "tscr": {Name: "tscr", CodePoints: []int{120009}, Characters: []byte{0xf0, 0x9d, 0x93, 0x89}}, "tscy": {Name: "tscy", CodePoints: []int{1094}, Characters: []byte{0xd1, 0x86}}, "tshcy": {Name: "tshcy", CodePoints: []int{1115}, Characters: []byte{0xd1, 0x9b}}, "tstrok": {Name: "tstrok", CodePoints: []int{359}, Characters: []byte{0xc5, 0xa7}}, "twixt": {Name: "twixt", CodePoints: []int{8812}, Characters: []byte{0xe2, 0x89, 0xac}}, "twoheadleftarrow": {Name: "twoheadleftarrow", CodePoints: []int{8606}, Characters: []byte{0xe2, 0x86, 0x9e}}, "twoheadrightarrow": {Name: "twoheadrightarrow", CodePoints: []int{8608}, Characters: []byte{0xe2, 0x86, 0xa0}}, "uArr": {Name: "uArr", CodePoints: []int{8657}, Characters: []byte{0xe2, 0x87, 0x91}}, "uHar": {Name: "uHar", CodePoints: []int{10595}, Characters: []byte{0xe2, 0xa5, 0xa3}}, "uacute": {Name: "uacute", CodePoints: []int{250}, Characters: []byte{0xc3, 0xba}}, "uarr": {Name: "uarr", CodePoints: []int{8593}, Characters: []byte{0xe2, 0x86, 0x91}}, "ubrcy": {Name: "ubrcy", CodePoints: []int{1118}, Characters: []byte{0xd1, 0x9e}}, "ubreve": {Name: "ubreve", CodePoints: []int{365}, Characters: []byte{0xc5, 0xad}}, "ucirc": {Name: "ucirc", CodePoints: []int{251}, Characters: []byte{0xc3, 0xbb}}, "ucy": {Name: "ucy", CodePoints: []int{1091}, Characters: []byte{0xd1, 0x83}}, "udarr": {Name: "udarr", CodePoints: []int{8645}, Characters: []byte{0xe2, 0x87, 0x85}}, "udblac": {Name: "udblac", CodePoints: []int{369}, Characters: []byte{0xc5, 0xb1}}, "udhar": {Name: "udhar", CodePoints: []int{10606}, Characters: []byte{0xe2, 0xa5, 0xae}}, "ufisht": {Name: "ufisht", CodePoints: []int{10622}, Characters: []byte{0xe2, 0xa5, 0xbe}}, "ufr": {Name: "ufr", CodePoints: []int{120114}, Characters: []byte{0xf0, 0x9d, 0x94, 0xb2}}, "ugrave": {Name: "ugrave", CodePoints: []int{249}, Characters: []byte{0xc3, 0xb9}}, "uharl": {Name: "uharl", CodePoints: []int{8639}, Characters: []byte{0xe2, 0x86, 0xbf}}, "uharr": {Name: "uharr", CodePoints: []int{8638}, Characters: []byte{0xe2, 0x86, 0xbe}}, "uhblk": {Name: "uhblk", CodePoints: []int{9600}, Characters: []byte{0xe2, 0x96, 0x80}}, "ulcorn": {Name: "ulcorn", CodePoints: []int{8988}, Characters: []byte{0xe2, 0x8c, 0x9c}}, "ulcorner": {Name: "ulcorner", CodePoints: []int{8988}, Characters: []byte{0xe2, 0x8c, 0x9c}}, "ulcrop": {Name: "ulcrop", CodePoints: []int{8975}, Characters: []byte{0xe2, 0x8c, 0x8f}}, "ultri": {Name: "ultri", CodePoints: []int{9720}, Characters: []byte{0xe2, 0x97, 0xb8}}, "umacr": {Name: "umacr", CodePoints: []int{363}, Characters: []byte{0xc5, 0xab}}, "uml": {Name: "uml", CodePoints: []int{168}, Characters: []byte{0xc2, 0xa8}}, "uogon": {Name: "uogon", CodePoints: []int{371}, Characters: []byte{0xc5, 0xb3}}, "uopf": {Name: "uopf", CodePoints: []int{120166}, Characters: []byte{0xf0, 0x9d, 0x95, 0xa6}}, "uparrow": {Name: "uparrow", CodePoints: []int{8593}, Characters: []byte{0xe2, 0x86, 0x91}}, "updownarrow": {Name: "updownarrow", CodePoints: []int{8597}, Characters: []byte{0xe2, 0x86, 0x95}}, "upharpoonleft": {Name: "upharpoonleft", CodePoints: []int{8639}, Characters: []byte{0xe2, 0x86, 0xbf}}, "upharpoonright": {Name: "upharpoonright", CodePoints: []int{8638}, Characters: []byte{0xe2, 0x86, 0xbe}}, "uplus": {Name: "uplus", CodePoints: []int{8846}, Characters: []byte{0xe2, 0x8a, 0x8e}}, "upsi": {Name: "upsi", CodePoints: []int{965}, Characters: []byte{0xcf, 0x85}}, "upsih": {Name: "upsih", CodePoints: []int{978}, Characters: []byte{0xcf, 0x92}}, "upsilon": {Name: "upsilon", CodePoints: []int{965}, Characters: []byte{0xcf, 0x85}}, "upuparrows": {Name: "upuparrows", CodePoints: []int{8648}, Characters: []byte{0xe2, 0x87, 0x88}}, "urcorn": {Name: "urcorn", CodePoints: []int{8989}, Characters: []byte{0xe2, 0x8c, 0x9d}}, "urcorner": {Name: "urcorner", CodePoints: []int{8989}, Characters: []byte{0xe2, 0x8c, 0x9d}}, "urcrop": {Name: "urcrop", CodePoints: []int{8974}, Characters: []byte{0xe2, 0x8c, 0x8e}}, "uring": {Name: "uring", CodePoints: []int{367}, Characters: []byte{0xc5, 0xaf}}, "urtri": {Name: "urtri", CodePoints: []int{9721}, Characters: []byte{0xe2, 0x97, 0xb9}}, "uscr": {Name: "uscr", CodePoints: []int{120010}, Characters: []byte{0xf0, 0x9d, 0x93, 0x8a}}, "utdot": {Name: "utdot", CodePoints: []int{8944}, Characters: []byte{0xe2, 0x8b, 0xb0}}, "utilde": {Name: "utilde", CodePoints: []int{361}, Characters: []byte{0xc5, 0xa9}}, "utri": {Name: "utri", CodePoints: []int{9653}, Characters: []byte{0xe2, 0x96, 0xb5}}, "utrif": {Name: "utrif", CodePoints: []int{9652}, Characters: []byte{0xe2, 0x96, 0xb4}}, "uuarr": {Name: "uuarr", CodePoints: []int{8648}, Characters: []byte{0xe2, 0x87, 0x88}}, "uuml": {Name: "uuml", CodePoints: []int{252}, Characters: []byte{0xc3, 0xbc}}, "uwangle": {Name: "uwangle", CodePoints: []int{10663}, Characters: []byte{0xe2, 0xa6, 0xa7}}, "vArr": {Name: "vArr", CodePoints: []int{8661}, Characters: []byte{0xe2, 0x87, 0x95}}, "vBar": {Name: "vBar", CodePoints: []int{10984}, Characters: []byte{0xe2, 0xab, 0xa8}}, "vBarv": {Name: "vBarv", CodePoints: []int{10985}, Characters: []byte{0xe2, 0xab, 0xa9}}, "vDash": {Name: "vDash", CodePoints: []int{8872}, Characters: []byte{0xe2, 0x8a, 0xa8}}, "vangrt": {Name: "vangrt", CodePoints: []int{10652}, Characters: []byte{0xe2, 0xa6, 0x9c}}, "varepsilon": {Name: "varepsilon", CodePoints: []int{1013}, Characters: []byte{0xcf, 0xb5}}, "varkappa": {Name: "varkappa", CodePoints: []int{1008}, Characters: []byte{0xcf, 0xb0}}, "varnothing": {Name: "varnothing", CodePoints: []int{8709}, Characters: []byte{0xe2, 0x88, 0x85}}, "varphi": {Name: "varphi", CodePoints: []int{981}, Characters: []byte{0xcf, 0x95}}, "varpi": {Name: "varpi", CodePoints: []int{982}, Characters: []byte{0xcf, 0x96}}, "varpropto": {Name: "varpropto", CodePoints: []int{8733}, Characters: []byte{0xe2, 0x88, 0x9d}}, "varr": {Name: "varr", CodePoints: []int{8597}, Characters: []byte{0xe2, 0x86, 0x95}}, "varrho": {Name: "varrho", CodePoints: []int{1009}, Characters: []byte{0xcf, 0xb1}}, "varsigma": {Name: "varsigma", CodePoints: []int{962}, Characters: []byte{0xcf, 0x82}}, "varsubsetneq": {Name: "varsubsetneq", CodePoints: []int{8842, 65024}, Characters: []byte{0xe2, 0x8a, 0x8a, 0xef, 0xb8, 0x80}}, "varsubsetneqq": {Name: "varsubsetneqq", CodePoints: []int{10955, 65024}, Characters: []byte{0xe2, 0xab, 0x8b, 0xef, 0xb8, 0x80}}, "varsupsetneq": {Name: "varsupsetneq", CodePoints: []int{8843, 65024}, Characters: []byte{0xe2, 0x8a, 0x8b, 0xef, 0xb8, 0x80}}, "varsupsetneqq": {Name: "varsupsetneqq", CodePoints: []int{10956, 65024}, Characters: []byte{0xe2, 0xab, 0x8c, 0xef, 0xb8, 0x80}}, "vartheta": {Name: "vartheta", CodePoints: []int{977}, Characters: []byte{0xcf, 0x91}}, "vartriangleleft": {Name: "vartriangleleft", CodePoints: []int{8882}, Characters: []byte{0xe2, 0x8a, 0xb2}}, "vartriangleright": {Name: "vartriangleright", CodePoints: []int{8883}, Characters: []byte{0xe2, 0x8a, 0xb3}}, "vcy": {Name: "vcy", CodePoints: []int{1074}, Characters: []byte{0xd0, 0xb2}}, "vdash": {Name: "vdash", CodePoints: []int{8866}, Characters: []byte{0xe2, 0x8a, 0xa2}}, "vee": {Name: "vee", CodePoints: []int{8744}, Characters: []byte{0xe2, 0x88, 0xa8}}, "veebar": {Name: "veebar", CodePoints: []int{8891}, Characters: []byte{0xe2, 0x8a, 0xbb}}, "veeeq": {Name: "veeeq", CodePoints: []int{8794}, Characters: []byte{0xe2, 0x89, 0x9a}}, "vellip": {Name: "vellip", CodePoints: []int{8942}, Characters: []byte{0xe2, 0x8b, 0xae}}, "verbar": {Name: "verbar", CodePoints: []int{124}, Characters: []byte{0x7c}}, "vert": {Name: "vert", CodePoints: []int{124}, Characters: []byte{0x7c}}, "vfr": {Name: "vfr", CodePoints: []int{120115}, Characters: []byte{0xf0, 0x9d, 0x94, 0xb3}}, "vltri": {Name: "vltri", CodePoints: []int{8882}, Characters: []byte{0xe2, 0x8a, 0xb2}}, "vnsub": {Name: "vnsub", CodePoints: []int{8834, 8402}, Characters: []byte{0xe2, 0x8a, 0x82, 0xe2, 0x83, 0x92}}, "vnsup": {Name: "vnsup", CodePoints: []int{8835, 8402}, Characters: []byte{0xe2, 0x8a, 0x83, 0xe2, 0x83, 0x92}}, "vopf": {Name: "vopf", CodePoints: []int{120167}, Characters: []byte{0xf0, 0x9d, 0x95, 0xa7}}, "vprop": {Name: "vprop", CodePoints: []int{8733}, Characters: []byte{0xe2, 0x88, 0x9d}}, "vrtri": {Name: "vrtri", CodePoints: []int{8883}, Characters: []byte{0xe2, 0x8a, 0xb3}}, "vscr": {Name: "vscr", CodePoints: []int{120011}, Characters: []byte{0xf0, 0x9d, 0x93, 0x8b}}, "vsubnE": {Name: "vsubnE", CodePoints: []int{10955, 65024}, Characters: []byte{0xe2, 0xab, 0x8b, 0xef, 0xb8, 0x80}}, "vsubne": {Name: "vsubne", CodePoints: []int{8842, 65024}, Characters: []byte{0xe2, 0x8a, 0x8a, 0xef, 0xb8, 0x80}}, "vsupnE": {Name: "vsupnE", CodePoints: []int{10956, 65024}, Characters: []byte{0xe2, 0xab, 0x8c, 0xef, 0xb8, 0x80}}, "vsupne": {Name: "vsupne", CodePoints: []int{8843, 65024}, Characters: []byte{0xe2, 0x8a, 0x8b, 0xef, 0xb8, 0x80}}, "vzigzag": {Name: "vzigzag", CodePoints: []int{10650}, Characters: []byte{0xe2, 0xa6, 0x9a}}, "wcirc": {Name: "wcirc", CodePoints: []int{373}, Characters: []byte{0xc5, 0xb5}}, "wedbar": {Name: "wedbar", CodePoints: []int{10847}, Characters: []byte{0xe2, 0xa9, 0x9f}}, "wedge": {Name: "wedge", CodePoints: []int{8743}, Characters: []byte{0xe2, 0x88, 0xa7}}, "wedgeq": {Name: "wedgeq", CodePoints: []int{8793}, Characters: []byte{0xe2, 0x89, 0x99}}, "weierp": {Name: "weierp", CodePoints: []int{8472}, Characters: []byte{0xe2, 0x84, 0x98}}, "wfr": {Name: "wfr", CodePoints: []int{120116}, Characters: []byte{0xf0, 0x9d, 0x94, 0xb4}}, "wopf": {Name: "wopf", CodePoints: []int{120168}, Characters: []byte{0xf0, 0x9d, 0x95, 0xa8}}, "wp": {Name: "wp", CodePoints: []int{8472}, Characters: []byte{0xe2, 0x84, 0x98}}, "wr": {Name: "wr", CodePoints: []int{8768}, Characters: []byte{0xe2, 0x89, 0x80}}, "wreath": {Name: "wreath", CodePoints: []int{8768}, Characters: []byte{0xe2, 0x89, 0x80}}, "wscr": {Name: "wscr", CodePoints: []int{120012}, Characters: []byte{0xf0, 0x9d, 0x93, 0x8c}}, "xcap": {Name: "xcap", CodePoints: []int{8898}, Characters: []byte{0xe2, 0x8b, 0x82}}, "xcirc": {Name: "xcirc", CodePoints: []int{9711}, Characters: []byte{0xe2, 0x97, 0xaf}}, "xcup": {Name: "xcup", CodePoints: []int{8899}, Characters: []byte{0xe2, 0x8b, 0x83}}, "xdtri": {Name: "xdtri", CodePoints: []int{9661}, Characters: []byte{0xe2, 0x96, 0xbd}}, "xfr": {Name: "xfr", CodePoints: []int{120117}, Characters: []byte{0xf0, 0x9d, 0x94, 0xb5}}, "xhArr": {Name: "xhArr", CodePoints: []int{10234}, Characters: []byte{0xe2, 0x9f, 0xba}}, "xharr": {Name: "xharr", CodePoints: []int{10231}, Characters: []byte{0xe2, 0x9f, 0xb7}}, "xi": {Name: "xi", CodePoints: []int{958}, Characters: []byte{0xce, 0xbe}}, "xlArr": {Name: "xlArr", CodePoints: []int{10232}, Characters: []byte{0xe2, 0x9f, 0xb8}}, "xlarr": {Name: "xlarr", CodePoints: []int{10229}, Characters: []byte{0xe2, 0x9f, 0xb5}}, "xmap": {Name: "xmap", CodePoints: []int{10236}, Characters: []byte{0xe2, 0x9f, 0xbc}}, "xnis": {Name: "xnis", CodePoints: []int{8955}, Characters: []byte{0xe2, 0x8b, 0xbb}}, "xodot": {Name: "xodot", CodePoints: []int{10752}, Characters: []byte{0xe2, 0xa8, 0x80}}, "xopf": {Name: "xopf", CodePoints: []int{120169}, Characters: []byte{0xf0, 0x9d, 0x95, 0xa9}}, "xoplus": {Name: "xoplus", CodePoints: []int{10753}, Characters: []byte{0xe2, 0xa8, 0x81}}, "xotime": {Name: "xotime", CodePoints: []int{10754}, Characters: []byte{0xe2, 0xa8, 0x82}}, "xrArr": {Name: "xrArr", CodePoints: []int{10233}, Characters: []byte{0xe2, 0x9f, 0xb9}}, "xrarr": {Name: "xrarr", CodePoints: []int{10230}, Characters: []byte{0xe2, 0x9f, 0xb6}}, "xscr": {Name: "xscr", CodePoints: []int{120013}, Characters: []byte{0xf0, 0x9d, 0x93, 0x8d}}, "xsqcup": {Name: "xsqcup", CodePoints: []int{10758}, Characters: []byte{0xe2, 0xa8, 0x86}}, "xuplus": {Name: "xuplus", CodePoints: []int{10756}, Characters: []byte{0xe2, 0xa8, 0x84}}, "xutri": {Name: "xutri", CodePoints: []int{9651}, Characters: []byte{0xe2, 0x96, 0xb3}}, "xvee": {Name: "xvee", CodePoints: []int{8897}, Characters: []byte{0xe2, 0x8b, 0x81}}, "xwedge": {Name: "xwedge", CodePoints: []int{8896}, Characters: []byte{0xe2, 0x8b, 0x80}}, "yacute": {Name: "yacute", CodePoints: []int{253}, Characters: []byte{0xc3, 0xbd}}, "yacy": {Name: "yacy", CodePoints: []int{1103}, Characters: []byte{0xd1, 0x8f}}, "ycirc": {Name: "ycirc", CodePoints: []int{375}, Characters: []byte{0xc5, 0xb7}}, "ycy": {Name: "ycy", CodePoints: []int{1099}, Characters: []byte{0xd1, 0x8b}}, "yen": {Name: "yen", CodePoints: []int{165}, Characters: []byte{0xc2, 0xa5}}, "yfr": {Name: "yfr", CodePoints: []int{120118}, Characters: []byte{0xf0, 0x9d, 0x94, 0xb6}}, "yicy": {Name: "yicy", CodePoints: []int{1111}, Characters: []byte{0xd1, 0x97}}, "yopf": {Name: "yopf", CodePoints: []int{120170}, Characters: []byte{0xf0, 0x9d, 0x95, 0xaa}}, "yscr": {Name: "yscr", CodePoints: []int{120014}, Characters: []byte{0xf0, 0x9d, 0x93, 0x8e}}, "yucy": {Name: "yucy", CodePoints: []int{1102}, Characters: []byte{0xd1, 0x8e}}, "yuml": {Name: "yuml", CodePoints: []int{255}, Characters: []byte{0xc3, 0xbf}}, "zacute": {Name: "zacute", CodePoints: []int{378}, Characters: []byte{0xc5, 0xba}}, "zcaron": {Name: "zcaron", CodePoints: []int{382}, Characters: []byte{0xc5, 0xbe}}, "zcy": {Name: "zcy", CodePoints: []int{1079}, Characters: []byte{0xd0, 0xb7}}, "zdot": {Name: "zdot", CodePoints: []int{380}, Characters: []byte{0xc5, 0xbc}}, "zeetrf": {Name: "zeetrf", CodePoints: []int{8488}, Characters: []byte{0xe2, 0x84, 0xa8}}, "zeta": {Name: "zeta", CodePoints: []int{950}, Characters: []byte{0xce, 0xb6}}, "zfr": {Name: "zfr", CodePoints: []int{120119}, Characters: []byte{0xf0, 0x9d, 0x94, 0xb7}}, "zhcy": {Name: "zhcy", CodePoints: []int{1078}, Characters: []byte{0xd0, 0xb6}}, "zigrarr": {Name: "zigrarr", CodePoints: []int{8669}, Characters: []byte{0xe2, 0x87, 0x9d}}, "zopf": {Name: "zopf", CodePoints: []int{120171}, Characters: []byte{0xf0, 0x9d, 0x95, 0xab}}, "zscr": {Name: "zscr", CodePoints: []int{120015}, Characters: []byte{0xf0, 0x9d, 0x93, 0x8f}}, "zwj": {Name: "zwj", CodePoints: []int{8205}, Characters: []byte{0xe2, 0x80, 0x8d}}, "zwnj": {Name: "zwnj", CodePoints: []int{8204}, Characters: []byte{0xe2, 0x80, 0x8c}}, } goldmark-1.7.4/util/unicode_case_folding.go000066400000000000000000001143611463655211100207640ustar00rootroot00000000000000//nolint:all package util var unicodeCaseFoldings = map[rune][]rune{ 0x41: []int32{97}, 0x42: []int32{98}, 0x43: []int32{99}, 0x44: []int32{100}, 0x45: []int32{101}, 0x46: []int32{102}, 0x47: []int32{103}, 0x48: []int32{104}, 0x49: []int32{105}, 0x4a: []int32{106}, 0x4b: []int32{107}, 0x4c: []int32{108}, 0x4d: []int32{109}, 0x4e: []int32{110}, 0x4f: []int32{111}, 0x50: []int32{112}, 0x51: []int32{113}, 0x52: []int32{114}, 0x53: []int32{115}, 0x54: []int32{116}, 0x55: []int32{117}, 0x56: []int32{118}, 0x57: []int32{119}, 0x58: []int32{120}, 0x59: []int32{121}, 0x5a: []int32{122}, 0xb5: []int32{956}, 0xc0: []int32{224}, 0xc1: []int32{225}, 0xc2: []int32{226}, 0xc3: []int32{227}, 0xc4: []int32{228}, 0xc5: []int32{229}, 0xc6: []int32{230}, 0xc7: []int32{231}, 0xc8: []int32{232}, 0xc9: []int32{233}, 0xca: []int32{234}, 0xcb: []int32{235}, 0xcc: []int32{236}, 0xcd: []int32{237}, 0xce: []int32{238}, 0xcf: []int32{239}, 0xd0: []int32{240}, 0xd1: []int32{241}, 0xd2: []int32{242}, 0xd3: []int32{243}, 0xd4: []int32{244}, 0xd5: []int32{245}, 0xd6: []int32{246}, 0xd8: []int32{248}, 0xd9: []int32{249}, 0xda: []int32{250}, 0xdb: []int32{251}, 0xdc: []int32{252}, 0xdd: []int32{253}, 0xde: []int32{254}, 0xdf: []int32{115, 115}, 0x100: []int32{257}, 0x102: []int32{259}, 0x104: []int32{261}, 0x106: []int32{263}, 0x108: []int32{265}, 0x10a: []int32{267}, 0x10c: []int32{269}, 0x10e: []int32{271}, 0x110: []int32{273}, 0x112: []int32{275}, 0x114: []int32{277}, 0x116: []int32{279}, 0x118: []int32{281}, 0x11a: []int32{283}, 0x11c: []int32{285}, 0x11e: []int32{287}, 0x120: []int32{289}, 0x122: []int32{291}, 0x124: []int32{293}, 0x126: []int32{295}, 0x128: []int32{297}, 0x12a: []int32{299}, 0x12c: []int32{301}, 0x12e: []int32{303}, 0x130: []int32{105, 775}, 0x132: []int32{307}, 0x134: []int32{309}, 0x136: []int32{311}, 0x139: []int32{314}, 0x13b: []int32{316}, 0x13d: []int32{318}, 0x13f: []int32{320}, 0x141: []int32{322}, 0x143: []int32{324}, 0x145: []int32{326}, 0x147: []int32{328}, 0x149: []int32{700, 110}, 0x14a: []int32{331}, 0x14c: []int32{333}, 0x14e: []int32{335}, 0x150: []int32{337}, 0x152: []int32{339}, 0x154: []int32{341}, 0x156: []int32{343}, 0x158: []int32{345}, 0x15a: []int32{347}, 0x15c: []int32{349}, 0x15e: []int32{351}, 0x160: []int32{353}, 0x162: []int32{355}, 0x164: []int32{357}, 0x166: []int32{359}, 0x168: []int32{361}, 0x16a: []int32{363}, 0x16c: []int32{365}, 0x16e: []int32{367}, 0x170: []int32{369}, 0x172: []int32{371}, 0x174: []int32{373}, 0x176: []int32{375}, 0x178: []int32{255}, 0x179: []int32{378}, 0x17b: []int32{380}, 0x17d: []int32{382}, 0x17f: []int32{115}, 0x181: []int32{595}, 0x182: []int32{387}, 0x184: []int32{389}, 0x186: []int32{596}, 0x187: []int32{392}, 0x189: []int32{598}, 0x18a: []int32{599}, 0x18b: []int32{396}, 0x18e: []int32{477}, 0x18f: []int32{601}, 0x190: []int32{603}, 0x191: []int32{402}, 0x193: []int32{608}, 0x194: []int32{611}, 0x196: []int32{617}, 0x197: []int32{616}, 0x198: []int32{409}, 0x19c: []int32{623}, 0x19d: []int32{626}, 0x19f: []int32{629}, 0x1a0: []int32{417}, 0x1a2: []int32{419}, 0x1a4: []int32{421}, 0x1a6: []int32{640}, 0x1a7: []int32{424}, 0x1a9: []int32{643}, 0x1ac: []int32{429}, 0x1ae: []int32{648}, 0x1af: []int32{432}, 0x1b1: []int32{650}, 0x1b2: []int32{651}, 0x1b3: []int32{436}, 0x1b5: []int32{438}, 0x1b7: []int32{658}, 0x1b8: []int32{441}, 0x1bc: []int32{445}, 0x1c4: []int32{454}, 0x1c5: []int32{454}, 0x1c7: []int32{457}, 0x1c8: []int32{457}, 0x1ca: []int32{460}, 0x1cb: []int32{460}, 0x1cd: []int32{462}, 0x1cf: []int32{464}, 0x1d1: []int32{466}, 0x1d3: []int32{468}, 0x1d5: []int32{470}, 0x1d7: []int32{472}, 0x1d9: []int32{474}, 0x1db: []int32{476}, 0x1de: []int32{479}, 0x1e0: []int32{481}, 0x1e2: []int32{483}, 0x1e4: []int32{485}, 0x1e6: []int32{487}, 0x1e8: []int32{489}, 0x1ea: []int32{491}, 0x1ec: []int32{493}, 0x1ee: []int32{495}, 0x1f0: []int32{106, 780}, 0x1f1: []int32{499}, 0x1f2: []int32{499}, 0x1f4: []int32{501}, 0x1f6: []int32{405}, 0x1f7: []int32{447}, 0x1f8: []int32{505}, 0x1fa: []int32{507}, 0x1fc: []int32{509}, 0x1fe: []int32{511}, 0x200: []int32{513}, 0x202: []int32{515}, 0x204: []int32{517}, 0x206: []int32{519}, 0x208: []int32{521}, 0x20a: []int32{523}, 0x20c: []int32{525}, 0x20e: []int32{527}, 0x210: []int32{529}, 0x212: []int32{531}, 0x214: []int32{533}, 0x216: []int32{535}, 0x218: []int32{537}, 0x21a: []int32{539}, 0x21c: []int32{541}, 0x21e: []int32{543}, 0x220: []int32{414}, 0x222: []int32{547}, 0x224: []int32{549}, 0x226: []int32{551}, 0x228: []int32{553}, 0x22a: []int32{555}, 0x22c: []int32{557}, 0x22e: []int32{559}, 0x230: []int32{561}, 0x232: []int32{563}, 0x23a: []int32{11365}, 0x23b: []int32{572}, 0x23d: []int32{410}, 0x23e: []int32{11366}, 0x241: []int32{578}, 0x243: []int32{384}, 0x244: []int32{649}, 0x245: []int32{652}, 0x246: []int32{583}, 0x248: []int32{585}, 0x24a: []int32{587}, 0x24c: []int32{589}, 0x24e: []int32{591}, 0x345: []int32{953}, 0x370: []int32{881}, 0x372: []int32{883}, 0x376: []int32{887}, 0x37f: []int32{1011}, 0x386: []int32{940}, 0x388: []int32{941}, 0x389: []int32{942}, 0x38a: []int32{943}, 0x38c: []int32{972}, 0x38e: []int32{973}, 0x38f: []int32{974}, 0x390: []int32{953, 776, 769}, 0x391: []int32{945}, 0x392: []int32{946}, 0x393: []int32{947}, 0x394: []int32{948}, 0x395: []int32{949}, 0x396: []int32{950}, 0x397: []int32{951}, 0x398: []int32{952}, 0x399: []int32{953}, 0x39a: []int32{954}, 0x39b: []int32{955}, 0x39c: []int32{956}, 0x39d: []int32{957}, 0x39e: []int32{958}, 0x39f: []int32{959}, 0x3a0: []int32{960}, 0x3a1: []int32{961}, 0x3a3: []int32{963}, 0x3a4: []int32{964}, 0x3a5: []int32{965}, 0x3a6: []int32{966}, 0x3a7: []int32{967}, 0x3a8: []int32{968}, 0x3a9: []int32{969}, 0x3aa: []int32{970}, 0x3ab: []int32{971}, 0x3b0: []int32{965, 776, 769}, 0x3c2: []int32{963}, 0x3cf: []int32{983}, 0x3d0: []int32{946}, 0x3d1: []int32{952}, 0x3d5: []int32{966}, 0x3d6: []int32{960}, 0x3d8: []int32{985}, 0x3da: []int32{987}, 0x3dc: []int32{989}, 0x3de: []int32{991}, 0x3e0: []int32{993}, 0x3e2: []int32{995}, 0x3e4: []int32{997}, 0x3e6: []int32{999}, 0x3e8: []int32{1001}, 0x3ea: []int32{1003}, 0x3ec: []int32{1005}, 0x3ee: []int32{1007}, 0x3f0: []int32{954}, 0x3f1: []int32{961}, 0x3f4: []int32{952}, 0x3f5: []int32{949}, 0x3f7: []int32{1016}, 0x3f9: []int32{1010}, 0x3fa: []int32{1019}, 0x3fd: []int32{891}, 0x3fe: []int32{892}, 0x3ff: []int32{893}, 0x400: []int32{1104}, 0x401: []int32{1105}, 0x402: []int32{1106}, 0x403: []int32{1107}, 0x404: []int32{1108}, 0x405: []int32{1109}, 0x406: []int32{1110}, 0x407: []int32{1111}, 0x408: []int32{1112}, 0x409: []int32{1113}, 0x40a: []int32{1114}, 0x40b: []int32{1115}, 0x40c: []int32{1116}, 0x40d: []int32{1117}, 0x40e: []int32{1118}, 0x40f: []int32{1119}, 0x410: []int32{1072}, 0x411: []int32{1073}, 0x412: []int32{1074}, 0x413: []int32{1075}, 0x414: []int32{1076}, 0x415: []int32{1077}, 0x416: []int32{1078}, 0x417: []int32{1079}, 0x418: []int32{1080}, 0x419: []int32{1081}, 0x41a: []int32{1082}, 0x41b: []int32{1083}, 0x41c: []int32{1084}, 0x41d: []int32{1085}, 0x41e: []int32{1086}, 0x41f: []int32{1087}, 0x420: []int32{1088}, 0x421: []int32{1089}, 0x422: []int32{1090}, 0x423: []int32{1091}, 0x424: []int32{1092}, 0x425: []int32{1093}, 0x426: []int32{1094}, 0x427: []int32{1095}, 0x428: []int32{1096}, 0x429: []int32{1097}, 0x42a: []int32{1098}, 0x42b: []int32{1099}, 0x42c: []int32{1100}, 0x42d: []int32{1101}, 0x42e: []int32{1102}, 0x42f: []int32{1103}, 0x460: []int32{1121}, 0x462: []int32{1123}, 0x464: []int32{1125}, 0x466: []int32{1127}, 0x468: []int32{1129}, 0x46a: []int32{1131}, 0x46c: []int32{1133}, 0x46e: []int32{1135}, 0x470: []int32{1137}, 0x472: []int32{1139}, 0x474: []int32{1141}, 0x476: []int32{1143}, 0x478: []int32{1145}, 0x47a: []int32{1147}, 0x47c: []int32{1149}, 0x47e: []int32{1151}, 0x480: []int32{1153}, 0x48a: []int32{1163}, 0x48c: []int32{1165}, 0x48e: []int32{1167}, 0x490: []int32{1169}, 0x492: []int32{1171}, 0x494: []int32{1173}, 0x496: []int32{1175}, 0x498: []int32{1177}, 0x49a: []int32{1179}, 0x49c: []int32{1181}, 0x49e: []int32{1183}, 0x4a0: []int32{1185}, 0x4a2: []int32{1187}, 0x4a4: []int32{1189}, 0x4a6: []int32{1191}, 0x4a8: []int32{1193}, 0x4aa: []int32{1195}, 0x4ac: []int32{1197}, 0x4ae: []int32{1199}, 0x4b0: []int32{1201}, 0x4b2: []int32{1203}, 0x4b4: []int32{1205}, 0x4b6: []int32{1207}, 0x4b8: []int32{1209}, 0x4ba: []int32{1211}, 0x4bc: []int32{1213}, 0x4be: []int32{1215}, 0x4c0: []int32{1231}, 0x4c1: []int32{1218}, 0x4c3: []int32{1220}, 0x4c5: []int32{1222}, 0x4c7: []int32{1224}, 0x4c9: []int32{1226}, 0x4cb: []int32{1228}, 0x4cd: []int32{1230}, 0x4d0: []int32{1233}, 0x4d2: []int32{1235}, 0x4d4: []int32{1237}, 0x4d6: []int32{1239}, 0x4d8: []int32{1241}, 0x4da: []int32{1243}, 0x4dc: []int32{1245}, 0x4de: []int32{1247}, 0x4e0: []int32{1249}, 0x4e2: []int32{1251}, 0x4e4: []int32{1253}, 0x4e6: []int32{1255}, 0x4e8: []int32{1257}, 0x4ea: []int32{1259}, 0x4ec: []int32{1261}, 0x4ee: []int32{1263}, 0x4f0: []int32{1265}, 0x4f2: []int32{1267}, 0x4f4: []int32{1269}, 0x4f6: []int32{1271}, 0x4f8: []int32{1273}, 0x4fa: []int32{1275}, 0x4fc: []int32{1277}, 0x4fe: []int32{1279}, 0x500: []int32{1281}, 0x502: []int32{1283}, 0x504: []int32{1285}, 0x506: []int32{1287}, 0x508: []int32{1289}, 0x50a: []int32{1291}, 0x50c: []int32{1293}, 0x50e: []int32{1295}, 0x510: []int32{1297}, 0x512: []int32{1299}, 0x514: []int32{1301}, 0x516: []int32{1303}, 0x518: []int32{1305}, 0x51a: []int32{1307}, 0x51c: []int32{1309}, 0x51e: []int32{1311}, 0x520: []int32{1313}, 0x522: []int32{1315}, 0x524: []int32{1317}, 0x526: []int32{1319}, 0x528: []int32{1321}, 0x52a: []int32{1323}, 0x52c: []int32{1325}, 0x52e: []int32{1327}, 0x531: []int32{1377}, 0x532: []int32{1378}, 0x533: []int32{1379}, 0x534: []int32{1380}, 0x535: []int32{1381}, 0x536: []int32{1382}, 0x537: []int32{1383}, 0x538: []int32{1384}, 0x539: []int32{1385}, 0x53a: []int32{1386}, 0x53b: []int32{1387}, 0x53c: []int32{1388}, 0x53d: []int32{1389}, 0x53e: []int32{1390}, 0x53f: []int32{1391}, 0x540: []int32{1392}, 0x541: []int32{1393}, 0x542: []int32{1394}, 0x543: []int32{1395}, 0x544: []int32{1396}, 0x545: []int32{1397}, 0x546: []int32{1398}, 0x547: []int32{1399}, 0x548: []int32{1400}, 0x549: []int32{1401}, 0x54a: []int32{1402}, 0x54b: []int32{1403}, 0x54c: []int32{1404}, 0x54d: []int32{1405}, 0x54e: []int32{1406}, 0x54f: []int32{1407}, 0x550: []int32{1408}, 0x551: []int32{1409}, 0x552: []int32{1410}, 0x553: []int32{1411}, 0x554: []int32{1412}, 0x555: []int32{1413}, 0x556: []int32{1414}, 0x587: []int32{1381, 1410}, 0x10a0: []int32{11520}, 0x10a1: []int32{11521}, 0x10a2: []int32{11522}, 0x10a3: []int32{11523}, 0x10a4: []int32{11524}, 0x10a5: []int32{11525}, 0x10a6: []int32{11526}, 0x10a7: []int32{11527}, 0x10a8: []int32{11528}, 0x10a9: []int32{11529}, 0x10aa: []int32{11530}, 0x10ab: []int32{11531}, 0x10ac: []int32{11532}, 0x10ad: []int32{11533}, 0x10ae: []int32{11534}, 0x10af: []int32{11535}, 0x10b0: []int32{11536}, 0x10b1: []int32{11537}, 0x10b2: []int32{11538}, 0x10b3: []int32{11539}, 0x10b4: []int32{11540}, 0x10b5: []int32{11541}, 0x10b6: []int32{11542}, 0x10b7: []int32{11543}, 0x10b8: []int32{11544}, 0x10b9: []int32{11545}, 0x10ba: []int32{11546}, 0x10bb: []int32{11547}, 0x10bc: []int32{11548}, 0x10bd: []int32{11549}, 0x10be: []int32{11550}, 0x10bf: []int32{11551}, 0x10c0: []int32{11552}, 0x10c1: []int32{11553}, 0x10c2: []int32{11554}, 0x10c3: []int32{11555}, 0x10c4: []int32{11556}, 0x10c5: []int32{11557}, 0x10c7: []int32{11559}, 0x10cd: []int32{11565}, 0x13f8: []int32{5104}, 0x13f9: []int32{5105}, 0x13fa: []int32{5106}, 0x13fb: []int32{5107}, 0x13fc: []int32{5108}, 0x13fd: []int32{5109}, 0x1c80: []int32{1074}, 0x1c81: []int32{1076}, 0x1c82: []int32{1086}, 0x1c83: []int32{1089}, 0x1c84: []int32{1090}, 0x1c85: []int32{1090}, 0x1c86: []int32{1098}, 0x1c87: []int32{1123}, 0x1c88: []int32{42571}, 0x1c90: []int32{4304}, 0x1c91: []int32{4305}, 0x1c92: []int32{4306}, 0x1c93: []int32{4307}, 0x1c94: []int32{4308}, 0x1c95: []int32{4309}, 0x1c96: []int32{4310}, 0x1c97: []int32{4311}, 0x1c98: []int32{4312}, 0x1c99: []int32{4313}, 0x1c9a: []int32{4314}, 0x1c9b: []int32{4315}, 0x1c9c: []int32{4316}, 0x1c9d: []int32{4317}, 0x1c9e: []int32{4318}, 0x1c9f: []int32{4319}, 0x1ca0: []int32{4320}, 0x1ca1: []int32{4321}, 0x1ca2: []int32{4322}, 0x1ca3: []int32{4323}, 0x1ca4: []int32{4324}, 0x1ca5: []int32{4325}, 0x1ca6: []int32{4326}, 0x1ca7: []int32{4327}, 0x1ca8: []int32{4328}, 0x1ca9: []int32{4329}, 0x1caa: []int32{4330}, 0x1cab: []int32{4331}, 0x1cac: []int32{4332}, 0x1cad: []int32{4333}, 0x1cae: []int32{4334}, 0x1caf: []int32{4335}, 0x1cb0: []int32{4336}, 0x1cb1: []int32{4337}, 0x1cb2: []int32{4338}, 0x1cb3: []int32{4339}, 0x1cb4: []int32{4340}, 0x1cb5: []int32{4341}, 0x1cb6: []int32{4342}, 0x1cb7: []int32{4343}, 0x1cb8: []int32{4344}, 0x1cb9: []int32{4345}, 0x1cba: []int32{4346}, 0x1cbd: []int32{4349}, 0x1cbe: []int32{4350}, 0x1cbf: []int32{4351}, 0x1e00: []int32{7681}, 0x1e02: []int32{7683}, 0x1e04: []int32{7685}, 0x1e06: []int32{7687}, 0x1e08: []int32{7689}, 0x1e0a: []int32{7691}, 0x1e0c: []int32{7693}, 0x1e0e: []int32{7695}, 0x1e10: []int32{7697}, 0x1e12: []int32{7699}, 0x1e14: []int32{7701}, 0x1e16: []int32{7703}, 0x1e18: []int32{7705}, 0x1e1a: []int32{7707}, 0x1e1c: []int32{7709}, 0x1e1e: []int32{7711}, 0x1e20: []int32{7713}, 0x1e22: []int32{7715}, 0x1e24: []int32{7717}, 0x1e26: []int32{7719}, 0x1e28: []int32{7721}, 0x1e2a: []int32{7723}, 0x1e2c: []int32{7725}, 0x1e2e: []int32{7727}, 0x1e30: []int32{7729}, 0x1e32: []int32{7731}, 0x1e34: []int32{7733}, 0x1e36: []int32{7735}, 0x1e38: []int32{7737}, 0x1e3a: []int32{7739}, 0x1e3c: []int32{7741}, 0x1e3e: []int32{7743}, 0x1e40: []int32{7745}, 0x1e42: []int32{7747}, 0x1e44: []int32{7749}, 0x1e46: []int32{7751}, 0x1e48: []int32{7753}, 0x1e4a: []int32{7755}, 0x1e4c: []int32{7757}, 0x1e4e: []int32{7759}, 0x1e50: []int32{7761}, 0x1e52: []int32{7763}, 0x1e54: []int32{7765}, 0x1e56: []int32{7767}, 0x1e58: []int32{7769}, 0x1e5a: []int32{7771}, 0x1e5c: []int32{7773}, 0x1e5e: []int32{7775}, 0x1e60: []int32{7777}, 0x1e62: []int32{7779}, 0x1e64: []int32{7781}, 0x1e66: []int32{7783}, 0x1e68: []int32{7785}, 0x1e6a: []int32{7787}, 0x1e6c: []int32{7789}, 0x1e6e: []int32{7791}, 0x1e70: []int32{7793}, 0x1e72: []int32{7795}, 0x1e74: []int32{7797}, 0x1e76: []int32{7799}, 0x1e78: []int32{7801}, 0x1e7a: []int32{7803}, 0x1e7c: []int32{7805}, 0x1e7e: []int32{7807}, 0x1e80: []int32{7809}, 0x1e82: []int32{7811}, 0x1e84: []int32{7813}, 0x1e86: []int32{7815}, 0x1e88: []int32{7817}, 0x1e8a: []int32{7819}, 0x1e8c: []int32{7821}, 0x1e8e: []int32{7823}, 0x1e90: []int32{7825}, 0x1e92: []int32{7827}, 0x1e94: []int32{7829}, 0x1e96: []int32{104, 817}, 0x1e97: []int32{116, 776}, 0x1e98: []int32{119, 778}, 0x1e99: []int32{121, 778}, 0x1e9a: []int32{97, 702}, 0x1e9b: []int32{7777}, 0x1e9e: []int32{115, 115}, 0x1ea0: []int32{7841}, 0x1ea2: []int32{7843}, 0x1ea4: []int32{7845}, 0x1ea6: []int32{7847}, 0x1ea8: []int32{7849}, 0x1eaa: []int32{7851}, 0x1eac: []int32{7853}, 0x1eae: []int32{7855}, 0x1eb0: []int32{7857}, 0x1eb2: []int32{7859}, 0x1eb4: []int32{7861}, 0x1eb6: []int32{7863}, 0x1eb8: []int32{7865}, 0x1eba: []int32{7867}, 0x1ebc: []int32{7869}, 0x1ebe: []int32{7871}, 0x1ec0: []int32{7873}, 0x1ec2: []int32{7875}, 0x1ec4: []int32{7877}, 0x1ec6: []int32{7879}, 0x1ec8: []int32{7881}, 0x1eca: []int32{7883}, 0x1ecc: []int32{7885}, 0x1ece: []int32{7887}, 0x1ed0: []int32{7889}, 0x1ed2: []int32{7891}, 0x1ed4: []int32{7893}, 0x1ed6: []int32{7895}, 0x1ed8: []int32{7897}, 0x1eda: []int32{7899}, 0x1edc: []int32{7901}, 0x1ede: []int32{7903}, 0x1ee0: []int32{7905}, 0x1ee2: []int32{7907}, 0x1ee4: []int32{7909}, 0x1ee6: []int32{7911}, 0x1ee8: []int32{7913}, 0x1eea: []int32{7915}, 0x1eec: []int32{7917}, 0x1eee: []int32{7919}, 0x1ef0: []int32{7921}, 0x1ef2: []int32{7923}, 0x1ef4: []int32{7925}, 0x1ef6: []int32{7927}, 0x1ef8: []int32{7929}, 0x1efa: []int32{7931}, 0x1efc: []int32{7933}, 0x1efe: []int32{7935}, 0x1f08: []int32{7936}, 0x1f09: []int32{7937}, 0x1f0a: []int32{7938}, 0x1f0b: []int32{7939}, 0x1f0c: []int32{7940}, 0x1f0d: []int32{7941}, 0x1f0e: []int32{7942}, 0x1f0f: []int32{7943}, 0x1f18: []int32{7952}, 0x1f19: []int32{7953}, 0x1f1a: []int32{7954}, 0x1f1b: []int32{7955}, 0x1f1c: []int32{7956}, 0x1f1d: []int32{7957}, 0x1f28: []int32{7968}, 0x1f29: []int32{7969}, 0x1f2a: []int32{7970}, 0x1f2b: []int32{7971}, 0x1f2c: []int32{7972}, 0x1f2d: []int32{7973}, 0x1f2e: []int32{7974}, 0x1f2f: []int32{7975}, 0x1f38: []int32{7984}, 0x1f39: []int32{7985}, 0x1f3a: []int32{7986}, 0x1f3b: []int32{7987}, 0x1f3c: []int32{7988}, 0x1f3d: []int32{7989}, 0x1f3e: []int32{7990}, 0x1f3f: []int32{7991}, 0x1f48: []int32{8000}, 0x1f49: []int32{8001}, 0x1f4a: []int32{8002}, 0x1f4b: []int32{8003}, 0x1f4c: []int32{8004}, 0x1f4d: []int32{8005}, 0x1f50: []int32{965, 787}, 0x1f52: []int32{965, 787, 768}, 0x1f54: []int32{965, 787, 769}, 0x1f56: []int32{965, 787, 834}, 0x1f59: []int32{8017}, 0x1f5b: []int32{8019}, 0x1f5d: []int32{8021}, 0x1f5f: []int32{8023}, 0x1f68: []int32{8032}, 0x1f69: []int32{8033}, 0x1f6a: []int32{8034}, 0x1f6b: []int32{8035}, 0x1f6c: []int32{8036}, 0x1f6d: []int32{8037}, 0x1f6e: []int32{8038}, 0x1f6f: []int32{8039}, 0x1f80: []int32{7936, 953}, 0x1f81: []int32{7937, 953}, 0x1f82: []int32{7938, 953}, 0x1f83: []int32{7939, 953}, 0x1f84: []int32{7940, 953}, 0x1f85: []int32{7941, 953}, 0x1f86: []int32{7942, 953}, 0x1f87: []int32{7943, 953}, 0x1f88: []int32{7936, 953}, 0x1f89: []int32{7937, 953}, 0x1f8a: []int32{7938, 953}, 0x1f8b: []int32{7939, 953}, 0x1f8c: []int32{7940, 953}, 0x1f8d: []int32{7941, 953}, 0x1f8e: []int32{7942, 953}, 0x1f8f: []int32{7943, 953}, 0x1f90: []int32{7968, 953}, 0x1f91: []int32{7969, 953}, 0x1f92: []int32{7970, 953}, 0x1f93: []int32{7971, 953}, 0x1f94: []int32{7972, 953}, 0x1f95: []int32{7973, 953}, 0x1f96: []int32{7974, 953}, 0x1f97: []int32{7975, 953}, 0x1f98: []int32{7968, 953}, 0x1f99: []int32{7969, 953}, 0x1f9a: []int32{7970, 953}, 0x1f9b: []int32{7971, 953}, 0x1f9c: []int32{7972, 953}, 0x1f9d: []int32{7973, 953}, 0x1f9e: []int32{7974, 953}, 0x1f9f: []int32{7975, 953}, 0x1fa0: []int32{8032, 953}, 0x1fa1: []int32{8033, 953}, 0x1fa2: []int32{8034, 953}, 0x1fa3: []int32{8035, 953}, 0x1fa4: []int32{8036, 953}, 0x1fa5: []int32{8037, 953}, 0x1fa6: []int32{8038, 953}, 0x1fa7: []int32{8039, 953}, 0x1fa8: []int32{8032, 953}, 0x1fa9: []int32{8033, 953}, 0x1faa: []int32{8034, 953}, 0x1fab: []int32{8035, 953}, 0x1fac: []int32{8036, 953}, 0x1fad: []int32{8037, 953}, 0x1fae: []int32{8038, 953}, 0x1faf: []int32{8039, 953}, 0x1fb2: []int32{8048, 953}, 0x1fb3: []int32{945, 953}, 0x1fb4: []int32{940, 953}, 0x1fb6: []int32{945, 834}, 0x1fb7: []int32{945, 834, 953}, 0x1fb8: []int32{8112}, 0x1fb9: []int32{8113}, 0x1fba: []int32{8048}, 0x1fbb: []int32{8049}, 0x1fbc: []int32{945, 953}, 0x1fbe: []int32{953}, 0x1fc2: []int32{8052, 953}, 0x1fc3: []int32{951, 953}, 0x1fc4: []int32{942, 953}, 0x1fc6: []int32{951, 834}, 0x1fc7: []int32{951, 834, 953}, 0x1fc8: []int32{8050}, 0x1fc9: []int32{8051}, 0x1fca: []int32{8052}, 0x1fcb: []int32{8053}, 0x1fcc: []int32{951, 953}, 0x1fd2: []int32{953, 776, 768}, 0x1fd3: []int32{953, 776, 769}, 0x1fd6: []int32{953, 834}, 0x1fd7: []int32{953, 776, 834}, 0x1fd8: []int32{8144}, 0x1fd9: []int32{8145}, 0x1fda: []int32{8054}, 0x1fdb: []int32{8055}, 0x1fe2: []int32{965, 776, 768}, 0x1fe3: []int32{965, 776, 769}, 0x1fe4: []int32{961, 787}, 0x1fe6: []int32{965, 834}, 0x1fe7: []int32{965, 776, 834}, 0x1fe8: []int32{8160}, 0x1fe9: []int32{8161}, 0x1fea: []int32{8058}, 0x1feb: []int32{8059}, 0x1fec: []int32{8165}, 0x1ff2: []int32{8060, 953}, 0x1ff3: []int32{969, 953}, 0x1ff4: []int32{974, 953}, 0x1ff6: []int32{969, 834}, 0x1ff7: []int32{969, 834, 953}, 0x1ff8: []int32{8056}, 0x1ff9: []int32{8057}, 0x1ffa: []int32{8060}, 0x1ffb: []int32{8061}, 0x1ffc: []int32{969, 953}, 0x2126: []int32{969}, 0x212a: []int32{107}, 0x212b: []int32{229}, 0x2132: []int32{8526}, 0x2160: []int32{8560}, 0x2161: []int32{8561}, 0x2162: []int32{8562}, 0x2163: []int32{8563}, 0x2164: []int32{8564}, 0x2165: []int32{8565}, 0x2166: []int32{8566}, 0x2167: []int32{8567}, 0x2168: []int32{8568}, 0x2169: []int32{8569}, 0x216a: []int32{8570}, 0x216b: []int32{8571}, 0x216c: []int32{8572}, 0x216d: []int32{8573}, 0x216e: []int32{8574}, 0x216f: []int32{8575}, 0x2183: []int32{8580}, 0x24b6: []int32{9424}, 0x24b7: []int32{9425}, 0x24b8: []int32{9426}, 0x24b9: []int32{9427}, 0x24ba: []int32{9428}, 0x24bb: []int32{9429}, 0x24bc: []int32{9430}, 0x24bd: []int32{9431}, 0x24be: []int32{9432}, 0x24bf: []int32{9433}, 0x24c0: []int32{9434}, 0x24c1: []int32{9435}, 0x24c2: []int32{9436}, 0x24c3: []int32{9437}, 0x24c4: []int32{9438}, 0x24c5: []int32{9439}, 0x24c6: []int32{9440}, 0x24c7: []int32{9441}, 0x24c8: []int32{9442}, 0x24c9: []int32{9443}, 0x24ca: []int32{9444}, 0x24cb: []int32{9445}, 0x24cc: []int32{9446}, 0x24cd: []int32{9447}, 0x24ce: []int32{9448}, 0x24cf: []int32{9449}, 0x2c00: []int32{11312}, 0x2c01: []int32{11313}, 0x2c02: []int32{11314}, 0x2c03: []int32{11315}, 0x2c04: []int32{11316}, 0x2c05: []int32{11317}, 0x2c06: []int32{11318}, 0x2c07: []int32{11319}, 0x2c08: []int32{11320}, 0x2c09: []int32{11321}, 0x2c0a: []int32{11322}, 0x2c0b: []int32{11323}, 0x2c0c: []int32{11324}, 0x2c0d: []int32{11325}, 0x2c0e: []int32{11326}, 0x2c0f: []int32{11327}, 0x2c10: []int32{11328}, 0x2c11: []int32{11329}, 0x2c12: []int32{11330}, 0x2c13: []int32{11331}, 0x2c14: []int32{11332}, 0x2c15: []int32{11333}, 0x2c16: []int32{11334}, 0x2c17: []int32{11335}, 0x2c18: []int32{11336}, 0x2c19: []int32{11337}, 0x2c1a: []int32{11338}, 0x2c1b: []int32{11339}, 0x2c1c: []int32{11340}, 0x2c1d: []int32{11341}, 0x2c1e: []int32{11342}, 0x2c1f: []int32{11343}, 0x2c20: []int32{11344}, 0x2c21: []int32{11345}, 0x2c22: []int32{11346}, 0x2c23: []int32{11347}, 0x2c24: []int32{11348}, 0x2c25: []int32{11349}, 0x2c26: []int32{11350}, 0x2c27: []int32{11351}, 0x2c28: []int32{11352}, 0x2c29: []int32{11353}, 0x2c2a: []int32{11354}, 0x2c2b: []int32{11355}, 0x2c2c: []int32{11356}, 0x2c2d: []int32{11357}, 0x2c2e: []int32{11358}, 0x2c2f: []int32{11359}, 0x2c60: []int32{11361}, 0x2c62: []int32{619}, 0x2c63: []int32{7549}, 0x2c64: []int32{637}, 0x2c67: []int32{11368}, 0x2c69: []int32{11370}, 0x2c6b: []int32{11372}, 0x2c6d: []int32{593}, 0x2c6e: []int32{625}, 0x2c6f: []int32{592}, 0x2c70: []int32{594}, 0x2c72: []int32{11379}, 0x2c75: []int32{11382}, 0x2c7e: []int32{575}, 0x2c7f: []int32{576}, 0x2c80: []int32{11393}, 0x2c82: []int32{11395}, 0x2c84: []int32{11397}, 0x2c86: []int32{11399}, 0x2c88: []int32{11401}, 0x2c8a: []int32{11403}, 0x2c8c: []int32{11405}, 0x2c8e: []int32{11407}, 0x2c90: []int32{11409}, 0x2c92: []int32{11411}, 0x2c94: []int32{11413}, 0x2c96: []int32{11415}, 0x2c98: []int32{11417}, 0x2c9a: []int32{11419}, 0x2c9c: []int32{11421}, 0x2c9e: []int32{11423}, 0x2ca0: []int32{11425}, 0x2ca2: []int32{11427}, 0x2ca4: []int32{11429}, 0x2ca6: []int32{11431}, 0x2ca8: []int32{11433}, 0x2caa: []int32{11435}, 0x2cac: []int32{11437}, 0x2cae: []int32{11439}, 0x2cb0: []int32{11441}, 0x2cb2: []int32{11443}, 0x2cb4: []int32{11445}, 0x2cb6: []int32{11447}, 0x2cb8: []int32{11449}, 0x2cba: []int32{11451}, 0x2cbc: []int32{11453}, 0x2cbe: []int32{11455}, 0x2cc0: []int32{11457}, 0x2cc2: []int32{11459}, 0x2cc4: []int32{11461}, 0x2cc6: []int32{11463}, 0x2cc8: []int32{11465}, 0x2cca: []int32{11467}, 0x2ccc: []int32{11469}, 0x2cce: []int32{11471}, 0x2cd0: []int32{11473}, 0x2cd2: []int32{11475}, 0x2cd4: []int32{11477}, 0x2cd6: []int32{11479}, 0x2cd8: []int32{11481}, 0x2cda: []int32{11483}, 0x2cdc: []int32{11485}, 0x2cde: []int32{11487}, 0x2ce0: []int32{11489}, 0x2ce2: []int32{11491}, 0x2ceb: []int32{11500}, 0x2ced: []int32{11502}, 0x2cf2: []int32{11507}, 0xa640: []int32{42561}, 0xa642: []int32{42563}, 0xa644: []int32{42565}, 0xa646: []int32{42567}, 0xa648: []int32{42569}, 0xa64a: []int32{42571}, 0xa64c: []int32{42573}, 0xa64e: []int32{42575}, 0xa650: []int32{42577}, 0xa652: []int32{42579}, 0xa654: []int32{42581}, 0xa656: []int32{42583}, 0xa658: []int32{42585}, 0xa65a: []int32{42587}, 0xa65c: []int32{42589}, 0xa65e: []int32{42591}, 0xa660: []int32{42593}, 0xa662: []int32{42595}, 0xa664: []int32{42597}, 0xa666: []int32{42599}, 0xa668: []int32{42601}, 0xa66a: []int32{42603}, 0xa66c: []int32{42605}, 0xa680: []int32{42625}, 0xa682: []int32{42627}, 0xa684: []int32{42629}, 0xa686: []int32{42631}, 0xa688: []int32{42633}, 0xa68a: []int32{42635}, 0xa68c: []int32{42637}, 0xa68e: []int32{42639}, 0xa690: []int32{42641}, 0xa692: []int32{42643}, 0xa694: []int32{42645}, 0xa696: []int32{42647}, 0xa698: []int32{42649}, 0xa69a: []int32{42651}, 0xa722: []int32{42787}, 0xa724: []int32{42789}, 0xa726: []int32{42791}, 0xa728: []int32{42793}, 0xa72a: []int32{42795}, 0xa72c: []int32{42797}, 0xa72e: []int32{42799}, 0xa732: []int32{42803}, 0xa734: []int32{42805}, 0xa736: []int32{42807}, 0xa738: []int32{42809}, 0xa73a: []int32{42811}, 0xa73c: []int32{42813}, 0xa73e: []int32{42815}, 0xa740: []int32{42817}, 0xa742: []int32{42819}, 0xa744: []int32{42821}, 0xa746: []int32{42823}, 0xa748: []int32{42825}, 0xa74a: []int32{42827}, 0xa74c: []int32{42829}, 0xa74e: []int32{42831}, 0xa750: []int32{42833}, 0xa752: []int32{42835}, 0xa754: []int32{42837}, 0xa756: []int32{42839}, 0xa758: []int32{42841}, 0xa75a: []int32{42843}, 0xa75c: []int32{42845}, 0xa75e: []int32{42847}, 0xa760: []int32{42849}, 0xa762: []int32{42851}, 0xa764: []int32{42853}, 0xa766: []int32{42855}, 0xa768: []int32{42857}, 0xa76a: []int32{42859}, 0xa76c: []int32{42861}, 0xa76e: []int32{42863}, 0xa779: []int32{42874}, 0xa77b: []int32{42876}, 0xa77d: []int32{7545}, 0xa77e: []int32{42879}, 0xa780: []int32{42881}, 0xa782: []int32{42883}, 0xa784: []int32{42885}, 0xa786: []int32{42887}, 0xa78b: []int32{42892}, 0xa78d: []int32{613}, 0xa790: []int32{42897}, 0xa792: []int32{42899}, 0xa796: []int32{42903}, 0xa798: []int32{42905}, 0xa79a: []int32{42907}, 0xa79c: []int32{42909}, 0xa79e: []int32{42911}, 0xa7a0: []int32{42913}, 0xa7a2: []int32{42915}, 0xa7a4: []int32{42917}, 0xa7a6: []int32{42919}, 0xa7a8: []int32{42921}, 0xa7aa: []int32{614}, 0xa7ab: []int32{604}, 0xa7ac: []int32{609}, 0xa7ad: []int32{620}, 0xa7ae: []int32{618}, 0xa7b0: []int32{670}, 0xa7b1: []int32{647}, 0xa7b2: []int32{669}, 0xa7b3: []int32{43859}, 0xa7b4: []int32{42933}, 0xa7b6: []int32{42935}, 0xa7b8: []int32{42937}, 0xa7ba: []int32{42939}, 0xa7bc: []int32{42941}, 0xa7be: []int32{42943}, 0xa7c0: []int32{42945}, 0xa7c2: []int32{42947}, 0xa7c4: []int32{42900}, 0xa7c5: []int32{642}, 0xa7c6: []int32{7566}, 0xa7c7: []int32{42952}, 0xa7c9: []int32{42954}, 0xa7d0: []int32{42961}, 0xa7d6: []int32{42967}, 0xa7d8: []int32{42969}, 0xa7f5: []int32{42998}, 0xab70: []int32{5024}, 0xab71: []int32{5025}, 0xab72: []int32{5026}, 0xab73: []int32{5027}, 0xab74: []int32{5028}, 0xab75: []int32{5029}, 0xab76: []int32{5030}, 0xab77: []int32{5031}, 0xab78: []int32{5032}, 0xab79: []int32{5033}, 0xab7a: []int32{5034}, 0xab7b: []int32{5035}, 0xab7c: []int32{5036}, 0xab7d: []int32{5037}, 0xab7e: []int32{5038}, 0xab7f: []int32{5039}, 0xab80: []int32{5040}, 0xab81: []int32{5041}, 0xab82: []int32{5042}, 0xab83: []int32{5043}, 0xab84: []int32{5044}, 0xab85: []int32{5045}, 0xab86: []int32{5046}, 0xab87: []int32{5047}, 0xab88: []int32{5048}, 0xab89: []int32{5049}, 0xab8a: []int32{5050}, 0xab8b: []int32{5051}, 0xab8c: []int32{5052}, 0xab8d: []int32{5053}, 0xab8e: []int32{5054}, 0xab8f: []int32{5055}, 0xab90: []int32{5056}, 0xab91: []int32{5057}, 0xab92: []int32{5058}, 0xab93: []int32{5059}, 0xab94: []int32{5060}, 0xab95: []int32{5061}, 0xab96: []int32{5062}, 0xab97: []int32{5063}, 0xab98: []int32{5064}, 0xab99: []int32{5065}, 0xab9a: []int32{5066}, 0xab9b: []int32{5067}, 0xab9c: []int32{5068}, 0xab9d: []int32{5069}, 0xab9e: []int32{5070}, 0xab9f: []int32{5071}, 0xaba0: []int32{5072}, 0xaba1: []int32{5073}, 0xaba2: []int32{5074}, 0xaba3: []int32{5075}, 0xaba4: []int32{5076}, 0xaba5: []int32{5077}, 0xaba6: []int32{5078}, 0xaba7: []int32{5079}, 0xaba8: []int32{5080}, 0xaba9: []int32{5081}, 0xabaa: []int32{5082}, 0xabab: []int32{5083}, 0xabac: []int32{5084}, 0xabad: []int32{5085}, 0xabae: []int32{5086}, 0xabaf: []int32{5087}, 0xabb0: []int32{5088}, 0xabb1: []int32{5089}, 0xabb2: []int32{5090}, 0xabb3: []int32{5091}, 0xabb4: []int32{5092}, 0xabb5: []int32{5093}, 0xabb6: []int32{5094}, 0xabb7: []int32{5095}, 0xabb8: []int32{5096}, 0xabb9: []int32{5097}, 0xabba: []int32{5098}, 0xabbb: []int32{5099}, 0xabbc: []int32{5100}, 0xabbd: []int32{5101}, 0xabbe: []int32{5102}, 0xabbf: []int32{5103}, 0xfb00: []int32{102, 102}, 0xfb01: []int32{102, 105}, 0xfb02: []int32{102, 108}, 0xfb03: []int32{102, 102, 105}, 0xfb04: []int32{102, 102, 108}, 0xfb05: []int32{115, 116}, 0xfb06: []int32{115, 116}, 0xfb13: []int32{1396, 1398}, 0xfb14: []int32{1396, 1381}, 0xfb15: []int32{1396, 1387}, 0xfb16: []int32{1406, 1398}, 0xfb17: []int32{1396, 1389}, 0xff21: []int32{65345}, 0xff22: []int32{65346}, 0xff23: []int32{65347}, 0xff24: []int32{65348}, 0xff25: []int32{65349}, 0xff26: []int32{65350}, 0xff27: []int32{65351}, 0xff28: []int32{65352}, 0xff29: []int32{65353}, 0xff2a: []int32{65354}, 0xff2b: []int32{65355}, 0xff2c: []int32{65356}, 0xff2d: []int32{65357}, 0xff2e: []int32{65358}, 0xff2f: []int32{65359}, 0xff30: []int32{65360}, 0xff31: []int32{65361}, 0xff32: []int32{65362}, 0xff33: []int32{65363}, 0xff34: []int32{65364}, 0xff35: []int32{65365}, 0xff36: []int32{65366}, 0xff37: []int32{65367}, 0xff38: []int32{65368}, 0xff39: []int32{65369}, 0xff3a: []int32{65370}, 0x10400: []int32{66600}, 0x10401: []int32{66601}, 0x10402: []int32{66602}, 0x10403: []int32{66603}, 0x10404: []int32{66604}, 0x10405: []int32{66605}, 0x10406: []int32{66606}, 0x10407: []int32{66607}, 0x10408: []int32{66608}, 0x10409: []int32{66609}, 0x1040a: []int32{66610}, 0x1040b: []int32{66611}, 0x1040c: []int32{66612}, 0x1040d: []int32{66613}, 0x1040e: []int32{66614}, 0x1040f: []int32{66615}, 0x10410: []int32{66616}, 0x10411: []int32{66617}, 0x10412: []int32{66618}, 0x10413: []int32{66619}, 0x10414: []int32{66620}, 0x10415: []int32{66621}, 0x10416: []int32{66622}, 0x10417: []int32{66623}, 0x10418: []int32{66624}, 0x10419: []int32{66625}, 0x1041a: []int32{66626}, 0x1041b: []int32{66627}, 0x1041c: []int32{66628}, 0x1041d: []int32{66629}, 0x1041e: []int32{66630}, 0x1041f: []int32{66631}, 0x10420: []int32{66632}, 0x10421: []int32{66633}, 0x10422: []int32{66634}, 0x10423: []int32{66635}, 0x10424: []int32{66636}, 0x10425: []int32{66637}, 0x10426: []int32{66638}, 0x10427: []int32{66639}, 0x104b0: []int32{66776}, 0x104b1: []int32{66777}, 0x104b2: []int32{66778}, 0x104b3: []int32{66779}, 0x104b4: []int32{66780}, 0x104b5: []int32{66781}, 0x104b6: []int32{66782}, 0x104b7: []int32{66783}, 0x104b8: []int32{66784}, 0x104b9: []int32{66785}, 0x104ba: []int32{66786}, 0x104bb: []int32{66787}, 0x104bc: []int32{66788}, 0x104bd: []int32{66789}, 0x104be: []int32{66790}, 0x104bf: []int32{66791}, 0x104c0: []int32{66792}, 0x104c1: []int32{66793}, 0x104c2: []int32{66794}, 0x104c3: []int32{66795}, 0x104c4: []int32{66796}, 0x104c5: []int32{66797}, 0x104c6: []int32{66798}, 0x104c7: []int32{66799}, 0x104c8: []int32{66800}, 0x104c9: []int32{66801}, 0x104ca: []int32{66802}, 0x104cb: []int32{66803}, 0x104cc: []int32{66804}, 0x104cd: []int32{66805}, 0x104ce: []int32{66806}, 0x104cf: []int32{66807}, 0x104d0: []int32{66808}, 0x104d1: []int32{66809}, 0x104d2: []int32{66810}, 0x104d3: []int32{66811}, 0x10570: []int32{66967}, 0x10571: []int32{66968}, 0x10572: []int32{66969}, 0x10573: []int32{66970}, 0x10574: []int32{66971}, 0x10575: []int32{66972}, 0x10576: []int32{66973}, 0x10577: []int32{66974}, 0x10578: []int32{66975}, 0x10579: []int32{66976}, 0x1057a: []int32{66977}, 0x1057c: []int32{66979}, 0x1057d: []int32{66980}, 0x1057e: []int32{66981}, 0x1057f: []int32{66982}, 0x10580: []int32{66983}, 0x10581: []int32{66984}, 0x10582: []int32{66985}, 0x10583: []int32{66986}, 0x10584: []int32{66987}, 0x10585: []int32{66988}, 0x10586: []int32{66989}, 0x10587: []int32{66990}, 0x10588: []int32{66991}, 0x10589: []int32{66992}, 0x1058a: []int32{66993}, 0x1058c: []int32{66995}, 0x1058d: []int32{66996}, 0x1058e: []int32{66997}, 0x1058f: []int32{66998}, 0x10590: []int32{66999}, 0x10591: []int32{67000}, 0x10592: []int32{67001}, 0x10594: []int32{67003}, 0x10595: []int32{67004}, 0x10c80: []int32{68800}, 0x10c81: []int32{68801}, 0x10c82: []int32{68802}, 0x10c83: []int32{68803}, 0x10c84: []int32{68804}, 0x10c85: []int32{68805}, 0x10c86: []int32{68806}, 0x10c87: []int32{68807}, 0x10c88: []int32{68808}, 0x10c89: []int32{68809}, 0x10c8a: []int32{68810}, 0x10c8b: []int32{68811}, 0x10c8c: []int32{68812}, 0x10c8d: []int32{68813}, 0x10c8e: []int32{68814}, 0x10c8f: []int32{68815}, 0x10c90: []int32{68816}, 0x10c91: []int32{68817}, 0x10c92: []int32{68818}, 0x10c93: []int32{68819}, 0x10c94: []int32{68820}, 0x10c95: []int32{68821}, 0x10c96: []int32{68822}, 0x10c97: []int32{68823}, 0x10c98: []int32{68824}, 0x10c99: []int32{68825}, 0x10c9a: []int32{68826}, 0x10c9b: []int32{68827}, 0x10c9c: []int32{68828}, 0x10c9d: []int32{68829}, 0x10c9e: []int32{68830}, 0x10c9f: []int32{68831}, 0x10ca0: []int32{68832}, 0x10ca1: []int32{68833}, 0x10ca2: []int32{68834}, 0x10ca3: []int32{68835}, 0x10ca4: []int32{68836}, 0x10ca5: []int32{68837}, 0x10ca6: []int32{68838}, 0x10ca7: []int32{68839}, 0x10ca8: []int32{68840}, 0x10ca9: []int32{68841}, 0x10caa: []int32{68842}, 0x10cab: []int32{68843}, 0x10cac: []int32{68844}, 0x10cad: []int32{68845}, 0x10cae: []int32{68846}, 0x10caf: []int32{68847}, 0x10cb0: []int32{68848}, 0x10cb1: []int32{68849}, 0x10cb2: []int32{68850}, 0x118a0: []int32{71872}, 0x118a1: []int32{71873}, 0x118a2: []int32{71874}, 0x118a3: []int32{71875}, 0x118a4: []int32{71876}, 0x118a5: []int32{71877}, 0x118a6: []int32{71878}, 0x118a7: []int32{71879}, 0x118a8: []int32{71880}, 0x118a9: []int32{71881}, 0x118aa: []int32{71882}, 0x118ab: []int32{71883}, 0x118ac: []int32{71884}, 0x118ad: []int32{71885}, 0x118ae: []int32{71886}, 0x118af: []int32{71887}, 0x118b0: []int32{71888}, 0x118b1: []int32{71889}, 0x118b2: []int32{71890}, 0x118b3: []int32{71891}, 0x118b4: []int32{71892}, 0x118b5: []int32{71893}, 0x118b6: []int32{71894}, 0x118b7: []int32{71895}, 0x118b8: []int32{71896}, 0x118b9: []int32{71897}, 0x118ba: []int32{71898}, 0x118bb: []int32{71899}, 0x118bc: []int32{71900}, 0x118bd: []int32{71901}, 0x118be: []int32{71902}, 0x118bf: []int32{71903}, 0x16e40: []int32{93792}, 0x16e41: []int32{93793}, 0x16e42: []int32{93794}, 0x16e43: []int32{93795}, 0x16e44: []int32{93796}, 0x16e45: []int32{93797}, 0x16e46: []int32{93798}, 0x16e47: []int32{93799}, 0x16e48: []int32{93800}, 0x16e49: []int32{93801}, 0x16e4a: []int32{93802}, 0x16e4b: []int32{93803}, 0x16e4c: []int32{93804}, 0x16e4d: []int32{93805}, 0x16e4e: []int32{93806}, 0x16e4f: []int32{93807}, 0x16e50: []int32{93808}, 0x16e51: []int32{93809}, 0x16e52: []int32{93810}, 0x16e53: []int32{93811}, 0x16e54: []int32{93812}, 0x16e55: []int32{93813}, 0x16e56: []int32{93814}, 0x16e57: []int32{93815}, 0x16e58: []int32{93816}, 0x16e59: []int32{93817}, 0x16e5a: []int32{93818}, 0x16e5b: []int32{93819}, 0x16e5c: []int32{93820}, 0x16e5d: []int32{93821}, 0x16e5e: []int32{93822}, 0x16e5f: []int32{93823}, 0x1e900: []int32{125218}, 0x1e901: []int32{125219}, 0x1e902: []int32{125220}, 0x1e903: []int32{125221}, 0x1e904: []int32{125222}, 0x1e905: []int32{125223}, 0x1e906: []int32{125224}, 0x1e907: []int32{125225}, 0x1e908: []int32{125226}, 0x1e909: []int32{125227}, 0x1e90a: []int32{125228}, 0x1e90b: []int32{125229}, 0x1e90c: []int32{125230}, 0x1e90d: []int32{125231}, 0x1e90e: []int32{125232}, 0x1e90f: []int32{125233}, 0x1e910: []int32{125234}, 0x1e911: []int32{125235}, 0x1e912: []int32{125236}, 0x1e913: []int32{125237}, 0x1e914: []int32{125238}, 0x1e915: []int32{125239}, 0x1e916: []int32{125240}, 0x1e917: []int32{125241}, 0x1e918: []int32{125242}, 0x1e919: []int32{125243}, 0x1e91a: []int32{125244}, 0x1e91b: []int32{125245}, 0x1e91c: []int32{125246}, 0x1e91d: []int32{125247}, 0x1e91e: []int32{125248}, 0x1e91f: []int32{125249}, 0x1e920: []int32{125250}, 0x1e921: []int32{125251}, } goldmark-1.7.4/util/util.go000066400000000000000000000676771463655211100156370ustar00rootroot00000000000000// Package util provides utility functions for the goldmark. package util import ( "bytes" "io" "net/url" "regexp" "sort" "strconv" "unicode" "unicode/utf8" ) // A CopyOnWriteBuffer is a byte buffer that copies buffer when // it need to be changed. type CopyOnWriteBuffer struct { buffer []byte copied bool } // NewCopyOnWriteBuffer returns a new CopyOnWriteBuffer. func NewCopyOnWriteBuffer(buffer []byte) CopyOnWriteBuffer { return CopyOnWriteBuffer{ buffer: buffer, copied: false, } } // Write writes given bytes to the buffer. // Write allocate new buffer and clears it at the first time. func (b *CopyOnWriteBuffer) Write(value []byte) { if !b.copied { b.buffer = make([]byte, 0, len(b.buffer)+20) b.copied = true } b.buffer = append(b.buffer, value...) } // WriteString writes given string to the buffer. // WriteString allocate new buffer and clears it at the first time. func (b *CopyOnWriteBuffer) WriteString(value string) { b.Write(StringToReadOnlyBytes(value)) } // Append appends given bytes to the buffer. // Append copy buffer at the first time. func (b *CopyOnWriteBuffer) Append(value []byte) { if !b.copied { tmp := make([]byte, len(b.buffer), len(b.buffer)+20) copy(tmp, b.buffer) b.buffer = tmp b.copied = true } b.buffer = append(b.buffer, value...) } // AppendString appends given string to the buffer. // AppendString copy buffer at the first time. func (b *CopyOnWriteBuffer) AppendString(value string) { b.Append(StringToReadOnlyBytes(value)) } // WriteByte writes the given byte to the buffer. // WriteByte allocate new buffer and clears it at the first time. func (b *CopyOnWriteBuffer) WriteByte(c byte) error { if !b.copied { b.buffer = make([]byte, 0, len(b.buffer)+20) b.copied = true } b.buffer = append(b.buffer, c) return nil } // AppendByte appends given bytes to the buffer. // AppendByte copy buffer at the first time. func (b *CopyOnWriteBuffer) AppendByte(c byte) { if !b.copied { tmp := make([]byte, len(b.buffer), len(b.buffer)+20) copy(tmp, b.buffer) b.buffer = tmp b.copied = true } b.buffer = append(b.buffer, c) } // Bytes returns bytes of this buffer. func (b *CopyOnWriteBuffer) Bytes() []byte { return b.buffer } // IsCopied returns true if buffer has been copied, otherwise false. func (b *CopyOnWriteBuffer) IsCopied() bool { return b.copied } // IsEscapedPunctuation returns true if character at a given index i // is an escaped punctuation, otherwise false. func IsEscapedPunctuation(source []byte, i int) bool { return source[i] == '\\' && i < len(source)-1 && IsPunct(source[i+1]) } // ReadWhile read the given source while pred is true. func ReadWhile(source []byte, index [2]int, pred func(byte) bool) (int, bool) { j := index[0] ok := false for ; j < index[1]; j++ { c1 := source[j] if pred(c1) { ok = true continue } break } return j, ok } // IsBlank returns true if the given string is all space characters. func IsBlank(bs []byte) bool { for _, b := range bs { if !IsSpace(b) { return false } } return true } // VisualizeSpaces visualize invisible space characters. func VisualizeSpaces(bs []byte) []byte { bs = bytes.Replace(bs, []byte(" "), []byte("[SPACE]"), -1) bs = bytes.Replace(bs, []byte("\t"), []byte("[TAB]"), -1) bs = bytes.Replace(bs, []byte("\n"), []byte("[NEWLINE]\n"), -1) bs = bytes.Replace(bs, []byte("\r"), []byte("[CR]"), -1) bs = bytes.Replace(bs, []byte("\v"), []byte("[VTAB]"), -1) bs = bytes.Replace(bs, []byte("\x00"), []byte("[NUL]"), -1) bs = bytes.Replace(bs, []byte("\ufffd"), []byte("[U+FFFD]"), -1) return bs } // TabWidth calculates actual width of a tab at the given position. func TabWidth(currentPos int) int { return 4 - currentPos%4 } // IndentPosition searches an indent position with the given width for the given line. // If the line contains tab characters, paddings may be not zero. // currentPos==0 and width==2: // // position: 0 1 // [TAB]aaaa // width: 1234 5678 // // width=2 is in the tab character. In this case, IndentPosition returns // (pos=1, padding=2). func IndentPosition(bs []byte, currentPos, width int) (pos, padding int) { return IndentPositionPadding(bs, currentPos, 0, width) } // IndentPositionPadding searches an indent position with the given width for the given line. // This function is mostly same as IndentPosition except this function // takes account into additional paddings. func IndentPositionPadding(bs []byte, currentPos, paddingv, width int) (pos, padding int) { if width == 0 { return 0, paddingv } w := 0 i := 0 l := len(bs) for ; i < l; i++ { if bs[i] == '\t' && w < width { w += TabWidth(currentPos + w) } else if bs[i] == ' ' && w < width { w++ } else { break } } if w >= width { return i - paddingv, w - width } return -1, -1 } // DedentPosition dedents lines by the given width. // // Deprecated: This function has bugs. Use util.IndentPositionPadding and util.FirstNonSpacePosition. func DedentPosition(bs []byte, currentPos, width int) (pos, padding int) { if width == 0 { return 0, 0 } w := 0 l := len(bs) i := 0 for ; i < l; i++ { if bs[i] == '\t' { w += TabWidth(currentPos + w) } else if bs[i] == ' ' { w++ } else { break } } if w >= width { return i, w - width } return i, 0 } // DedentPositionPadding dedents lines by the given width. // This function is mostly same as DedentPosition except this function // takes account into additional paddings. // // Deprecated: This function has bugs. Use util.IndentPositionPadding and util.FirstNonSpacePosition. func DedentPositionPadding(bs []byte, currentPos, paddingv, width int) (pos, padding int) { if width == 0 { return 0, paddingv } w := 0 i := 0 l := len(bs) for ; i < l; i++ { if bs[i] == '\t' { w += TabWidth(currentPos + w) } else if bs[i] == ' ' { w++ } else { break } } if w >= width { return i - paddingv, w - width } return i - paddingv, 0 } // IndentWidth calculate an indent width for the given line. func IndentWidth(bs []byte, currentPos int) (width, pos int) { l := len(bs) for i := 0; i < l; i++ { b := bs[i] if b == ' ' { width++ pos++ } else if b == '\t' { width += TabWidth(currentPos + width) pos++ } else { break } } return } // FirstNonSpacePosition returns a position line that is a first nonspace // character. func FirstNonSpacePosition(bs []byte) int { i := 0 for ; i < len(bs); i++ { c := bs[i] if c == ' ' || c == '\t' { continue } if c == '\n' { return -1 } return i } return -1 } // FindClosure returns a position that closes the given opener. // If codeSpan is set true, it ignores characters in code spans. // If allowNesting is set true, closures correspond to nested opener will be // ignored. // // Deprecated: This function can not handle newlines. Many elements // can be existed over multiple lines(e.g. link labels). // Use text.Reader.FindClosure. func FindClosure(bs []byte, opener, closure byte, codeSpan, allowNesting bool) int { i := 0 opened := 1 codeSpanOpener := 0 for i < len(bs) { c := bs[i] if codeSpan && codeSpanOpener != 0 && c == '`' { codeSpanCloser := 0 for ; i < len(bs); i++ { if bs[i] == '`' { codeSpanCloser++ } else { i-- break } } if codeSpanCloser == codeSpanOpener { codeSpanOpener = 0 } } else if codeSpanOpener == 0 && c == '\\' && i < len(bs)-1 && IsPunct(bs[i+1]) { i += 2 continue } else if codeSpan && codeSpanOpener == 0 && c == '`' { for ; i < len(bs); i++ { if bs[i] == '`' { codeSpanOpener++ } else { i-- break } } } else if (codeSpan && codeSpanOpener == 0) || !codeSpan { if c == closure { opened-- if opened == 0 { return i } } else if c == opener { if !allowNesting { return -1 } opened++ } } i++ } return -1 } // TrimLeft trims characters in the given s from head of the source. // bytes.TrimLeft offers same functionalities, but bytes.TrimLeft // allocates new buffer for the result. func TrimLeft(source, b []byte) []byte { i := 0 for ; i < len(source); i++ { c := source[i] found := false for j := 0; j < len(b); j++ { if c == b[j] { found = true break } } if !found { break } } return source[i:] } // TrimRight trims characters in the given s from tail of the source. func TrimRight(source, b []byte) []byte { i := len(source) - 1 for ; i >= 0; i-- { c := source[i] found := false for j := 0; j < len(b); j++ { if c == b[j] { found = true break } } if !found { break } } return source[:i+1] } // TrimLeftLength returns a length of leading specified characters. func TrimLeftLength(source, s []byte) int { return len(source) - len(TrimLeft(source, s)) } // TrimRightLength returns a length of trailing specified characters. func TrimRightLength(source, s []byte) int { return len(source) - len(TrimRight(source, s)) } // TrimLeftSpaceLength returns a length of leading space characters. func TrimLeftSpaceLength(source []byte) int { i := 0 for ; i < len(source); i++ { if !IsSpace(source[i]) { break } } return i } // TrimRightSpaceLength returns a length of trailing space characters. func TrimRightSpaceLength(source []byte) int { l := len(source) i := l - 1 for ; i >= 0; i-- { if !IsSpace(source[i]) { break } } if i < 0 { return l } return l - 1 - i } // TrimLeftSpace returns a subslice of the given string by slicing off all leading // space characters. func TrimLeftSpace(source []byte) []byte { return TrimLeft(source, spaces) } // TrimRightSpace returns a subslice of the given string by slicing off all trailing // space characters. func TrimRightSpace(source []byte) []byte { return TrimRight(source, spaces) } // DoFullUnicodeCaseFolding performs full unicode case folding to given bytes. func DoFullUnicodeCaseFolding(v []byte) []byte { var rbuf []byte cob := NewCopyOnWriteBuffer(v) n := 0 for i := 0; i < len(v); i++ { c := v[i] if c < 0xb5 { if c >= 0x41 && c <= 0x5a { // A-Z to a-z cob.Write(v[n:i]) _ = cob.WriteByte(c + 32) n = i + 1 } continue } if !utf8.RuneStart(c) { continue } r, length := utf8.DecodeRune(v[i:]) if r == utf8.RuneError { continue } folded, ok := unicodeCaseFoldings[r] if !ok { continue } cob.Write(v[n:i]) if rbuf == nil { rbuf = make([]byte, 4) } for _, f := range folded { l := utf8.EncodeRune(rbuf, f) cob.Write(rbuf[:l]) } i += length - 1 n = i + 1 } if cob.IsCopied() { cob.Write(v[n:]) } return cob.Bytes() } // ReplaceSpaces replaces sequence of spaces with the given repl. func ReplaceSpaces(source []byte, repl byte) []byte { var ret []byte start := -1 for i, c := range source { iss := IsSpace(c) if start < 0 && iss { start = i continue } else if start >= 0 && iss { continue } else if start >= 0 { if ret == nil { ret = make([]byte, 0, len(source)) ret = append(ret, source[:start]...) } ret = append(ret, repl) start = -1 } if ret != nil { ret = append(ret, c) } } if start >= 0 && ret != nil { ret = append(ret, repl) } if ret == nil { return source } return ret } // ToRune decode given bytes start at pos and returns a rune. func ToRune(source []byte, pos int) rune { i := pos for ; i >= 0; i-- { if utf8.RuneStart(source[i]) { break } } r, _ := utf8.DecodeRune(source[i:]) return r } // ToValidRune returns 0xFFFD if the given rune is invalid, otherwise v. func ToValidRune(v rune) rune { if v == 0 || !utf8.ValidRune(v) { return rune(0xFFFD) } return v } // ToLinkReference converts given bytes into a valid link reference string. // ToLinkReference performs unicode case folding, trims leading and trailing spaces, converts into lower // case and replace spaces with a single space character. func ToLinkReference(v []byte) string { v = TrimLeftSpace(v) v = TrimRightSpace(v) v = DoFullUnicodeCaseFolding(v) return string(ReplaceSpaces(v, ' ')) } var htmlEscapeTable = [256][]byte{nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, []byte("""), nil, nil, nil, []byte("&"), nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, []byte("<"), nil, []byte(">"), nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil} //nolint:golint,lll // EscapeHTMLByte returns HTML escaped bytes if the given byte should be escaped, // otherwise nil. func EscapeHTMLByte(b byte) []byte { return htmlEscapeTable[b] } // EscapeHTML escapes characters that should be escaped in HTML text. func EscapeHTML(v []byte) []byte { cob := NewCopyOnWriteBuffer(v) n := 0 for i := 0; i < len(v); i++ { c := v[i] escaped := htmlEscapeTable[c] if escaped != nil { cob.Write(v[n:i]) cob.Write(escaped) n = i + 1 } } if cob.IsCopied() { cob.Write(v[n:]) } return cob.Bytes() } // UnescapePunctuations unescapes blackslash escaped punctuations. func UnescapePunctuations(source []byte) []byte { cob := NewCopyOnWriteBuffer(source) limit := len(source) n := 0 for i := 0; i < limit; { c := source[i] if i < limit-1 && c == '\\' && IsPunct(source[i+1]) { cob.Write(source[n:i]) _ = cob.WriteByte(source[i+1]) i += 2 n = i continue } i++ } if cob.IsCopied() { cob.Write(source[n:]) } return cob.Bytes() } // ResolveNumericReferences resolve numeric references like 'Ӓ" . func ResolveNumericReferences(source []byte) []byte { cob := NewCopyOnWriteBuffer(source) buf := make([]byte, 6) limit := len(source) var ok bool n := 0 for i := 0; i < limit; i++ { if source[i] == '&' { pos := i next := i + 1 if next < limit && source[next] == '#' { nnext := next + 1 if nnext < limit { nc := source[nnext] // code point like #x22; if nnext < limit && nc == 'x' || nc == 'X' { start := nnext + 1 i, ok = ReadWhile(source, [2]int{start, limit}, IsHexDecimal) if ok && i < limit && source[i] == ';' { v, _ := strconv.ParseUint(BytesToReadOnlyString(source[start:i]), 16, 32) cob.Write(source[n:pos]) n = i + 1 runeSize := utf8.EncodeRune(buf, ToValidRune(rune(v))) cob.Write(buf[:runeSize]) continue } // code point like #1234; } else if nc >= '0' && nc <= '9' { start := nnext i, ok = ReadWhile(source, [2]int{start, limit}, IsNumeric) if ok && i < limit && i-start < 8 && source[i] == ';' { v, _ := strconv.ParseUint(BytesToReadOnlyString(source[start:i]), 0, 32) cob.Write(source[n:pos]) n = i + 1 runeSize := utf8.EncodeRune(buf, ToValidRune(rune(v))) cob.Write(buf[:runeSize]) continue } } } } i = next - 1 } } if cob.IsCopied() { cob.Write(source[n:]) } return cob.Bytes() } // ResolveEntityNames resolve entity references like 'ö" . func ResolveEntityNames(source []byte) []byte { cob := NewCopyOnWriteBuffer(source) limit := len(source) var ok bool n := 0 for i := 0; i < limit; i++ { if source[i] == '&' { pos := i next := i + 1 if !(next < limit && source[next] == '#') { start := next i, ok = ReadWhile(source, [2]int{start, limit}, IsAlphaNumeric) if ok && i < limit && source[i] == ';' { name := BytesToReadOnlyString(source[start:i]) entity, ok := LookUpHTML5EntityByName(name) if ok { cob.Write(source[n:pos]) n = i + 1 cob.Write(entity.Characters) continue } } } i = next - 1 } } if cob.IsCopied() { cob.Write(source[n:]) } return cob.Bytes() } var htmlSpace = []byte("%20") // URLEscape escape the given URL. // If resolveReference is set true: // 1. unescape punctuations // 2. resolve numeric references // 3. resolve entity references // // URL encoded values (%xx) are kept as is. func URLEscape(v []byte, resolveReference bool) []byte { if resolveReference { v = UnescapePunctuations(v) v = ResolveNumericReferences(v) v = ResolveEntityNames(v) } cob := NewCopyOnWriteBuffer(v) limit := len(v) n := 0 for i := 0; i < limit; { c := v[i] if urlEscapeTable[c] == 1 { i++ continue } if c == '%' && i+2 < limit && IsHexDecimal(v[i+1]) && IsHexDecimal(v[i+1]) { i += 3 continue } u8len := utf8lenTable[c] if u8len == 99 { // invalid utf8 leading byte, skip it i++ continue } if c == ' ' { cob.Write(v[n:i]) cob.Write(htmlSpace) i++ n = i continue } if int(u8len) > len(v) { u8len = int8(len(v) - 1) } if u8len == 0 { i++ n = i continue } cob.Write(v[n:i]) stop := i + int(u8len) if stop > len(v) { i++ n = i continue } cob.Write(StringToReadOnlyBytes(url.QueryEscape(string(v[i:stop])))) i += int(u8len) n = i } if cob.IsCopied() && n < limit { cob.Write(v[n:]) } return cob.Bytes() } // FindURLIndex returns a stop index value if the given bytes seem an URL. // This function is equivalent to [A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]* . func FindURLIndex(b []byte) int { i := 0 if !(len(b) > 0 && urlTable[b[i]]&7 == 7) { return -1 } i++ for ; i < len(b); i++ { c := b[i] if urlTable[c]&4 != 4 { break } } if i == 1 || i > 33 || i >= len(b) { return -1 } if b[i] != ':' { return -1 } i++ for ; i < len(b); i++ { c := b[i] if urlTable[c]&1 != 1 { break } } return i } var emailDomainRegexp = regexp.MustCompile(`^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*`) //nolint:golint,lll // FindEmailIndex returns a stop index value if the given bytes seem an email address. func FindEmailIndex(b []byte) int { // TODO: eliminate regexps i := 0 for ; i < len(b); i++ { c := b[i] if emailTable[c]&1 != 1 { break } } if i == 0 { return -1 } if i >= len(b) || b[i] != '@' { return -1 } i++ if i >= len(b) { return -1 } match := emailDomainRegexp.FindSubmatchIndex(b[i:]) if match == nil { return -1 } return i + match[1] } var spaces = []byte(" \t\n\x0b\x0c\x0d") var spaceTable = [256]int8{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} //nolint:golint,lll var punctTable = [256]int8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} //nolint:golint,lll // a-zA-Z0-9, ;/?:@&=+$,-_.!~*'()# var urlEscapeTable = [256]int8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} //nolint:golint,lll var utf8lenTable = [256]int8{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 99, 99, 99, 99, 99, 99, 99, 99} //nolint:golint,lll var urlTable = [256]uint8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 5, 5, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 0, 1, 0, 1, 1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} //nolint:golint,lll var emailTable = [256]uint8{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} //nolint:golint,lll // UTF8Len returns a byte length of the utf-8 character. func UTF8Len(b byte) int8 { return utf8lenTable[b] } // IsPunct returns true if the given character is a punctuation, otherwise false. func IsPunct(c byte) bool { return punctTable[c] == 1 } // IsPunctRune returns true if the given rune is a punctuation, otherwise false. func IsPunctRune(r rune) bool { return unicode.IsSymbol(r) || unicode.IsPunct(r) } // IsSpace returns true if the given character is a space, otherwise false. func IsSpace(c byte) bool { return spaceTable[c] == 1 } // IsSpaceRune returns true if the given rune is a space, otherwise false. func IsSpaceRune(r rune) bool { return int32(r) <= 256 && IsSpace(byte(r)) || unicode.IsSpace(r) } // IsNumeric returns true if the given character is a numeric, otherwise false. func IsNumeric(c byte) bool { return c >= '0' && c <= '9' } // IsHexDecimal returns true if the given character is a hexdecimal, otherwise false. func IsHexDecimal(c byte) bool { return c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F' } // IsAlphaNumeric returns true if the given character is a alphabet or a numeric, otherwise false. func IsAlphaNumeric(c byte) bool { return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' } // A BufWriter is a subset of the bufio.Writer . type BufWriter interface { io.Writer Available() int Buffered() int Flush() error WriteByte(c byte) error WriteRune(r rune) (size int, err error) WriteString(s string) (int, error) } // A PrioritizedValue struct holds pair of an arbitrary value and a priority. type PrioritizedValue struct { // Value is an arbitrary value that you want to prioritize. Value interface{} // Priority is a priority of the value. Priority int } // PrioritizedSlice is a slice of the PrioritizedValues. type PrioritizedSlice []PrioritizedValue // Sort sorts the PrioritizedSlice in ascending order. func (s PrioritizedSlice) Sort() { sort.Slice(s, func(i, j int) bool { return s[i].Priority < s[j].Priority }) } // Remove removes the given value from this slice. func (s PrioritizedSlice) Remove(v interface{}) PrioritizedSlice { i := 0 found := false for ; i < len(s); i++ { if s[i].Value == v { found = true break } } if !found { return s } return append(s[:i], s[i+1:]...) } // Prioritized returns a new PrioritizedValue. func Prioritized(v interface{}, priority int) PrioritizedValue { return PrioritizedValue{v, priority} } func bytesHash(b []byte) uint64 { var hash uint64 = 5381 for _, c := range b { hash = ((hash << 5) + hash) + uint64(c) } return hash } // BytesFilter is a efficient data structure for checking whether bytes exist or not. // BytesFilter is thread-safe. type BytesFilter interface { // Add adds given bytes to this set. Add([]byte) // Contains return true if this set contains given bytes, otherwise false. Contains([]byte) bool // Extend copies this filter and adds given bytes to new filter. Extend(...[]byte) BytesFilter } type bytesFilter struct { chars [256]uint8 threshold int slots [][][]byte } // NewBytesFilter returns a new BytesFilter. func NewBytesFilter(elements ...[]byte) BytesFilter { s := &bytesFilter{ threshold: 3, slots: make([][][]byte, 64), } for _, element := range elements { s.Add(element) } return s } func (s *bytesFilter) Add(b []byte) { l := len(b) m := s.threshold if l < s.threshold { m = l } for i := 0; i < m; i++ { s.chars[b[i]] |= 1 << uint8(i) } h := bytesHash(b) % uint64(len(s.slots)) slot := s.slots[h] if slot == nil { slot = [][]byte{} } s.slots[h] = append(slot, b) } func (s *bytesFilter) Extend(bs ...[]byte) BytesFilter { newFilter := NewBytesFilter().(*bytesFilter) newFilter.chars = s.chars newFilter.threshold = s.threshold for k, v := range s.slots { newSlot := make([][]byte, len(v)) copy(newSlot, v) newFilter.slots[k] = v } for _, b := range bs { newFilter.Add(b) } return newFilter } func (s *bytesFilter) Contains(b []byte) bool { l := len(b) m := s.threshold if l < s.threshold { m = l } for i := 0; i < m; i++ { if (s.chars[b[i]] & (1 << uint8(i))) == 0 { return false } } h := bytesHash(b) % uint64(len(s.slots)) slot := s.slots[h] if len(slot) == 0 { return false } for _, element := range slot { if bytes.Equal(element, b) { return true } } return false } goldmark-1.7.4/util/util_cjk.go000066400000000000000000000256751463655211100164560ustar00rootroot00000000000000package util import "unicode" var cjkRadicalsSupplement = &unicode.RangeTable{ R16: []unicode.Range16{ {0x2E80, 0x2EFF, 1}, }, } var kangxiRadicals = &unicode.RangeTable{ R16: []unicode.Range16{ {0x2F00, 0x2FDF, 1}, }, } var ideographicDescriptionCharacters = &unicode.RangeTable{ R16: []unicode.Range16{ {0x2FF0, 0x2FFF, 1}, }, } var cjkSymbolsAndPunctuation = &unicode.RangeTable{ R16: []unicode.Range16{ {0x3000, 0x303F, 1}, }, } var hiragana = &unicode.RangeTable{ R16: []unicode.Range16{ {0x3040, 0x309F, 1}, }, } var katakana = &unicode.RangeTable{ R16: []unicode.Range16{ {0x30A0, 0x30FF, 1}, }, } var kanbun = &unicode.RangeTable{ R16: []unicode.Range16{ {0x3130, 0x318F, 1}, {0x3190, 0x319F, 1}, }, } var cjkStrokes = &unicode.RangeTable{ R16: []unicode.Range16{ {0x31C0, 0x31EF, 1}, }, } var katakanaPhoneticExtensions = &unicode.RangeTable{ R16: []unicode.Range16{ {0x31F0, 0x31FF, 1}, }, } var cjkCompatibility = &unicode.RangeTable{ R16: []unicode.Range16{ {0x3300, 0x33FF, 1}, }, } var cjkUnifiedIdeographsExtensionA = &unicode.RangeTable{ R16: []unicode.Range16{ {0x3400, 0x4DBF, 1}, }, } var cjkUnifiedIdeographs = &unicode.RangeTable{ R16: []unicode.Range16{ {0x4E00, 0x9FFF, 1}, }, } var yiSyllables = &unicode.RangeTable{ R16: []unicode.Range16{ {0xA000, 0xA48F, 1}, }, } var yiRadicals = &unicode.RangeTable{ R16: []unicode.Range16{ {0xA490, 0xA4CF, 1}, }, } var cjkCompatibilityIdeographs = &unicode.RangeTable{ R16: []unicode.Range16{ {0xF900, 0xFAFF, 1}, }, } var verticalForms = &unicode.RangeTable{ R16: []unicode.Range16{ {0xFE10, 0xFE1F, 1}, }, } var cjkCompatibilityForms = &unicode.RangeTable{ R16: []unicode.Range16{ {0xFE30, 0xFE4F, 1}, }, } var smallFormVariants = &unicode.RangeTable{ R16: []unicode.Range16{ {0xFE50, 0xFE6F, 1}, }, } var halfwidthAndFullwidthForms = &unicode.RangeTable{ R16: []unicode.Range16{ {0xFF00, 0xFFEF, 1}, }, } var kanaSupplement = &unicode.RangeTable{ R32: []unicode.Range32{ {0x1B000, 0x1B0FF, 1}, }, } var kanaExtendedA = &unicode.RangeTable{ R32: []unicode.Range32{ {0x1B100, 0x1B12F, 1}, }, } var smallKanaExtension = &unicode.RangeTable{ R32: []unicode.Range32{ {0x1B130, 0x1B16F, 1}, }, } var cjkUnifiedIdeographsExtensionB = &unicode.RangeTable{ R32: []unicode.Range32{ {0x20000, 0x2A6DF, 1}, }, } var cjkUnifiedIdeographsExtensionC = &unicode.RangeTable{ R32: []unicode.Range32{ {0x2A700, 0x2B73F, 1}, }, } var cjkUnifiedIdeographsExtensionD = &unicode.RangeTable{ R32: []unicode.Range32{ {0x2B740, 0x2B81F, 1}, }, } var cjkUnifiedIdeographsExtensionE = &unicode.RangeTable{ R32: []unicode.Range32{ {0x2B820, 0x2CEAF, 1}, }, } var cjkUnifiedIdeographsExtensionF = &unicode.RangeTable{ R32: []unicode.Range32{ {0x2CEB0, 0x2EBEF, 1}, }, } var cjkCompatibilityIdeographsSupplement = &unicode.RangeTable{ R32: []unicode.Range32{ {0x2F800, 0x2FA1F, 1}, }, } var cjkUnifiedIdeographsExtensionG = &unicode.RangeTable{ R32: []unicode.Range32{ {0x30000, 0x3134F, 1}, }, } // IsEastAsianWideRune returns trhe if the given rune is an east asian wide character, otherwise false. func IsEastAsianWideRune(r rune) bool { return unicode.Is(unicode.Hiragana, r) || unicode.Is(unicode.Katakana, r) || unicode.Is(unicode.Han, r) || unicode.Is(unicode.Lm, r) || unicode.Is(unicode.Hangul, r) || unicode.Is(cjkSymbolsAndPunctuation, r) } // IsSpaceDiscardingUnicodeRune returns true if the given rune is space-discarding unicode character, otherwise false. // See https://www.w3.org/TR/2020/WD-css-text-3-20200429/#space-discard-set func IsSpaceDiscardingUnicodeRune(r rune) bool { return unicode.Is(cjkRadicalsSupplement, r) || unicode.Is(kangxiRadicals, r) || unicode.Is(ideographicDescriptionCharacters, r) || unicode.Is(cjkSymbolsAndPunctuation, r) || unicode.Is(hiragana, r) || unicode.Is(katakana, r) || unicode.Is(kanbun, r) || unicode.Is(cjkStrokes, r) || unicode.Is(katakanaPhoneticExtensions, r) || unicode.Is(cjkCompatibility, r) || unicode.Is(cjkUnifiedIdeographsExtensionA, r) || unicode.Is(cjkUnifiedIdeographs, r) || unicode.Is(yiSyllables, r) || unicode.Is(yiRadicals, r) || unicode.Is(cjkCompatibilityIdeographs, r) || unicode.Is(verticalForms, r) || unicode.Is(cjkCompatibilityForms, r) || unicode.Is(smallFormVariants, r) || unicode.Is(halfwidthAndFullwidthForms, r) || unicode.Is(kanaSupplement, r) || unicode.Is(kanaExtendedA, r) || unicode.Is(smallKanaExtension, r) || unicode.Is(cjkUnifiedIdeographsExtensionB, r) || unicode.Is(cjkUnifiedIdeographsExtensionC, r) || unicode.Is(cjkUnifiedIdeographsExtensionD, r) || unicode.Is(cjkUnifiedIdeographsExtensionE, r) || unicode.Is(cjkUnifiedIdeographsExtensionF, r) || unicode.Is(cjkCompatibilityIdeographsSupplement, r) || unicode.Is(cjkUnifiedIdeographsExtensionG, r) } // EastAsianWidth returns the east asian width of the given rune. // See https://www.unicode.org/reports/tr11/tr11-36.html func EastAsianWidth(r rune) string { switch { case r == 0x3000, (0xFF01 <= r && r <= 0xFF60), (0xFFE0 <= r && r <= 0xFFE6): return "F" case r == 0x20A9, (0xFF61 <= r && r <= 0xFFBE), (0xFFC2 <= r && r <= 0xFFC7), (0xFFCA <= r && r <= 0xFFCF), (0xFFD2 <= r && r <= 0xFFD7), (0xFFDA <= r && r <= 0xFFDC), (0xFFE8 <= r && r <= 0xFFEE): return "H" case (0x1100 <= r && r <= 0x115F), (0x11A3 <= r && r <= 0x11A7), (0x11FA <= r && r <= 0x11FF), (0x2329 <= r && r <= 0x232A), (0x2E80 <= r && r <= 0x2E99), (0x2E9B <= r && r <= 0x2EF3), (0x2F00 <= r && r <= 0x2FD5), (0x2FF0 <= r && r <= 0x2FFB), (0x3001 <= r && r <= 0x303E), (0x3041 <= r && r <= 0x3096), (0x3099 <= r && r <= 0x30FF), (0x3105 <= r && r <= 0x312D), (0x3131 <= r && r <= 0x318E), (0x3190 <= r && r <= 0x31BA), (0x31C0 <= r && r <= 0x31E3), (0x31F0 <= r && r <= 0x321E), (0x3220 <= r && r <= 0x3247), (0x3250 <= r && r <= 0x32FE), (0x3300 <= r && r <= 0x4DBF), (0x4E00 <= r && r <= 0xA48C), (0xA490 <= r && r <= 0xA4C6), (0xA960 <= r && r <= 0xA97C), (0xAC00 <= r && r <= 0xD7A3), (0xD7B0 <= r && r <= 0xD7C6), (0xD7CB <= r && r <= 0xD7FB), (0xF900 <= r && r <= 0xFAFF), (0xFE10 <= r && r <= 0xFE19), (0xFE30 <= r && r <= 0xFE52), (0xFE54 <= r && r <= 0xFE66), (0xFE68 <= r && r <= 0xFE6B), (0x1B000 <= r && r <= 0x1B001), (0x1F200 <= r && r <= 0x1F202), (0x1F210 <= r && r <= 0x1F23A), (0x1F240 <= r && r <= 0x1F248), (0x1F250 <= r && r <= 0x1F251), (0x20000 <= r && r <= 0x2F73F), (0x2B740 <= r && r <= 0x2FFFD), (0x30000 <= r && r <= 0x3FFFD): return "W" case (0x0020 <= r && r <= 0x007E), (0x00A2 <= r && r <= 0x00A3), (0x00A5 <= r && r <= 0x00A6), r == 0x00AC, r == 0x00AF, (0x27E6 <= r && r <= 0x27ED), (0x2985 <= r && r <= 0x2986): return "Na" case (0x00A1 == r), (0x00A4 == r), (0x00A7 <= r && r <= 0x00A8), (0x00AA == r), (0x00AD <= r && r <= 0x00AE), (0x00B0 <= r && r <= 0x00B4), (0x00B6 <= r && r <= 0x00BA), (0x00BC <= r && r <= 0x00BF), (0x00C6 == r), (0x00D0 == r), (0x00D7 <= r && r <= 0x00D8), (0x00DE <= r && r <= 0x00E1), (0x00E6 == r), (0x00E8 <= r && r <= 0x00EA), (0x00EC <= r && r <= 0x00ED), (0x00F0 == r), (0x00F2 <= r && r <= 0x00F3), (0x00F7 <= r && r <= 0x00FA), (0x00FC == r), (0x00FE == r), (0x0101 == r), (0x0111 == r), (0x0113 == r), (0x011B == r), (0x0126 <= r && r <= 0x0127), (0x012B == r), (0x0131 <= r && r <= 0x0133), (0x0138 == r), (0x013F <= r && r <= 0x0142), (0x0144 == r), (0x0148 <= r && r <= 0x014B), (0x014D == r), (0x0152 <= r && r <= 0x0153), (0x0166 <= r && r <= 0x0167), (0x016B == r), (0x01CE == r), (0x01D0 == r), (0x01D2 == r), (0x01D4 == r), (0x01D6 == r), (0x01D8 == r), (0x01DA == r), (0x01DC == r), (0x0251 == r), (0x0261 == r), (0x02C4 == r), (0x02C7 == r), (0x02C9 <= r && r <= 0x02CB), (0x02CD == r), (0x02D0 == r), (0x02D8 <= r && r <= 0x02DB), (0x02DD == r), (0x02DF == r), (0x0300 <= r && r <= 0x036F), (0x0391 <= r && r <= 0x03A1), (0x03A3 <= r && r <= 0x03A9), (0x03B1 <= r && r <= 0x03C1), (0x03C3 <= r && r <= 0x03C9), (0x0401 == r), (0x0410 <= r && r <= 0x044F), (0x0451 == r), (0x2010 == r), (0x2013 <= r && r <= 0x2016), (0x2018 <= r && r <= 0x2019), (0x201C <= r && r <= 0x201D), (0x2020 <= r && r <= 0x2022), (0x2024 <= r && r <= 0x2027), (0x2030 == r), (0x2032 <= r && r <= 0x2033), (0x2035 == r), (0x203B == r), (0x203E == r), (0x2074 == r), (0x207F == r), (0x2081 <= r && r <= 0x2084), (0x20AC == r), (0x2103 == r), (0x2105 == r), (0x2109 == r), (0x2113 == r), (0x2116 == r), (0x2121 <= r && r <= 0x2122), (0x2126 == r), (0x212B == r), (0x2153 <= r && r <= 0x2154), (0x215B <= r && r <= 0x215E), (0x2160 <= r && r <= 0x216B), (0x2170 <= r && r <= 0x2179), (0x2189 == r), (0x2190 <= r && r <= 0x2199), (0x21B8 <= r && r <= 0x21B9), (0x21D2 == r), (0x21D4 == r), (0x21E7 == r), (0x2200 == r), (0x2202 <= r && r <= 0x2203), (0x2207 <= r && r <= 0x2208), (0x220B == r), (0x220F == r), (0x2211 == r), (0x2215 == r), (0x221A == r), (0x221D <= r && r <= 0x2220), (0x2223 == r), (0x2225 == r), (0x2227 <= r && r <= 0x222C), (0x222E == r), (0x2234 <= r && r <= 0x2237), (0x223C <= r && r <= 0x223D), (0x2248 == r), (0x224C == r), (0x2252 == r), (0x2260 <= r && r <= 0x2261), (0x2264 <= r && r <= 0x2267), (0x226A <= r && r <= 0x226B), (0x226E <= r && r <= 0x226F), (0x2282 <= r && r <= 0x2283), (0x2286 <= r && r <= 0x2287), (0x2295 == r), (0x2299 == r), (0x22A5 == r), (0x22BF == r), (0x2312 == r), (0x2460 <= r && r <= 0x24E9), (0x24EB <= r && r <= 0x254B), (0x2550 <= r && r <= 0x2573), (0x2580 <= r && r <= 0x258F), (0x2592 <= r && r <= 0x2595), (0x25A0 <= r && r <= 0x25A1), (0x25A3 <= r && r <= 0x25A9), (0x25B2 <= r && r <= 0x25B3), (0x25B6 <= r && r <= 0x25B7), (0x25BC <= r && r <= 0x25BD), (0x25C0 <= r && r <= 0x25C1), (0x25C6 <= r && r <= 0x25C8), (0x25CB == r), (0x25CE <= r && r <= 0x25D1), (0x25E2 <= r && r <= 0x25E5), (0x25EF == r), (0x2605 <= r && r <= 0x2606), (0x2609 == r), (0x260E <= r && r <= 0x260F), (0x2614 <= r && r <= 0x2615), (0x261C == r), (0x261E == r), (0x2640 == r), (0x2642 == r), (0x2660 <= r && r <= 0x2661), (0x2663 <= r && r <= 0x2665), (0x2667 <= r && r <= 0x266A), (0x266C <= r && r <= 0x266D), (0x266F == r), (0x269E <= r && r <= 0x269F), (0x26BE <= r && r <= 0x26BF), (0x26C4 <= r && r <= 0x26CD), (0x26CF <= r && r <= 0x26E1), (0x26E3 == r), (0x26E8 <= r && r <= 0x26FF), (0x273D == r), (0x2757 == r), (0x2776 <= r && r <= 0x277F), (0x2B55 <= r && r <= 0x2B59), (0x3248 <= r && r <= 0x324F), (0xE000 <= r && r <= 0xF8FF), (0xFE00 <= r && r <= 0xFE0F), (0xFFFD == r), (0x1F100 <= r && r <= 0x1F10A), (0x1F110 <= r && r <= 0x1F12D), (0x1F130 <= r && r <= 0x1F169), (0x1F170 <= r && r <= 0x1F19A), (0xE0100 <= r && r <= 0xE01EF), (0xF0000 <= r && r <= 0xFFFFD), (0x100000 <= r && r <= 0x10FFFD): return "A" default: return "N" } } goldmark-1.7.4/util/util_safe.go000066400000000000000000000005201463655211100166030ustar00rootroot00000000000000//go:build appengine || js // +build appengine js package util // BytesToReadOnlyString returns a string converted from given bytes. func BytesToReadOnlyString(b []byte) string { return string(b) } // StringToReadOnlyBytes returns bytes converted from given string. func StringToReadOnlyBytes(s string) []byte { return []byte(s) } goldmark-1.7.4/util/util_unsafe.go000066400000000000000000000010401463655211100171440ustar00rootroot00000000000000//go:build !appengine && !js // +build !appengine,!js package util import ( "reflect" "unsafe" ) // BytesToReadOnlyString returns a string converted from given bytes. func BytesToReadOnlyString(b []byte) string { return *(*string)(unsafe.Pointer(&b)) } // StringToReadOnlyBytes returns bytes converted from given string. func StringToReadOnlyBytes(s string) (bs []byte) { sh := (*reflect.StringHeader)(unsafe.Pointer(&s)) bh := (*reflect.SliceHeader)(unsafe.Pointer(&bs)) bh.Data = sh.Data bh.Cap = sh.Len bh.Len = sh.Len return }
    ')
    		r.writeLines(w, source, n)
    	} else {
    		_, _ = w.WriteString("