123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- /**
- * Styling for textbook pages. Jupyter notebooks generate their own HTML markup
- * which we style under the #ipython-notebook selector.
- *
- * Most of the textbook content is styled using this component.
- *
- * [1]: Within-textbook__page layout
- * [2]: Since we use JS to focus the page on load, hide the outline to avoid
- * visual cruft.
- *
- * Notebook styling:
- *
- * [4]: Some tables are too wide for the page on smaller screens so we let the
- * user scroll horizontally.
- * [5]: Inline code snippets (usually variable names) should have a gray bg.
- */
- /**
- * [1] Within-textbook__page layout
- */
- div.jb_cell {
- width: 100%;
- position: relative;
- @include mq($from: laptop) {
- width: $textbook-page-with-sidebar-width;
- }
- // Add some empty space before headers for anchor links
- h1, h2, h3, h4, h5 {
- &:before {
- display: block;
- content: " ";
- margin-top: -80px;
- height: 80px;
- visibility: hidden;
- pointer-events: none;
- }
- }
- }
- #page-title {
- font-size: 4em;
- font-weight: lighter;
- line-height: 1em;
- }
- #page-author {
- font-size: 1.75em;
- margin-bottom: 20px;
- padding-left: 5px;
- }
- // Right margin
- div.jb_cell {
- &.tag_popout {
- .cell {
- border-left: 3px solid #c3c3c3;
- padding-left: 5%
- }
- // On laptops, pop out to the right instead of in-line
- @include mq($from: laptop) {
- width: calc(100% - #{$textbook-page-with-sidebar-width});
- font-size: .8em;
- position: relative;
- float: right;
- padding-left: $spacing-unit-large * .8;
- clear: both;
- h1, h2, h3, h4, h5, h6 {
- margin: .5em 0px 0px 0px;
- }
- // This prevents *sequential* popouts from creating a bunch of white-space when stacked
- & + div.tag_popout {
- height: 0px;
- }
- // Remove the border when we pop-out to the right
- .cell {
- border-left: none;
- padding-left: 0;
- }
- }
- }
- &.tag_full_width {
- width: 100%;
- img {
- max-width: 100%;
- }
- }
- }
- /**
- * Jupyter notebook styling
- */
- div.highlighter-rouge {
- // Ensures that items within this div can be positioned absolutely
- position: relative;
- }
- div.inner_cell div.highlight > pre,
- div.highlighter-rouge > div.highlight > pre,
- div.output_wrapper pre {
- background-color: $color-light-gray;
- font-size: 0.9em;
- margin-bottom: $spacing-unit-small;
- padding: $spacing-unit-small;
- overflow-x: auto;
- border: 1px solid $color-dark-gray;
- }
- // If we've got intentionally non-highlighted markup, make sure that the lines wrap
- pre code.language-no-highlight {
- white-space: pre-wrap;
- }
- div.output_wrapper {
- margin-bottom: $spacing-unit-small;
- }
- div.output_wrapper pre {
- border: 1px solid $color-light-gray !important;
- background-color: #fcfcfc !important;
- }
- .output_html {
- /* [4] */
- overflow-x: auto;
- }
- /* [5] */
- code {
- padding: 4px;
- overflow-x: auto;
- @include inuit-font-size(14px);
- }
- pre.highlight code {
- display: block;
- }
- /* Outputs */
- .output_stream,
- .output_data_text,
- .output_traceback_line {
- margin-left: 2% !important;
- border: none !important;
- border-radius: 4px !important;
- background-color: #fafafa !important;
- box-shadow: none !important;
- }
- .output_stream:before,
- .output_data_text:before,
- .output_traceback_line:before {
- content: none !important;
- }
- .output_text pre {
- background-color: #f8f8fb !important;
- }
- .output_html,
- .output_png::before {
- padding: 1em 1.5em !important;
- }
- .output_png img,
- p img {
- max-width: 500px;
- display: block;
- margin-left: auto;
- margin-right: auto;
- }
- .output_png img {
- width: 100% !important;
- }
- .hl-ipython3 pre::before,
- .output_subarea pre::before,
- .output_html::before,
- .output_png::before {
- color: #ccc !important;
- float: left !important;
- margin-bottom: 0.25em !important;
- width: 100% !important;
- }
- /**
- * nbinteract styling
- */
- .cell.nbinteract-left {
- width: 50%;
- float: left;
- }
- .cell.nbinteract-right {
- width: 50%;
- float: right;
- }
- .cell.nbinteract-hide_in > .input {
- display: none;
- }
- .cell.nbinteract-hide_out > .output_wrapper {
- display: none;
- }
- .cell:after {
- content: '';
- display: table;
- clear: both;
- }
- div.output_subarea {
- max-width: initial;
- }
- .jp-OutputPrompt {
- display: none;
- }
- // Quotation cells
- // Default
- blockquote {
- margin: $spacing-unit-small;
- border-left: 4px solid $color-dark-gray;
- padding: $spacing-unit-tiny $spacing-unit-med;
- p {
- margin-bottom: $spacing-unit-small;
- }
- ul, ol {
- margin-bottom: $spacing-unit-tiny;
- }
- // This should only trigger if the last child of a blockquote is an ul/ol
- > :last-child li {
- text-align: right;
- list-style-type: none;
- margin: none;
- padding-right: 5%;
- &:before {
- content: "—";
- padding-right: 10px;
- }
- }
- }
- // Epigraph adds new styling
- div.jb_cell.tag_epigraph blockquote {
- font-style: italic;
- font-size: 1.2em;
- width: 90%;
- margin-left: auto;
- margin-right: auto;
- border-left: none;
- ul {
- font-style: normal;
- }
- }
|