Coder Social home page Coder Social logo

alecthomas / chroma Goto Github PK

View Code? Open in Web Editor NEW
4.2K 4.2K 374.0 13.31 MB

A general purpose syntax highlighter in pure Go

License: MIT License

Python 0.98% Go 70.89% JavaScript 1.79% Makefile 0.09% Shell 0.18% CSS 26.08%
console go golang highlighter highlighting html library syntax tool

chroma's People

Contributors

akatrevorjay avatar alecthomas avatar apexskier avatar bep avatar ciavash avatar cosmichorrordev avatar francislavoie avatar gandarez avatar gusted avatar icy-comet avatar jakobdev avatar jos512 avatar jpienaar avatar kaushalmodi avatar kenshaw avatar miekg avatar mlpo avatar myitcv avatar pabluk avatar pedroql avatar pmwmedia avatar renovate[bot] avatar scop avatar serhack avatar silverwind avatar steambap avatar toshimaru avatar triallax avatar vanillajonathan avatar yaythomas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chroma's Issues

Separately styling line numbers

Enhancement request from gohugoio/hugo#3915:

I've been using the highlighting shortcode (eg {{< highlight ini "linenos=table" >}}) to output line numbers into one column and code into another, so I can style numbers separately.

There's currently no way to style the line number separate from the line itself. The simplest solution seems to be to mimic Pygments' linenos=table behavior.

Inline style for hightlight ranges

This is probably related to the other one, but I see that the hl class gets added, but you should probably provide some inline styles for these when "no classes" (default) is used?

Can C# highlight also include classes, interfaces, enums?

Chroma is great and I'm happy with it. But I think the C# lexer can improved. Currently, it doesn't recognise standard .NET framework classes, interfaces, and enumerations. I think the Chroma highlight will be for the better if we include those.

As an example, here's how a small code snippet looks like in Visual Studio:

code-highlight-visua-studio

With Chroma's C# lexer highlighting, I see this:

code-highlight-chroma

It's pretty colourless in Chroma, honestly, and I think the lightblue highlighting of DriveInfo, IEnumerable, Directory, and Console here would really add value in making the code easier to read and interpret.

Is there a way to expand the C# lexer for this? Perhaps Alec has an idea, or perhaps otherwise you @steambap? (I ping you because you made the original lexer, and have a better understanding of how it works than I do.)

PHP comment highlighting bug

The second comment in the following PHP code is not highlighted correctly:

<?php
// Comment 1
if (true) {}
// Comment 2

I did not have a look at the rules yet.

HighlightLines range should be 1 based

And not, as now, relative to the BaseLineNumber

Had it not been for the fact that Pygments behaves like this, this would maybe make sense, but as it is now, when we release this in Hugo, users will have to also do some conversion on their side.

I could of course do the calculations on my side, but I think you would be better off being "Pygments compatible" where it makes sense.

Should I report syntax highlighting issues?

For example, I have a Ruby snippet that I think could be highlighted differently. Is this the right place to report (vs. e.g. Pygments)? What should I include in a bug report, just "it looks bad and could look better"?

CSS styles mismatch

I tried to update Hugo to the latest and shinies, but had to revert:

gohugoio/hugo@4f576e1

For reasons I don't fully understand, but thought I should give you a heads up:

  • You now use Pygments compatible CSS class names, which is good
  • But the style sheet created by your CLI tool does not match those, it seems ...

Wanted: YAML lexer

Unsurprisingly, the Pygments YAML lexer is very complex. This either needs to be ported with all its helpers, or a new lexer created from scratch.

[bug] Empty line appended to all output

Simple test application:

package main

import (
	"bytes"
	"fmt"

	"github.com/alecthomas/chroma/formatters/html"
	"github.com/alecthomas/chroma/lexers"
	"github.com/alecthomas/chroma/styles"
)

func main() {
	input := "hello world"

	lexer := lexers.Get("javascript")
	iterator, _ := lexer.Tokenise(nil, input)
	style := styles.Get("github")
	formatter := html.New(html.WithLineNumbers())

	var buff bytes.Buffer
	formatter.Format(&buff, style, iterator)

	fmt.Printf("[%s]", buff.Bytes())
}

Produces the following output (notice the line break; there is none in the input):

[<pre style="background-color:#fff"><span style="color:#7f7f7f;margin-right:0.4em;padding:00.4em00.4em;">1</span>hello world
<span style="color:#7f7f7f;margin-right:0.4em;padding:00.4em00.4em;">2</span></pre>
]

Expected output:

[<pre style="background-color:#fff"><span style="color:#7f7f7f;margin-right:0.4em;padding:00.4em00.4em;">1</span>hello world</pre>]

Happens with and without WithLineNumbers, but the problem is easier to see this way. Output shows that there are two lines, but there is obviously only one.

Add support for hl_lines, linenos

First, this is great and really appreciated.

I maintain Hugo and wanted to use your library. I searched the code and I assume these Pygments options are not implemented:

  • hl_lines - highlight a range of lines
  • linenos - show line numbers to the left

I understand that you cannot implement the full Pygments, but I added those two flags to Hugo as it was requested by many.

Include C# highlight

I plan to use Chroma with Hugo, which added Chrome in v0.28. But I'd need C# highlight for that. I don't see that language currently in the lexers folder of the repository. Could that language be added? Thanks.


By the way, given how busy you've been with this project I'm fine with making this a low-priority request if you decide to add it. (I'm not in a hurry.)

Thanks for your work!

Suggestion: Move the line range highlighter to the Formatter interface

In my head I would do something like this:

options := []html.Option{
		html.WithLineNumbers(),
		html.TabWidth(4)}

formatters.Register("html", html.New(options...))

Then for each highlighting (pseudo code):

s := styles.Get(style)
if range {
  s = s.Clone().AddRange(...)
}
f := formatters.Get("html")
writer, err := f.Format(w, s)
if err != nil {
	return err
}

Note that your solution works fine, but the Style interface does have a Clone method and looks like the object that it meant to change over time, while the Formatter is more or less stable. I understand that this could be problematic if only the HTML formatter supports ranges, but then you could consider a ยดClonemethod onFormatter`.

Missing elements in the auto-generated CSS

I am working to make a switch from pygmentize to chroma for my Hugo blog, but I see that the hugo gen chromastyles generated CSS is not complete.

Here is an example for the trac theme:

Pygmentize generated CSS

pygmentize -S trac -f html -a .highlight > trac_pygmentize.css

Generated CSS: trac_pygments.css [gist]

Below is the rendered HTML when using Chroma with the above pygmentize generated CSS:
image

Chroma generated CSS

hugo gen chromastyles --style=trac >! trac_chroma.css

Generated CSS: trac_chroma.css [gist]

Below is the rendered HTML when using Chroma with the above hugo+chroma generated CSS:
image


Adding .highlight to all rows in the Chroma generated CSS sort of fixes the problem.. but the colors still look different.. probably because Chroma is setting rules for fewer elements than Pygments?

Garbled output for Markdown under certain circumstances

Playing with the chroma command, I've noticed that its terminal output at least is garbled for Markdown under certain circumstances. I don't know if this is just a terminal output issue or limited to Markdown.

The following sample correctly outputs as the same textual content with highlighting:

# Headline

- foo
- foo bar

The following sample, however:

# Headline

- foo โ‚ฌโ‚ฌโ‚ฌ
- foo bar

outputs as this:

# Headline

- foo โ‚ฌโ‚ฌโ‚ฌbar

Apparently, it's the Unicode characters causing trouble. The same happens with, e.g., German umlauts. The sample file is encoded as UTF-8.

Unexpected err class added to Makefile code snippet

Please notice the second Makefile code block here:

image

I don't know why the second block has err class added to all the identifiers.

Here is the Markdown for the same:

-   **`infodir`:** Org Info installation directory. I like to keep the
    Info file for development version of Org in a separate
    directory.

    ```makefile
    infodir = $(prefix)/org/info # Default: $(prefix)/info
    ```
-   **`ORG_MAKE_DOC`:** Types of Org documentation you'd like to build by
    default.  Below enables generation of the Info and
    PDF Org manuals and the Org reference cards (in
    PDF too).

    ```makefile
    # Define below you only need info documentation, the default includes html and pdf
    ORG_MAKE_DOC = info pdf card # html
    ```

Here is the HTML:

<li><p><strong><code>infodir</code>:</strong> Org Info installation directory. I like to keep the
Info file for development version of Org in a separate
directory.</p>
<div class="highlight"><pre class="chroma"><code class="language-makefile" data-lang="makefile"><span class="nf">infodir = $(prefix)/org/info # Default</span><span class="o">:</span><span class=""> </span><span class="k">$(</span><span class="n">prefix</span><span class="k">)</span><span class="">/</span><span class="n">info</span></code></pre>
</div></li>

<li><p><strong><code>ORG_MAKE_DOC</code>:</strong> Types of Org documentation you&rsquo;d like to build by
default.  Below enables generation of the Info and
PDF Org manuals and the Org reference cards (in
PDF too).</p>
<div class="highlight"><pre class="chroma"><code class="language-makefile" data-lang="makefile"><span class="c"># Define below you only need info documentation, the default includes html and pdf
</span><span class="c"></span><span class="err">ORG_MAKE_DOC</span><span class=""> </span><span class="err">=</span><span class=""> </span><span class="err">info</span><span class=""> </span><span class="err">pdf</span><span class=""> </span><span class="err">card</span><span class=""> </span><span class="err">#</span><span class=""> </span><span class="err">html</span></code></pre>
</div></li>

This is using this commit of chroma: c99eebc

ruby snippet highlighted poorly

I came across this snippet while trying to highlight a Homebrew (brew.sh) formula. This code:

bin_path = buildpath/"src/github.com/kevinburke/hostsfile"

gets highlighted as

hostsfile

My Vim ruby syntax highlighter does the right thing; it encompasses the data in the quotes as the correct color.

Add support for linenostart

I know I'm pushing it in the feature request department, but I assume this should be easy to add.

In Pygments, the flag is called linenostart -- which when set makes the line number start at a different value than the default 1. I assume you can add it as an argument to WithLineNumbers.

List of all Chroma classes?

For my own CSS styling I'd like a list of all possible Chroma CSS classes (like .chroma .sd which is used for the 'Literal string doc' token and .chroma .nc for name class). Is there such a list?

(I'm a Hugo user and was told to ask here, but couldn't find it in the project's source code. Let me know if I'm still at the wrong place. ๐Ÿ˜„ )

fatal error: concurrent map read and map write

goroutine 348 [running]:
runtime.throw(0x1a16f5a, 0x21)
	/usr/local/go/src/runtime/panic.go:605 +0x95 fp=0xc4220c82a8 sp=0xc4220c8288 pc=0x102c4d5
runtime.mapaccess1_faststr(0x19059c0, 0xc4202bc630, 0x19ceae6, 0x4, 0x0)
	/usr/local/go/src/runtime/hashmap_fast.go:217 +0x43a fp=0xc4220c8300 sp=0xc4220c82a8 pc=0x100d5da
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*LexerState).Iterator.func1(0xc4202bfe00)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:181 +0x197 fp=0xc4220c84b0 sp=0xc4220c8300 pc=0x143b277
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*LexerState).Iterator.func1(0xc42109ccc0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:172 +0x8e fp=0xc4220c8660 sp=0xc4220c84b0 pc=0x143b16e
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*coalescer).Tokenise.func1(0xc42109cc80)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/coalesce.go:15 +0x3b fp=0xc4220c86c8 sp=0xc4220c8660 pc=0x14398eb
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.Iterator.Tokens(0xc42109c740, 0x1a6afe8, 0xc4220c87c0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/iterator.go:13 +0x5f fp=0xc4220c8740 sp=0xc4220c86c8 pc=0x14352cf
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html.(*Formatter).Format(0xc4208dcd20, 0x281a0a0, 0xc420e61650, 0xc420492720, 0xc42109c740, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html/html.go:76 +0x74 fp=0xc4220c8798 sp=0xc4220c8740 pc=0x143f3d4
github.com/gohugoio/hugo/helpers.chromaHighlight(0x281a0a0, 0xc420e61650, 0xc4215f5afd, 0xac, 0xc420094723, 0x4, 0xc4203a60c0, 0x8, 0x281a7a0, 0xc4208dcd20, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/pygments.go:226 +0x1da fp=0xc4220c8800 sp=0xc4220c8798 pc=0x1613d8a
github.com/gohugoio/hugo/helpers.highlighters.chromaHighlighter(0xc4201c0d20, 0x18cc900, 0xc420014f80, 0x3c, 0xc4215f5afd, 0xac, 0xc420094723, 0x4, 0xc420094729, 0x0, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/pygments.go:96 +0x1f9 fp=0xc4220c8920 sp=0xc4220c8800 pc=0x1612759
github.com/gohugoio/hugo/helpers.(highlighters).(github.com/gohugoio/hugo/helpers.chromaHighlighter)-fm(0xc4215f5afd, 0xac, 0xc420094723, 0x4, 0xc420094729, 0x0, 0xc421436870, 0xc4220c8a20)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/content.go:91 +0x96 fp=0xc4220c8990 sp=0xc4220c8920 pc=0x161bb86
github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight(0xc42039c250, 0x18cc9c0, 0xc421436870, 0xc420094723, 0x4, 0xc420094729, 0x0, 0x0, 0xc4220c8ac8, 0x10bcd0f, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/transform/transform.go:58 +0xe5 fp=0xc4220c89e0 sp=0xc4220c8990 pc=0x17908f5
github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight-fm(0x18cc9c0, 0xc421436870, 0xc420094723, 0x4, 0xc420094729, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/transform/init.go:39 +0x73 fp=0xc4220c8a48 sp=0xc4220c89e0 pc=0x1791bf3
runtime.call128(0xc420bf5e00, 0xc420291c70, 0xc4208dccd0, 0x3000000050)
	/usr/local/go/src/runtime/asm_amd64.s:511 +0x52 fp=0xc4220c8ad8 sp=0xc4220c8a48 pc=0x1057b52
reflect.Value.call(0x1909480, 0xc420291c70, 0x13, 0x19cd92e, 0x4, 0xc4208dcc80, 0x3, 0x3, 0x19c5840, 0x1911b01, ...)
	/usr/local/go/src/reflect/value.go:434 +0x906 fp=0xc4220c8db0 sp=0xc4220c8ad8 pc=0x10b6186
reflect.Value.Call(0x1909480, 0xc420291c70, 0x13, 0xc4208dcc80, 0x3, 0x3, 0x2824f60, 0xc4204aa1c0, 0x18cd640)
	/usr/local/go/src/reflect/value.go:302 +0xa4 fp=0xc4220c8e18 sp=0xc4220c8db0 pc=0x10b5764
text/template.(*state).evalCall(0xc4220c9600, 0x193d560, 0xc420c38780, 0x16, 0x1909480, 0xc420291c70, 0x13, 0x2824ba0, 0xc42029ba70, 0xc420094710, ...)
	/usr/local/go/src/text/template/exec.go:670 +0x580 fp=0xc4220c9050 sp=0xc4220c8e18 pc=0x119b070
text/template.(*state).evalFunction(0xc4220c9600, 0x193d560, 0xc420c38780, 0x16, 0xc42029baa0, 0x2824ba0, 0xc42029ba70, 0xc4204aa180, 0x4, 0x4, ...)
	/usr/local/go/src/text/template/exec.go:538 +0x176 fp=0xc4220c9148 sp=0xc4220c9050 pc=0x1199ae6
text/template.(*state).evalCommand(0xc4220c9600, 0x193d560, 0xc420c38780, 0x16, 0xc42029ba70, 0x0, 0x0, 0x0, 0xc4220c92e8, 0x1198ad5, ...)
	/usr/local/go/src/text/template/exec.go:435 +0x53a fp=0xc4220c91f8 sp=0xc4220c9148 pc=0x11988da
text/template.(*state).evalPipeline(0xc4220c9600, 0x193d560, 0xc420c38780, 0x16, 0xc4201f9950, 0xc42029b9e0, 0x0, 0x0)
	/usr/local/go/src/text/template/exec.go:408 +0x115 fp=0xc4220c92f0 sp=0xc4220c91f8 pc=0x1197f05
text/template.(*state).walk(0xc4220c9600, 0x193d560, 0xc420c38780, 0x16, 0x2824a20, 0xc42029bb00)
	/usr/local/go/src/text/template/exec.go:234 +0x4af fp=0xc4220c9370 sp=0xc4220c92f0 pc=0x1196c0f
text/template.(*state).walk(0xc4220c9600, 0x193d560, 0xc420c38780, 0x16, 0x2824d80, 0xc42029ba40)
	/usr/local/go/src/text/template/exec.go:242 +0x11d fp=0xc4220c93f0 sp=0xc4220c9370 pc=0x119687d
text/template.(*state).walkIfOrWith(0xc4220c9600, 0xa, 0x193d560, 0xc420c38780, 0x16, 0xc4201f9900, 0xc42029ba40, 0xc42029bb30)
	/usr/local/go/src/text/template/exec.go:272 +0x1c4 fp=0xc4220c9488 sp=0xc4220c93f0 pc=0x1196e84
text/template.(*state).walk(0xc4220c9600, 0x193d560, 0xc420c38780, 0x16, 0x2824d20, 0xc4204aa240)
	/usr/local/go/src/text/template/exec.go:239 +0x318 fp=0xc4220c9508 sp=0xc4220c9488 pc=0x1196a78
text/template.(*state).walk(0xc4220c9600, 0x193d560, 0xc420c38780, 0x16, 0x2824d80, 0xc4204a9f50)
	/usr/local/go/src/text/template/exec.go:242 +0x11d fp=0xc4220c9588 sp=0xc4220c9508 pc=0x119687d
text/template.(*Template).execute(0xc420505ec0, 0x281a0a0, 0xc420476460, 0x193d560, 0xc420c38780, 0x0, 0x0)
	/usr/local/go/src/text/template/exec.go:197 +0x1f9 fp=0xc4220c9658 sp=0xc4220c9588 pc=0x11962b9
text/template.(*Template).Execute(0xc420505ec0, 0x281a0a0, 0xc420476460, 0x193d560, 0xc420c38780, 0xc420b93580, 0x4)
	/usr/local/go/src/text/template/exec.go:180 +0x53 fp=0xc4220c96a0 sp=0xc4220c9658 pc=0x1196093
html/template.(*Template).Execute(0xc4204a9ef0, 0x281a0a0, 0xc420476460, 0x193d560, 0xc420c38780, 0xc4220c9738, 0xc420476460)
	/usr/local/go/src/html/template/template.go:122 +0x8c fp=0xc4220c96e8 sp=0xc4220c96a0 pc=0x11e364c
github.com/gohugoio/hugo/tpl.(*TemplateAdapter).Execute(0xc421436750, 0x281a0a0, 0xc420476460, 0x193d560, 0xc420c38780, 0x2caa300, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/template.go:76 +0x5b fp=0xc4220c9730 sp=0xc4220c96e8 pc=0x162d85b
github.com/gohugoio/hugo/hugolib.renderShortcodeWithPage(0x281ec60, 0xc421436750, 0xc420c38780, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:721 +0xd3 fp=0xc4220c97e8 sp=0xc4220c9730 pc=0x17e87c3
github.com/gohugoio/hugo/hugolib.renderShortcode(0xc4202ed390, 0x2, 0x19cdaaa, 0x4, 0x19ce5b6, 0x4, 0xc420d20560, 0x17, 0xc4215f5aa2, 0x4, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:340 +0x60b fp=0xc4220c9ac8 sp=0xc4220c97e8 pc=0x17e351b
github.com/gohugoio/hugo/hugolib.prepareShortcodeForPage.func1(0x19036e0, 0xc42081c840, 0xc4220c9c90, 0xc4201d3280)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:261 +0xa8 fp=0xc4220c9bc8 sp=0xc4220c9ac8 pc=0x180af78
github.com/gohugoio/hugo/hugolib.(*shortcodeHandler).executeShortcodesForDelta(0xc420b1de40, 0xc4209a6500, 0x1b, 0xc4220c9dc8)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:406 +0xd1 fp=0xc4220c9d00 sp=0xc4220c9bc8 pc=0x17e4751
github.com/gohugoio/hugo/hugolib.handleShortcodes(0xc4209a6500, 0xc42063a680, 0x558, 0x558, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:611 +0x1aa fp=0xc4220c9df8 sp=0xc4220c9d00 pc=0x17befca
github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender.func1(0xc420103180, 0xc421053690, 0xc421fe7680, 0xc42202a580)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:559 +0x233 fp=0xc4220c9fc0 sp=0xc4220c9df8 pc=0x1806d23
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc4220c9fc8 sp=0xc4220c9fc0 pc=0x105a2a1
created by github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:515 +0xd3

goroutine 1 [chan send]:
github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender(0xc420103180, 0xc421053690)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:594 +0x129
github.com/gohugoio/hugo/hugolib.(*HugoSites).render(0xc4203649c0, 0xc421053690, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:216 +0x146
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build(0xc4203649c0, 0x100, 0x0, 0x0, 0x0, 0x0, 0x1012267, 0xc4200e6b80)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:57 +0x167
github.com/gohugoio/hugo/commands.(*commandeer).buildSites(0xc4200e6b80, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/commands/hugo.go:759 +0xaf
github.com/gohugoio/hugo/commands.(*commandeer).build(0xc4200e6b80, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/commands/hugo.go:530 +0x9a
github.com/gohugoio/hugo/commands.glob..func8(0x2878560, 0x28a37a0, 0x0, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/commands/hugo.go:133 +0xad
github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).execute(0x2878560, 0xc420010180, 0x0, 0x0, 0x2878560, 0xc420010180)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:649 +0x456
github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x2878560, 0x1a6ab10, 0x19d017e, 0x5)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:728 +0x2fe
github.com/gohugoio/hugo/commands.Execute()
	/Users/bep/go/src/github.com/gohugoio/hugo/commands/hugo.go:173 +0x60
main.main()
	/Users/bep/go/src/github.com/gohugoio/hugo/main.go:27 +0x36

goroutine 349 [runnable]:
github.com/dlclark/regexp2.(*runner).initMatch(0xc420af9e00)
	/Users/bep/go/src/github.com/dlclark/regexp2/runner.go:1377 +0x415
github.com/dlclark/regexp2.(*runner).scan(0xc420af9e00, 0xc42232aa10, 0x18d, 0x1bc, 0x0, 0x0, 0x7fffffffffffffff, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/dlclark/regexp2/runner.go:136 +0x353
github.com/dlclark/regexp2.(*Regexp).run(0xc421331400, 0xc421436b00, 0xffffffffffffffff, 0xc42232aa10, 0x18d, 0x1bc, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/dlclark/regexp2/runner.go:91 +0xff
github.com/dlclark/regexp2.(*Regexp).FindRunesMatch(0xc421331400, 0xc42232aa10, 0x18d, 0x1bc, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/dlclark/regexp2/regexp.go:163 +0x57
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.matchRules(0xc42232aa10, 0x18d, 0x1bc, 0xc4202de000, 0x18, 0x20, 0x2, 0x0, 0x0, 0x0, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:281 +0x130
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*LexerState).Iterator.func1(0xc42109ce20)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:181 +0x206
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*LexerState).Iterator.func1(0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:172 +0x8e
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*coalescer).Tokenise.func1(0xc4226d19c0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/coalesce.go:15 +0x4b
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.Iterator.Tokens(0xc4226836a0, 0x1a6afe8, 0xc4220d47c0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/iterator.go:13 +0x5f
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html.(*Formatter).Format(0xc42096e320, 0x281a0a0, 0xc42217a620, 0xc420492720, 0xc4226836a0, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html/html.go:76 +0x74
github.com/gohugoio/hugo/helpers.chromaHighlight(0x281a0a0, 0xc42217a620, 0xc4201f5500, 0x300, 0xc420094723, 0x4, 0xc4203a60c0, 0x8, 0x281a7a0, 0xc42096e320, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/pygments.go:226 +0x1da
github.com/gohugoio/hugo/helpers.highlighters.chromaHighlighter(0xc4201c0d20, 0x0, 0xc420014f80, 0x3c, 0xc4201f5500, 0x300, 0xc420094723, 0x4, 0xc420094729, 0x0, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/pygments.go:96 +0x1f9
github.com/gohugoio/hugo/helpers.(highlighters).(github.com/gohugoio/hugo/helpers.chromaHighlighter)-fm(0xc4201f5500, 0x300, 0xc420094723, 0x4, 0xc420094729, 0x0, 0xc420034a80, 0x10549d0)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/content.go:91 +0x96
github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight(0xc42039c250, 0x18cc9c0, 0xc4226c6090, 0xc420094723, 0x4, 0xc420094729, 0x0, 0x101471d, 0xc42096e2f0, 0xc420094729, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/transform/transform.go:58 +0xe5
github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight-fm(0x18cc9c0, 0xc4226c6090, 0xc420094723, 0x4, 0xc420094729, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/transform/init.go:39 +0x73
reflect.Value.call(0x1909480, 0xc420291c70, 0x13, 0x19cd92e, 0x4, 0xc42096e280, 0x3, 0x3, 0x19c5840, 0x1911b01, ...)
	/usr/local/go/src/reflect/value.go:434 +0x906
reflect.Value.Call(0x1909480, 0xc420291c70, 0x13, 0xc42096e280, 0x3, 0x3, 0x2824f60, 0xc4204aa1c0, 0x18cd640)
	/usr/local/go/src/reflect/value.go:302 +0xa4
text/template.(*state).evalCall(0xc4220d5600, 0x193d560, 0xc420b48600, 0x16, 0x1909480, 0xc420291c70, 0x13, 0x2824ba0, 0xc42029ba70, 0xc420094710, ...)
	/usr/local/go/src/text/template/exec.go:670 +0x580
text/template.(*state).evalFunction(0xc4220d5600, 0x193d560, 0xc420b48600, 0x16, 0xc42029baa0, 0x2824ba0, 0xc42029ba70, 0xc4204aa180, 0x4, 0x4, ...)
	/usr/local/go/src/text/template/exec.go:538 +0x176
text/template.(*state).evalCommand(0xc4220d5600, 0x193d560, 0xc420b48600, 0x16, 0xc42029ba70, 0x0, 0x0, 0x0, 0xc4220d52e8, 0x1198ad5, ...)
	/usr/local/go/src/text/template/exec.go:435 +0x53a
text/template.(*state).evalPipeline(0xc4220d5600, 0x193d560, 0xc420b48600, 0x16, 0xc4201f9950, 0xc42029ba40, 0xc4220d5620, 0xc4220d5360)
	/usr/local/go/src/text/template/exec.go:408 +0x115
text/template.(*state).walk(0xc4220d5600, 0x193d560, 0xc420b48600, 0x16, 0x2824a20, 0xc42029bb00)
	/usr/local/go/src/text/template/exec.go:234 +0x4af
text/template.(*state).walk(0xc4220d5600, 0x193d560, 0xc420b48600, 0x16, 0x2824d80, 0xc42029ba40)
	/usr/local/go/src/text/template/exec.go:242 +0x11d
text/template.(*state).walkIfOrWith(0xc4220d5600, 0xa, 0x193d560, 0xc420b48600, 0x16, 0xc4201f9900, 0xc42029ba40, 0xc42029bb30)
	/usr/local/go/src/text/template/exec.go:272 +0x1c4
text/template.(*state).walk(0xc4220d5600, 0x193d560, 0xc420b48600, 0x16, 0x2824d20, 0xc4204aa240)
	/usr/local/go/src/text/template/exec.go:239 +0x318
text/template.(*state).walk(0xc4220d5600, 0x193d560, 0xc420b48600, 0x16, 0x2824d80, 0xc4204a9f50)
	/usr/local/go/src/text/template/exec.go:242 +0x11d
text/template.(*Template).execute(0xc420505ec0, 0x281a0a0, 0xc421e84000, 0x193d560, 0xc420b48600, 0x0, 0x0)
	/usr/local/go/src/text/template/exec.go:197 +0x1f9
text/template.(*Template).Execute(0xc420505ec0, 0x281a0a0, 0xc421e84000, 0x193d560, 0xc420b48600, 0x0, 0xc4220d5700)
	/usr/local/go/src/text/template/exec.go:180 +0x53
html/template.(*Template).Execute(0xc4204a9ef0, 0x281a0a0, 0xc421e84000, 0x193d560, 0xc420b48600, 0xc4220d5738, 0xc420d51440)
	/usr/local/go/src/html/template/template.go:122 +0x8c
github.com/gohugoio/hugo/tpl.(*TemplateAdapter).Execute(0xc422669f70, 0x281a0a0, 0xc421e84000, 0x193d560, 0xc420b48600, 0x2c69008, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/template.go:76 +0x5b
github.com/gohugoio/hugo/hugolib.renderShortcodeWithPage(0x281ec60, 0xc422669f70, 0xc420b48600, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:721 +0xd3
github.com/gohugoio/hugo/hugolib.renderShortcode(0xc4202ed390, 0x2, 0x19cdaaa, 0x4, 0x19ce5b6, 0x4, 0xc4213e5c20, 0x17, 0xc4216b0532, 0x4, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:340 +0x60b
github.com/gohugoio/hugo/hugolib.prepareShortcodeForPage.func1(0xc4220d5c90, 0xc422602200, 0xc4213e5c00, 0x17)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:261 +0xa8
github.com/gohugoio/hugo/hugolib.(*shortcodeHandler).executeShortcodesForDelta(0xc420ca9e80, 0xc420c7e000, 0x1b, 0xc4220d5dc8)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:406 +0xd1
github.com/gohugoio/hugo/hugolib.handleShortcodes(0xc420c7e000, 0xc42177a000, 0x1393, 0x1c45, 0xc422538480, 0x202, 0xc422538240, 0x202, 0x240)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:611 +0x1aa
github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender.func1(0xc420103180, 0xc421053690, 0xc421fe7680, 0xc42202a580)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:559 +0x233
created by github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:515 +0xd3

goroutine 347 [runnable]:
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html.(*Formatter).styleToCSS(0xc420ef6460, 0xc420492720, 0xc421a81160)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html/html.go:211 +0x107
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html.(*Formatter).writeHTML(0xc420ef6460, 0x281a0a0, 0xc421caf030, 0xc420492720, 0xc420ba6200, 0x1a, 0x20, 0x28a4301, 0xc42102ed30)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html/html.go:83 +0x50
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html.(*Formatter).Format(0xc420ef6460, 0x281a0a0, 0xc421caf030, 0xc420492720, 0xc420904740, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html/html.go:76 +0xbe
github.com/gohugoio/hugo/helpers.chromaHighlight(0x281a0a0, 0xc421caf030, 0xc4218d8e32, 0x8e, 0xc420094723, 0x4, 0xc4203a60c0, 0x8, 0x281a7a0, 0xc420ef6460, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/pygments.go:226 +0x1da
github.com/gohugoio/hugo/helpers.highlighters.chromaHighlighter(0xc4201c0d20, 0x18cc900, 0xc420014f80, 0x3c, 0xc4218d8e32, 0x8e, 0xc420094723, 0x4, 0xc420094729, 0x0, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/pygments.go:96 +0x1f9
github.com/gohugoio/hugo/helpers.(highlighters).(github.com/gohugoio/hugo/helpers.chromaHighlighter)-fm(0xc4218d8e32, 0x8e, 0xc420094723, 0x4, 0xc420094729, 0x0, 0xc4210b42a0, 0xc421866a20)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/content.go:91 +0x96
github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight(0xc42039c250, 0x18cc9c0, 0xc4210b42a0, 0xc420094723, 0x4, 0xc420094729, 0x0, 0x0, 0xc421866ac8, 0x10bcd0f, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/transform/transform.go:58 +0xe5
github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight-fm(0x18cc9c0, 0xc4210b42a0, 0xc420094723, 0x4, 0xc420094729, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/transform/init.go:39 +0x73
reflect.Value.call(0x1909480, 0xc420291c70, 0x13, 0x19cd92e, 0x4, 0xc420ef63c0, 0x3, 0x3, 0x19c5840, 0x1911b01, ...)
	/usr/local/go/src/reflect/value.go:434 +0x906
reflect.Value.Call(0x1909480, 0xc420291c70, 0x13, 0xc420ef63c0, 0x3, 0x3, 0x2824f60, 0xc4204aa1c0, 0x18cd640)
	/usr/local/go/src/reflect/value.go:302 +0xa4
text/template.(*state).evalCall(0xc421867600, 0x193d560, 0xc420f8b940, 0x16, 0x1909480, 0xc420291c70, 0x13, 0x2824ba0, 0xc42029ba70, 0xc420094710, ...)
	/usr/local/go/src/text/template/exec.go:670 +0x580
text/template.(*state).evalFunction(0xc421867600, 0x193d560, 0xc420f8b940, 0x16, 0xc42029baa0, 0x2824ba0, 0xc42029ba70, 0xc4204aa180, 0x4, 0x4, ...)
	/usr/local/go/src/text/template/exec.go:538 +0x176
text/template.(*state).evalCommand(0xc421867600, 0x193d560, 0xc420f8b940, 0x16, 0xc42029ba70, 0x0, 0x0, 0x0, 0xc4218672e8, 0x1198ad5, ...)
	/usr/local/go/src/text/template/exec.go:435 +0x53a
text/template.(*state).evalPipeline(0xc421867600, 0x193d560, 0xc420f8b940, 0x16, 0xc4201f9950, 0xc42029b9e0, 0x0, 0x0)
	/usr/local/go/src/text/template/exec.go:408 +0x115
text/template.(*state).walk(0xc421867600, 0x193d560, 0xc420f8b940, 0x16, 0x2824a20, 0xc42029bb00)
	/usr/local/go/src/text/template/exec.go:234 +0x4af
text/template.(*state).walk(0xc421867600, 0x193d560, 0xc420f8b940, 0x16, 0x2824d80, 0xc42029ba40)
	/usr/local/go/src/text/template/exec.go:242 +0x11d
text/template.(*state).walkIfOrWith(0xc421867600, 0xa, 0x193d560, 0xc420f8b940, 0x16, 0xc4201f9900, 0xc42029ba40, 0xc42029bb30)
	/usr/local/go/src/text/template/exec.go:272 +0x1c4
text/template.(*state).walk(0xc421867600, 0x193d560, 0xc420f8b940, 0x16, 0x2824d20, 0xc4204aa240)
	/usr/local/go/src/text/template/exec.go:239 +0x318
text/template.(*state).walk(0xc421867600, 0x193d560, 0xc420f8b940, 0x16, 0x2824d80, 0xc4204a9f50)
	/usr/local/go/src/text/template/exec.go:242 +0x11d
text/template.(*Template).execute(0xc420505ec0, 0x281a0a0, 0xc421ce83f0, 0x193d560, 0xc420f8b940, 0x0, 0x0)
	/usr/local/go/src/text/template/exec.go:197 +0x1f9
text/template.(*Template).Execute(0xc420505ec0, 0x281a0a0, 0xc421ce83f0, 0x193d560, 0xc420f8b940, 0xc4205bbc80, 0x4)
	/usr/local/go/src/text/template/exec.go:180 +0x53
html/template.(*Template).Execute(0xc4204a9ef0, 0x281a0a0, 0xc421ce83f0, 0x193d560, 0xc420f8b940, 0xc421867738, 0xc421ce83f0)
	/usr/local/go/src/html/template/template.go:122 +0x8c
github.com/gohugoio/hugo/tpl.(*TemplateAdapter).Execute(0xc421355da0, 0x281a0a0, 0xc421ce83f0, 0x193d560, 0xc420f8b940, 0x2f179a0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/template.go:76 +0x5b
github.com/gohugoio/hugo/hugolib.renderShortcodeWithPage(0x281ec60, 0xc421355da0, 0xc420f8b940, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:721 +0xd3
github.com/gohugoio/hugo/hugolib.renderShortcode(0xc4202ed390, 0x2, 0x19cdaaa, 0x4, 0x19ce5b6, 0x4, 0xc4209991c0, 0x17, 0xc4218d8e0a, 0x4, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:340 +0x60b
github.com/gohugoio/hugo/hugolib.prepareShortcodeForPage.func1(0xc421867c90, 0xc4209712f0, 0xc4209991a0, 0x17)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:261 +0xa8
github.com/gohugoio/hugo/hugolib.(*shortcodeHandler).executeShortcodesForDelta(0xc420910b00, 0xc420f82500, 0x1b, 0xc421867dc8)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:406 +0xd1
github.com/gohugoio/hugo/hugolib.handleShortcodes(0xc420f82500, 0xc4219be000, 0x3294, 0x57e1, 0xc4219b4a00, 0x4d9, 0xc4219b4000, 0x4d9, 0x500)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:611 +0x1aa
github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender.func1(0xc420103180, 0xc421053690, 0xc421fe7680, 0xc42202a580)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:559 +0x233
created by github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:515 +0xd3

goroutine 346 [runnable]:
github.com/dlclark/regexp2/syntax.CharSet.CharIn(0xc420b4a540, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28, 0x8)
	/Users/bep/go/src/github.com/dlclark/regexp2/syntax/charclass.go:226 +0x22d
github.com/dlclark/regexp2.(*runner).execute(0xc420c75600, 0x0, 0x0)
	/Users/bep/go/src/github.com/dlclark/regexp2/runner.go:600 +0xfc0
github.com/dlclark/regexp2.(*runner).scan(0xc420c75600, 0xc421f31208, 0x222, 0x23e, 0x0, 0x0, 0x7fffffffffffffff, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/dlclark/regexp2/runner.go:144 +0x1e1
github.com/dlclark/regexp2.(*Regexp).run(0xc421331400, 0xc421701e00, 0xffffffffffffffff, 0xc421f31208, 0x222, 0x23e, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/dlclark/regexp2/runner.go:91 +0xff
github.com/dlclark/regexp2.(*Regexp).FindRunesMatch(0xc421331400, 0xc421f31208, 0x222, 0x23e, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/dlclark/regexp2/regexp.go:163 +0x57
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.matchRules(0xc421f31208, 0x222, 0x23e, 0xc4202de000, 0x18, 0x20, 0x6, 0x0, 0x0, 0x0, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:281 +0x130
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*LexerState).Iterator.func1(0xc421eb2160)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:181 +0x206
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*LexerState).Iterator.func1(0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:172 +0x8e
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*coalescer).Tokenise.func1(0xc420b47700)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/coalesce.go:15 +0x4b
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.Iterator.Tokens(0xc420b5ea20, 0x1a6afe8, 0xc4218627c0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/iterator.go:13 +0x5f
github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html.(*Formatter).Format(0xc42175c910, 0x281a0a0, 0xc420fe25b0, 0xc420492720, 0xc420b5ea20, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html/html.go:76 +0x74
github.com/gohugoio/hugo/helpers.chromaHighlight(0x281a0a0, 0xc420fe25b0, 0xc42160484d, 0x361, 0xc420094723, 0x4, 0xc4203a60c0, 0x8, 0x281a7a0, 0xc42175c910, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/pygments.go:226 +0x1da
github.com/gohugoio/hugo/helpers.highlighters.chromaHighlighter(0xc4201c0d20, 0x18cc900, 0xc420014f80, 0x3c, 0xc42160484d, 0x361, 0xc420094723, 0x4, 0xc420094729, 0x0, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/pygments.go:96 +0x1f9
github.com/gohugoio/hugo/helpers.(highlighters).(github.com/gohugoio/hugo/helpers.chromaHighlighter)-fm(0xc42160484d, 0x361, 0xc420094723, 0x4, 0xc420094729, 0x0, 0xc421701900, 0xc421862a20)
	/Users/bep/go/src/github.com/gohugoio/hugo/helpers/content.go:91 +0x96
github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight(0xc42039c250, 0x18cc9c0, 0xc421701900, 0xc420094723, 0x4, 0xc420094729, 0x0, 0x0, 0xc421862ac8, 0x10bcd0f, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/transform/transform.go:58 +0xe5
github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight-fm(0x18cc9c0, 0xc421701900, 0xc420094723, 0x4, 0xc420094729, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/transform/init.go:39 +0x73
reflect.Value.call(0x1909480, 0xc420291c70, 0x13, 0x19cd92e, 0x4, 0xc42175c870, 0x3, 0x3, 0x19c5840, 0x1911b01, ...)
	/usr/local/go/src/reflect/value.go:434 +0x906
reflect.Value.Call(0x1909480, 0xc420291c70, 0x13, 0xc42175c870, 0x3, 0x3, 0x2824f60, 0xc4204aa1c0, 0x18cd640)
	/usr/local/go/src/reflect/value.go:302 +0xa4
text/template.(*state).evalCall(0xc421863600, 0x193d560, 0xc421212c80, 0x16, 0x1909480, 0xc420291c70, 0x13, 0x2824ba0, 0xc42029ba70, 0xc420094710, ...)
	/usr/local/go/src/text/template/exec.go:670 +0x580
text/template.(*state).evalFunction(0xc421863600, 0x193d560, 0xc421212c80, 0x16, 0xc42029baa0, 0x2824ba0, 0xc42029ba70, 0xc4204aa180, 0x4, 0x4, ...)
	/usr/local/go/src/text/template/exec.go:538 +0x176
text/template.(*state).evalCommand(0xc421863600, 0x193d560, 0xc421212c80, 0x16, 0xc42029ba70, 0x0, 0x0, 0x0, 0xc4218632e8, 0x1198ad5, ...)
	/usr/local/go/src/text/template/exec.go:435 +0x53a
text/template.(*state).evalPipeline(0xc421863600, 0x193d560, 0xc421212c80, 0x16, 0xc4201f9950, 0xc42029b9e0, 0x0, 0x0)
	/usr/local/go/src/text/template/exec.go:408 +0x115
text/template.(*state).walk(0xc421863600, 0x193d560, 0xc421212c80, 0x16, 0x2824a20, 0xc42029bb00)
	/usr/local/go/src/text/template/exec.go:234 +0x4af
text/template.(*state).walk(0xc421863600, 0x193d560, 0xc421212c80, 0x16, 0x2824d80, 0xc42029ba40)
	/usr/local/go/src/text/template/exec.go:242 +0x11d
text/template.(*state).walkIfOrWith(0xc421863600, 0xa, 0x193d560, 0xc421212c80, 0x16, 0xc4201f9900, 0xc42029ba40, 0xc42029bb30)
	/usr/local/go/src/text/template/exec.go:272 +0x1c4
text/template.(*state).walk(0xc421863600, 0x193d560, 0xc421212c80, 0x16, 0x2824d20, 0xc4204aa240)
	/usr/local/go/src/text/template/exec.go:239 +0x318
text/template.(*state).walk(0xc421863600, 0x193d560, 0xc421212c80, 0x16, 0x2824d80, 0xc4204a9f50)
	/usr/local/go/src/text/template/exec.go:242 +0x11d
text/template.(*Template).execute(0xc420505ec0, 0x281a0a0, 0xc420fe2540, 0x193d560, 0xc421212c80, 0x0, 0x0)
	/usr/local/go/src/text/template/exec.go:197 +0x1f9
text/template.(*Template).Execute(0xc420505ec0, 0x281a0a0, 0xc420fe2540, 0x193d560, 0xc421212c80, 0xc420b93480, 0x4)
	/usr/local/go/src/text/template/exec.go:180 +0x53
html/template.(*Template).Execute(0xc4204a9ef0, 0x281a0a0, 0xc420fe2540, 0x193d560, 0xc421212c80, 0xc421863738, 0xc420fe2540)
	/usr/local/go/src/html/template/template.go:122 +0x8c
github.com/gohugoio/hugo/tpl.(*TemplateAdapter).Execute(0xc4217017e0, 0x281a0a0, 0xc420fe2540, 0x193d560, 0xc421212c80, 0x2c6fe10, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/tpl/template.go:76 +0x5b
github.com/gohugoio/hugo/hugolib.renderShortcodeWithPage(0x281ec60, 0xc4217017e0, 0xc421212c80, 0x0, 0x0)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:721 +0xd3
github.com/gohugoio/hugo/hugolib.renderShortcode(0xc4202ed390, 0x2, 0x19cdaaa, 0x4, 0x19ce5b6, 0x4, 0xc4216e9140, 0x17, 0xc42160480a, 0x4, ...)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:340 +0x60b
github.com/gohugoio/hugo/hugolib.prepareShortcodeForPage.func1(0xc421863c90, 0xc4208d8300, 0xc4216e9120, 0x17)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:261 +0xa8
github.com/gohugoio/hugo/hugolib.(*shortcodeHandler).executeShortcodesForDelta(0xc42118ce40, 0xc42171b400, 0x1b, 0xc421863dc8)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/shortcode.go:406 +0xd1
github.com/gohugoio/hugo/hugolib.handleShortcodes(0xc42171b400, 0xc42126ea80, 0xd10, 0x29fc, 0xc4213da840, 0x28f, 0xc4213da580, 0x28f, 0x2c0)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:611 +0x1aa
github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender.func1(0xc420103180, 0xc421053690, 0xc421fe7680, 0xc42202a580)
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:559 +0x233
created by github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender
	/Users/bep/go/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:515 +0xd3

Incompatible CSS classes

I see this and similar:

<span class="ss4"></span>

Which does not match any in

pygmentize -S perldoc -f html -a .highlight > syntax.css

Add a chroma class wrapper when in "table" mode

This does not matter too much to me, and I didn't notice this in my initial testing because html.Standalone() adds the chroma class to body.

But in standalone mode, you'll get <table class="lntable"> and the CSS selectors will not match.

I cannot get HighlightLines working

image

Given the program below; I notice that the output changes when I add a line range, but I cannot see any visually different.

package main

import (
	"log"
	"os"

	"io"

	"github.com/alecthomas/chroma"
	"github.com/alecthomas/chroma/formatters"
	"github.com/alecthomas/chroma/formatters/html"
	"github.com/alecthomas/chroma/lexers"
	"github.com/alecthomas/chroma/styles"
)

func main() {

	source := `package main

import (
	"fmt"
	"log"

	"github.com/alecthomas/chroma/formatters"
	"github.com/alecthomas/chroma/formatters/html"
)

func main() {
	
	var source = "foo2"

	err := quick.Highlight(os.Stdout, source, "go", "html", "monokai")

	if err != nil {
		log.Fatal(err)
	}
}`
	out, err := os.OpenFile("/Users/bep/hl.html", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0755)
	if err != nil {
		log.Fatal(err)
	}

	options := []html.Option{
		html.Standalone(),
		html.WithLineNumbers(),
		html.HighlightLines([][2]int{[2]int{11, 16}}),
		html.TabWidth(4)}

	formatters.Register("html", html.New(options...))

	err = highlight(out, source, "go", "html", "trac")

	if err != nil {
		log.Fatal(err)
	}
}

func highlight(w io.Writer, source, lexer, formatter, style string) error {
	l := lexers.Get(lexer)
	if l == nil {
		l = lexers.Analyse(source)
	}
	if l == nil {
		l = lexers.Fallback
	}
	l = chroma.Coalesce(l)

	f := formatters.Get(formatter)
	if f == nil {
		f = formatters.Fallback
	}

	s := styles.Get(style)
	if s == nil {
		s = styles.Fallback
	}

	it, err := l.Tokenise(nil, source)
	if err != nil {
		return err
	}

	return f.Format(w, s, it)
}

Chunk-based stdin mode for the command-line

For use in languages other than Python, one of the big problems with Pygments is the startup cost of the Python interpreter. Chroma doesn't have that problem to nearly the same extent, but there is still some overhead if the Chroma command-line were to be used in a similar fashion.

One solution to this is for the command-line to have a mode where it reads chunked requests from stdin, and outputs the highlighted result to stdout.

highlighter for R language

Hi,

I'd be happy to give a whirl on adding R, but taking a look at the python script used to extract I didn't (quickly) see any doc on where to specify the language to try to extract.

Here is the relevant class info: http://pygments.org/docs/lexers/#lexers-for-the-r-s-languages

class pygments.lexers.r.SLexer
Short names: | splus, s, r
-- | --
*.S, *.R, .Rhistory, .Rprofile, .Renviron
text/S-plus, text/S, text/x-r-source, text/x-r, text/x-R, text/x-r-history, text/x-r-profile

Javascript language lexer outdated

Javascript language lexer treats ES6 keywords like class / static as reserved keywords and it is missing ES7 keywords like async / await.

Data races

hugo -s docs/
Started building sites ...
==================
WARNING: DATA RACE
Read at 0x00c04226e150 by goroutine 9:
  runtime.mapaccess1_faststr()
      C:/go/src/runtime/hashmap_fast.go:208 +0x0
  github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*LexerState).Iterator.func1()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:190 +0x395
  github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*LexerState).Iterator.func1()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:178 +0x135
  github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*coalescer).Tokenise.func1()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/coalesce.go:15 +0x56
  github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.Iterator.Tokens()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/iterator.go:13 +0x90
  github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html.(*Formatter).Format()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html/html.go:76 +0x88
  github.com/gohugoio/hugo/helpers.chromaHighlight()
      C:/GOPATH/src/github.com/gohugoio/hugo/helpers/pygments.go:206 +0x2a5
  github.com/gohugoio/hugo/helpers.highlighters.chromaHighlighter()
      C:/GOPATH/src/github.com/gohugoio/hugo/helpers/pygments.go:85 +0x231
  github.com/gohugoio/hugo/helpers.(highlighters).(github.com/gohugoio/hugo/helpers.chromaHighlighter)-fm()
      C:/GOPATH/src/github.com/gohugoio/hugo/helpers/content.go:91 +0xe4
  github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight()
      C:/GOPATH/src/github.com/gohugoio/hugo/tpl/transform/transform.go:58 +0x171
  github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight-fm()
      C:/GOPATH/src/github.com/gohugoio/hugo/tpl/transform/init.go:39 +0xa0
  runtime.call128()
      C:/go/src/runtime/asm_amd64.s:511 +0x58
  reflect.Value.Call()
      C:/go/src/reflect/value.go:302 +0xc7
  text/template.(*state).evalCall()
      C:/go/src/text/template/exec.go:670 +0x6c3
  text/template.(*state).evalFunction()
      C:/go/src/text/template/exec.go:538 +0x1e6
  text/template.(*state).evalCommand()
      C:/go/src/text/template/exec.go:435 +0x784
  text/template.(*state).evalPipeline()
      C:/go/src/text/template/exec.go:408 +0x1ac
  text/template.(*state).walk()
      C:/go/src/text/template/exec.go:234 +0x6c1
  text/template.(*state).walk()
      C:/go/src/text/template/exec.go:242 +0x27a
  text/template.(*state).walkIfOrWith()
      C:/go/src/text/template/exec.go:272 +0x1e0
  text/template.(*state).walk()
      C:/go/src/text/template/exec.go:239 +0x4be
  text/template.(*state).walk()
      C:/go/src/text/template/exec.go:242 +0x27a
  text/template.(*Template).execute()
      C:/go/src/text/template/exec.go:197 +0x400
  text/template.(*Template).Execute()
      C:/go/src/text/template/exec.go:180 +0x6b
  html/template.(*Template).Execute()
      C:/go/src/html/template/template.go:122 +0xd7
  github.com/gohugoio/hugo/tpl.(*TemplateAdapter).Execute()
      C:/GOPATH/src/github.com/gohugoio/hugo/tpl/template.go:76 +0x84
  github.com/gohugoio/hugo/hugolib.renderShortcodeWithPage()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/shortcode.go:721 +0xea
  github.com/gohugoio/hugo/hugolib.renderShortcode()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/shortcode.go:340 +0xdb3
  github.com/gohugoio/hugo/hugolib.prepareShortcodeForPage.func1()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/shortcode.go:261 +0x134
  github.com/gohugoio/hugo/hugolib.(*shortcodeHandler).executeShortcodesForDelta()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/shortcode.go:406 +0x13a
  github.com/gohugoio/hugo/hugolib.handleShortcodes()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:611 +0x44e
  github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender.func1()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:559 +0x36e
Previous write at 0x00c04226e150 by goroutine 60:
  [failed to restore the stack]
Goroutine 9 (running) created at:
  github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:515 +0x110
  github.com/gohugoio/hugo/hugolib.(*HugoSites).render()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:216 +0x1e1
  github.com/gohugoio/hugo/hugolib.(*HugoSites).Build()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:57 +0x1b4
  github.com/gohugoio/hugo/commands.(*commandeer).buildSites()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:759 +0x10d
  github.com/gohugoio/hugo/commands.(*commandeer).build()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:530 +0xba
  github.com/gohugoio/hugo/commands.glob..func8()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:133 +0xdb
  github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).execute()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:649 +0x4cf
  github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).ExecuteC()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:728 +0x412
  github.com/gohugoio/hugo/commands.Execute()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:173 +0xc0
  main.main()
      C:/GOPATH/src/github.com/gohugoio/hugo/main.go:27 +0x44
Goroutine 60 (running) created at:
  github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:515 +0x110
  github.com/gohugoio/hugo/hugolib.(*HugoSites).render()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:216 +0x1e1
  github.com/gohugoio/hugo/hugolib.(*HugoSites).Build()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:57 +0x1b4
  github.com/gohugoio/hugo/commands.(*commandeer).buildSites()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:759 +0x10d
  github.com/gohugoio/hugo/commands.(*commandeer).build()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:530 +0xba
  github.com/gohugoio/hugo/commands.glob..func8()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:133 +0xdb
  github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).execute()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:649 +0x4cf
  github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).ExecuteC()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:728 +0x412
  github.com/gohugoio/hugo/commands.Execute()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:173 +0xc0
  main.main()
      C:/GOPATH/src/github.com/gohugoio/hugo/main.go:27 +0x44
==================
==================
WARNING: DATA RACE
Read at 0x00c04225bc50 by goroutine 9:
  github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*LexerState).Iterator.func1()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:190 +0x3ae
  github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*LexerState).Iterator.func1()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/regexp.go:178 +0x135
  github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.(*coalescer).Tokenise.func1()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/coalesce.go:15 +0x56
  github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma.Iterator.Tokens()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/iterator.go:13 +0x90
  github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html.(*Formatter).Format()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/alecthomas/chroma/formatters/html/html.go:76 +0x88
  github.com/gohugoio/hugo/helpers.chromaHighlight()
      C:/GOPATH/src/github.com/gohugoio/hugo/helpers/pygments.go:206 +0x2a5
  github.com/gohugoio/hugo/helpers.highlighters.chromaHighlighter()
      C:/GOPATH/src/github.com/gohugoio/hugo/helpers/pygments.go:85 +0x231
  github.com/gohugoio/hugo/helpers.(highlighters).(github.com/gohugoio/hugo/helpers.chromaHighlighter)-fm()
      C:/GOPATH/src/github.com/gohugoio/hugo/helpers/content.go:91 +0xe4
  github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight()
      C:/GOPATH/src/github.com/gohugoio/hugo/tpl/transform/transform.go:58 +0x171
  github.com/gohugoio/hugo/tpl/transform.(*Namespace).Highlight-fm()
      C:/GOPATH/src/github.com/gohugoio/hugo/tpl/transform/init.go:39 +0xa0
  runtime.call128()
      C:/go/src/runtime/asm_amd64.s:511 +0x58
  reflect.Value.Call()
      C:/go/src/reflect/value.go:302 +0xc7
  text/template.(*state).evalCall()
      C:/go/src/text/template/exec.go:670 +0x6c3
  text/template.(*state).evalFunction()
      C:/go/src/text/template/exec.go:538 +0x1e6
  text/template.(*state).evalCommand()
      C:/go/src/text/template/exec.go:435 +0x784
  text/template.(*state).evalPipeline()
      C:/go/src/text/template/exec.go:408 +0x1ac
  text/template.(*state).walk()
      C:/go/src/text/template/exec.go:234 +0x6c1
  text/template.(*state).walk()
      C:/go/src/text/template/exec.go:242 +0x27a
  text/template.(*state).walkIfOrWith()
      C:/go/src/text/template/exec.go:272 +0x1e0
  text/template.(*state).walk()
      C:/go/src/text/template/exec.go:239 +0x4be
  text/template.(*state).walk()
      C:/go/src/text/template/exec.go:242 +0x27a
  text/template.(*Template).execute()
      C:/go/src/text/template/exec.go:197 +0x400
  text/template.(*Template).Execute()
      C:/go/src/text/template/exec.go:180 +0x6b
  html/template.(*Template).Execute()
      C:/go/src/html/template/template.go:122 +0xd7
  github.com/gohugoio/hugo/tpl.(*TemplateAdapter).Execute()
      C:/GOPATH/src/github.com/gohugoio/hugo/tpl/template.go:76 +0x84
  github.com/gohugoio/hugo/hugolib.renderShortcodeWithPage()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/shortcode.go:721 +0xea
  github.com/gohugoio/hugo/hugolib.renderShortcode()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/shortcode.go:340 +0xdb3
  github.com/gohugoio/hugo/hugolib.prepareShortcodeForPage.func1()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/shortcode.go:261 +0x134
  github.com/gohugoio/hugo/hugolib.(*shortcodeHandler).executeShortcodesForDelta()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/shortcode.go:406 +0x13a
  github.com/gohugoio/hugo/hugolib.handleShortcodes()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:611 +0x44e
  github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender.func1()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:559 +0x36e
Previous write at 0x00c04225bc50 by goroutine 60:
  [failed to restore the stack]
Goroutine 9 (running) created at:
  github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:515 +0x110
  github.com/gohugoio/hugo/hugolib.(*HugoSites).render()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:216 +0x1e1
  github.com/gohugoio/hugo/hugolib.(*HugoSites).Build()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:57 +0x1b4
  github.com/gohugoio/hugo/commands.(*commandeer).buildSites()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:759 +0x10d
  github.com/gohugoio/hugo/commands.(*commandeer).build()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:530 +0xba
  github.com/gohugoio/hugo/commands.glob..func8()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:133 +0xdb
  github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).execute()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:649 +0x4cf
  github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).ExecuteC()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:728 +0x412
  github.com/gohugoio/hugo/commands.Execute()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:173 +0xc0
  main.main()
      C:/GOPATH/src/github.com/gohugoio/hugo/main.go:27 +0x44
Goroutine 60 (running) created at:
  github.com/gohugoio/hugo/hugolib.(*Site).preparePagesForRender()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites.go:515 +0x110
  github.com/gohugoio/hugo/hugolib.(*HugoSites).render()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:216 +0x1e1
  github.com/gohugoio/hugo/hugolib.(*HugoSites).Build()
      C:/GOPATH/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:57 +0x1b4
  github.com/gohugoio/hugo/commands.(*commandeer).buildSites()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:759 +0x10d
  github.com/gohugoio/hugo/commands.(*commandeer).build()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:530 +0xba
  github.com/gohugoio/hugo/commands.glob..func8()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:133 +0xdb
  github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).execute()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:649 +0x4cf
  github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).ExecuteC()
      C:/GOPATH/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:728 +0x412
  github.com/gohugoio/hugo/commands.Execute()
      C:/GOPATH/src/github.com/gohugoio/hugo/commands/hugo.go:173 +0xc0
  main.main()
      C:/GOPATH/src/github.com/gohugoio/hugo/main.go:27 +0x44
==================

This is from building the Hugo docs with a -race enabled binary. See https://ci.appveyor.com/project/bep/hugo/build/1.0.643

Consider move terminal code to a terminal package

Right now the /formatters package contains some dependencies that drags in some unwanted dependencies if you want to, say, just format HTML. I can do without this package at the moment, but it would probably be better to just move the tty stuff to a sub package.

csharp support?

Trying to get a csharp code block highlighted.

The entire code seems to be just be styled as Text. I have assumed this is because csharp is not supported?

--html-only still prepends <style> tag to output

When I run the following command:

./chroma -l Ruby --html --html-only code.rb

The output looks something like this:

<style type="text/css">
... snip CSS...
</style>
<pre class="chroma">
... snip HTML...

Is there an option to just output the <pre> tag and its content, and I would generate the CSS separately with --html-styles?

Feature request - add support for Arduino

Linguist currently supports Arduino and provides syntax highlighting for platform specific operations and definitions.

See the Linguist Spec for Arduino here, and this example:

const int buttons[4] = {2,3,4,5};
const int octaves[2] = {6,7};

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:

  pinMode(13,OUTPUT);

 for(int i =0;i<sizeof(buttons)/sizeof(int);i++){
   pinMode(buttons[i],INPUT );
 }
 
 for(int i =0;i<sizeof(octaves)/sizeof(int);i++){
   pinMode(octaves[i],INPUT );
 }
 
  Serial.begin(9600);
}


void loop() {
  delay(1);              // wait
  int output = -1;
  
 // Serial.print(digitalRead(buttons[0]));
  
 for(int i =0;i<sizeof(buttons)/sizeof(int);i++){
   if(digitalRead(buttons[i])==LOW
   ){
     if(output<=0){
       output=1;
     }
     output+=i+1;
   }
 }
 
 for(int i =0;i<sizeof(octaves)/sizeof(int);i++){
    if(output<=0){
       break;
     }
   if(digitalRead(octaves[i])==LOW
   ){
     output*=7*(i==1 ? -1 : 1);
   }
 }
  if(output>=0){
  Serial.print(output);
  Serial.println(";");
  digitalWrite(13,HIGH);
  }else{
  digitalWrite(13,LOW);
  }
}

It would be great if chroma provided syntax highlighting like this as well.

Feature request - inline PHP

Currently it is not possible to highlight PHP code that does not start with either <?php or <?. Pygments has the option startinline to indicate this exact case. Would it be possible for chroma to support a similar feature? This is essential for PHP snippet highlighting.

I am happy to provide a PR and already had a quick look at the code. One solution might be to change the starting state in the TokeniseOptions for the Tokenise function from "root" (the default) to "php" in the client application. This inline starting rule could be a new configuration parameter in the lexer. It would not change the external API much but would still provide a relatively easy and generalized way of dealing with such cases.

Export the `classes` field

Hi ! Thanks for the awesome project !

I'm currently integrating chroma into a blackfriday markdown renderer, and there just one tiny issue with the WithClasses() functional option. I have yet no way of knowing if that option was used since the field in the html.Formatter struct isn't exposed which means I can't determine if I need or not to write the CSS.

Is there a way that field could be made public ?
Or maybe add a HasClasses() method in the Formatter interface ?

Thanks ! ๐ŸŽ‰

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.