Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pelican-bootstrap3: improve compatiblity with pygments.css #172

Open
nikipore opened this issue Nov 22, 2013 · 4 comments
Open

pelican-bootstrap3: improve compatiblity with pygments.css #172

nikipore opened this issue Nov 22, 2013 · 4 comments

Comments

@nikipore
Copy link
Contributor

It would be great if one could apply a new pygments style to pelican-bootstrap3 by simply replacing pygments.css.

At present, one has to copy the .highlight directive for color and background-color of pygments.css over to a .highlight pre directive in style.css in order to override the pre directive of bootstrap.min.css in order to arrive at the proper pygments style.

I am not a CSS guru, but if someone would give me a hint how a proper solution in CSS would look like I would be happy to contribute a patch.

@DonDebonair
Copy link
Contributor

The problem does not lie with pelican-bootstrap3. The pygments.css file is explicitly included after bootstrap.min.css, so any rules present in both will be overridden by pygments.css. The problem I'm seeing, is that the CSS files generated by Pygments, don't include a directive for the background-color of the whole pre section. The only background-color I'm seeing is (with the Pygments theme I chose): .hll { background-color: #49483e }. So somehow, Bootstrap's pre rule takes precedence there.
Maybe it's a problem with the way Pelican calls pygmentize, and the way the HTML is generated for the codeblocks, or the problem is with the generated CSS files.

The only solution for now, is to include a rule .highlight pre in style.css.

@nikipore
Copy link
Contributor Author

I was just wondering whether there is a generic way to clear bootstrap's pre directive. In a dynamic language one would call this "monkey-patching". If one cannot achieve this with CSS, HTML, or JavaScript, I'll stay with my current workaround to fix it by removing the pre upstream in the bootstrap LESS code.

BTW: depending on the Pygments style, there are more background-color rules. I haven't found any way yet either to call pygments in a way to work around the pre collision.

@bdrewery
Copy link

Note that the hll is for highlighted lines, not all lines.

This works for me with bootstrap (my code is classed as 'codehilight'):

.codehilite pre {
  color: inherit;
  background: inherit;
  background-color: inherit;
  font-style: inherit;
  text-decoration: inherit;
  font-weight: inherit;
}

@DonDebonair
Copy link
Contributor

That doesn't actually solve the aforementioned problem. Somehow, the CSS that Pygments outputs by default, isn't specific enough, so you'll end up with the background color as defined by your Bootswatch theme or Bootstrap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants