我在我的小 static blog generator 中通过 pygments 和 markdown 呈现代码片段我在使用 pygments 和 twitter bootstrap 时遇到了问题。
这是我的问题:
我希望使用 dark-solarized theme for pygments 突出显示代码片段.我将其下载到:
/lib/python2.7/site-packages/pygments/styles
测试按预期工作:
$ pygmentize -l python -f html -O full,style=solarized -o ./snippet.html ./test.sh
这会生成一个 html 文件,它看起来和我预期的一样:
哇哦!颜料工作!现在,这是代码在我的博文中突出显示的方式:
真可惜……这看起来很糟糕……
如果我注释掉:
<link href="/media/css/bootstrap.min.css" rel="stylesheet">
语法突出显示按预期工作:
所以,我的问题是:如何让 twitter-bootstrap 与 pygments 一起玩?
最佳答案
Override Bootstrap CSS for Pygments Syntax Highlighting :
/* fix bootstrap conflict with Pygments */
.codehilite pre { white-space: pre;
border-radius: inherit;
display: inherit;
background-color: inherit;
border: inherit;
color: inherit;
}
/* fix conflict with other sytlesheets */
.codehilite .m { margin: inherit; }
关于css - pygments + Bootstrap : highlight shell code with dark background,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34319981/