css - pygments + Bootstrap : highlight shell code with dark background

标签 css twitter-bootstrap twitter-bootstrap-3 pygments

我在我的小 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 文件,它看起来和我预期的一样:

hoora! pygments work

哇哦!颜料工作!现在,这是代码在我的博文中突出显示的方式:

fucked up

真可惜……这看起来很糟糕……

如果我注释掉:

<link href="/media/css/bootstrap.min.css" rel="stylesheet">

语法突出显示按预期工作:

messed up

所以,我的问题是:如何让 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/

相关文章:

javascript - select2 ruby​​ on Rails 5 不起作用

html - 使用 Bootstrap 在 div 中心水平对齐 Font Awesome 图标的最简单方法是什么?

css - 在 Bootstrap 的条纹表中更改颜色......但仅限于其中一些

html - 为什么 svg 在 Bootstrap 媒体对象中不起作用?

css - 如何使 Bootstrap 侧边栏折叠不改变内容宽度?

jquery - Bootstrap 3 折叠更改点击时的 V 形图标

html - 当页面标记为事件时悬停时,子导航无法正常工作

html - 在特定断点处配置 .container max-width - Tailwindcss

css - 如何绘制带边框的透明背景三 Angular 形?

html - 文本对齐 :center not working even after setting display:block