Handle empty spans generated by newer Pygments
This commit is contained in:
parent
a7d68d87ca
commit
fd5e6d9ef6
@ -77,9 +77,11 @@ func cachedPygmentize(lex string, src string) string {
|
|||||||
return string(cacheBytes)
|
return string(cacheBytes)
|
||||||
}
|
}
|
||||||
renderBytes := pipe(pygmentizeBin, arg, src)
|
renderBytes := pipe(pygmentizeBin, arg, src)
|
||||||
writeErr := ioutil.WriteFile(cachePath, renderBytes, 0600)
|
// Newer versions of Pygments add silly empty spans.
|
||||||
|
renderCleanString := strings.Replace(string(renderBytes), "<span></span>", "", -1)
|
||||||
|
writeErr := ioutil.WriteFile(cachePath, []byte(renderCleanString), 0600)
|
||||||
check(writeErr)
|
check(writeErr)
|
||||||
return string(renderBytes)
|
return renderCleanString
|
||||||
}
|
}
|
||||||
|
|
||||||
func markdown(src string) string {
|
func markdown(src string) string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user