mirror of
https://github.com/snachodog/just-the-docs.git
synced 2025-04-22 02:52:23 -06:00
Minor style fixes for jekyll-asciidoc (#829)
I have a site whose content is written in AsciiDoc, using the [jekyll-asciidoc][] plugin. Just the Docs works great, but there are just two minor styling glitches I've noticed: The first is that Just the Docs' CSS doesn't understand the code block markup jekyll-asciidoc produces. It's not too different though, so it's very easily fixed. The second is that jekyll-asciidoc generates `div.sect(𝑛 − 1)` elements around headings of type `h𝑛`, that enclose all the heading and all the content after it until the next heading of greater or equal rank. This means that headings are _always_ first children in AsciiDoc output, which meant the wrong margins were applied to most headings. To fix this, we need to only reduce the margin of first-child headings nested directly below the .main-content element, and headings nested directly below AsciiDoc `.sect𝑛` elements that are themselves first children. With these two small changes, my site looks perfect, and the styles look exactly the same as on Just the Docs' own documentation. [jekyll-asciidoc]: https://github.com/asciidoctor/jekyll-asciidoc
This commit is contained in:
parent
764dbb35a9
commit
3ca57e3b0d
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Base element style overrides
|
// Base element style overrides
|
||||||
//
|
//
|
||||||
// stylelint-disable selector-no-type, selector-max-type
|
// stylelint-disable selector-no-type, selector-max-type, selector-max-specificity, selector-max-id
|
||||||
|
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -45,7 +45,8 @@ h2,
|
|||||||
h3,
|
h3,
|
||||||
h4,
|
h4,
|
||||||
h5,
|
h5,
|
||||||
h6 {
|
h6,
|
||||||
|
#toctitle {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
@ -38,6 +38,9 @@ a:visited code {
|
|||||||
// > td.gutter.gl > pre.lineno
|
// > td.gutter.gl > pre.lineno
|
||||||
// | td.code > pre
|
// | td.code > pre
|
||||||
//
|
//
|
||||||
|
// ----...---- (AsciiDoc)
|
||||||
|
// div.listingblock > div.content > pre.rouge.highlight
|
||||||
|
//
|
||||||
// fix_linenos removes the outermost pre when it encloses table.rouge-table
|
// fix_linenos removes the outermost pre when it encloses table.rouge-table
|
||||||
//
|
//
|
||||||
// See docs/index-test.md for some tests.
|
// See docs/index-test.md for some tests.
|
||||||
@ -46,7 +49,8 @@ a:visited code {
|
|||||||
// Kramdown line_numbers = true: fences have a wider gutter than with Liquid?
|
// Kramdown line_numbers = true: fences have a wider gutter than with Liquid?
|
||||||
|
|
||||||
// ```[LANG]...```
|
// ```[LANG]...```
|
||||||
div.highlighter-rouge {
|
div.highlighter-rouge,
|
||||||
|
div.listingblock {
|
||||||
padding: $sp-3;
|
padding: $sp-3;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-bottom: $sp-3;
|
margin-bottom: $sp-3;
|
||||||
@ -123,6 +127,7 @@ figure.highlight {
|
|||||||
border-radius: $border-radius;
|
border-radius: $border-radius;
|
||||||
|
|
||||||
+ .highlighter-rouge,
|
+ .highlighter-rouge,
|
||||||
|
+ .sectionbody .listingblock,
|
||||||
+ figure.highlight {
|
+ figure.highlight {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: -$sp-4;
|
margin-top: -$sp-4;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
// Styles for rendered markdown in the .main-content container
|
// Styles for rendered markdown in the .main-content container
|
||||||
//
|
//
|
||||||
// stylelint-disable selector-no-type, max-nesting-depth, selector-max-compound-selectors, selector-max-type
|
// stylelint-disable selector-no-type, max-nesting-depth, selector-max-compound-selectors, selector-max-type, selector-max-specificity, selector-max-id
|
||||||
|
|
||||||
.main-content {
|
.main-content {
|
||||||
line-height: $content-line-height;
|
line-height: $content-line-height;
|
||||||
@ -204,19 +204,17 @@
|
|||||||
h3,
|
h3,
|
||||||
h4,
|
h4,
|
||||||
h5,
|
h5,
|
||||||
h6 {
|
h6,
|
||||||
|
#toctitle {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-top: 1.5em;
|
margin-top: 1.5em;
|
||||||
margin-bottom: 0.25em;
|
margin-bottom: 0.25em;
|
||||||
|
|
||||||
&:first-child {
|
|
||||||
margin-top: $sp-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ table,
|
+ table,
|
||||||
+ .table-wrapper,
|
+ .table-wrapper,
|
||||||
+ .code-example,
|
+ .code-example,
|
||||||
+ .highlighter-rouge {
|
+ .highlighter-rouge,
|
||||||
|
+ .sectionbody .listingblock {
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,4 +222,18 @@
|
|||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> h1:first-child,
|
||||||
|
> h2:first-child,
|
||||||
|
> h3:first-child,
|
||||||
|
> h4:first-child,
|
||||||
|
> h5:first-child,
|
||||||
|
> h6:first-child,
|
||||||
|
> .sect1:first-child > h2,
|
||||||
|
> .sect2:first-child > h3,
|
||||||
|
> .sect3:first-child > h4,
|
||||||
|
> .sect4:first-child > h5,
|
||||||
|
> .sect5:first-child > h6 {
|
||||||
|
margin-top: $sp-2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// Typography
|
// Typography
|
||||||
//
|
//
|
||||||
// stylelint-disable primer/selector-no-utility, primer/no-override, selector-no-type, selector-max-type
|
// stylelint-disable primer/selector-no-utility, primer/no-override, selector-no-type, selector-max-type, selector-max-specificity, selector-max-id
|
||||||
|
|
||||||
h1,
|
h1,
|
||||||
.text-alpha {
|
.text-alpha {
|
||||||
@ -10,7 +10,8 @@ h1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
h2,
|
h2,
|
||||||
.text-beta {
|
.text-beta,
|
||||||
|
#toctitle {
|
||||||
@include fs-6;
|
@include fs-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user