Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Floating gutter #6

Open
neocotic opened this issue May 25, 2011 · 1 comment
Open

Floating gutter #6

neocotic opened this issue May 25, 2011 · 1 comment

Comments

@neocotic
Copy link

It would be nice to see the gutter floating on the left of the page so that it's visible even if/when you scroll horizontally.

I have no suggestions how this could be done just now but it would definitely be a nice feature. However, I have done a little investigation and saw that this may not be so simple as the gutter itself is a table column and one that is generated within shCore.js so might involve a feature request for the SyntaxHighlighter project.

I've experimented a little bit in case you wanted to implement this yourself (if at all) and found that the following CSS change works well but requires some JavaScript changes too;

shCore.css

.syntaxhighlighter table {
  table-layout: fixed !important; /* Ensures content is kept within page width (incl. scroll bars) */
}
.syntaxhighlighter table td.code .container {
  overflow: auto !important; /* Ensures scroll bar is displayed only when needed */
  padding-bottom: 1px !important; /* Stops hanging letters being clipped by scroll bar (may need increased) */
}

Unfortunately, the downside of this is that some JavaScript will need to be called after content_script.js:64 as well as any time the window is resized. This JavaScript will be responsible for ensuring .syntaxhighlighter table td.gutter has width: Npx !important where N is equal to the width of its last child div. Otherwise, the gutter won't appear at all as table-layout: fixed calculates the layout based on the column widths and not that of their contents. How this script looks I'll leave up to you.

@ajmath
Copy link
Owner

ajmath commented Dec 5, 2012

I agree that this would be a cool feature. I can't really commit to working on it right now though. Please feel free to submit a pull request if you get the urge to try and make it happen

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

No branches or pull requests

2 participants