jashkenas / docco

Literate Programming can be Quick and Dirty.

Home Page:http://ashkenas.com/docco/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust code loses all syntax highlighting if there is a trait declaration in there

RalfJung opened this issue · comments

An entire block of Rust code (between two comments) will lose all its syntax highlighting if there is a single trait block with a "supertrait" declaration in there. That is, even the part of the code that's correctly highlighted usually will be broken once more code is added to the end of the file. Yeah, that doesn't make much sense, but what can I say^^

The following two files demonstrate the issue:

file1.rs

fn sqr(i: i32) { i * i }

file2.rs

fn sqr(i: i32) { i * i }
trait Minimum : Copy {}

When running docco, I would expect both of these files to get rendered with syntax highlighting. The first file works as expected. The second one lacks any form of syntax highlighting, even for its first line. If I remove the " : Copy", it's all working.

I am using docco 0.7.

Hey @RalfJung thanks for the issue.

This will be an issue with our highlighting engine, highlight.js. I've had a quick search and they don't seem to know about this. I've filed an issue on your behalf, please see highlightjs/highlight.js#867