diff --git a/src/components/Layout/LayoutStyles.js b/src/components/Layout/LayoutStyles.js index 597caf24..32be2483 100644 --- a/src/components/Layout/LayoutStyles.js +++ b/src/components/Layout/LayoutStyles.js @@ -57,15 +57,9 @@ const standardLayout = css` } details { - margin-bottom: 1rem; - & summary { cursor: pointer; } - - &:last-of-type { - margin-bottom: 2rem; - } } blockquote { diff --git a/src/components/Layout/MainStyles.js b/src/components/Layout/MainStyles.js index 384c6dbc..b27db7fa 100644 --- a/src/components/Layout/MainStyles.js +++ b/src/components/Layout/MainStyles.js @@ -62,14 +62,11 @@ html body { } ul, ol { - padding-left: 3rem; - + padding-left: 1.5rem; + padding-top: 0.5rem; li { margin-bottom: 0.5rem; } - li:first-of-type { - margin-top: 0.5rem; - } } h1, h2, h3, h4, h5, h6 { @@ -136,5 +133,9 @@ html body { text-decoration: underline; } } + + summary::before { + margin-right: 0.5rem; + } } `; diff --git a/src/components/Layout/MarkdownStyles.js b/src/components/Layout/MarkdownStyles.js index a667f893..1a833471 100644 --- a/src/components/Layout/MarkdownStyles.js +++ b/src/components/Layout/MarkdownStyles.js @@ -29,10 +29,37 @@ export const MarkdownStyles = createGlobalStyle` text-decoration: underline; } } + code { + font-size: 80%; + } a, code, strong { white-space: pre-wrap; word-break: break-word; word-wrap: break-word; } + li > details { + display: block; + } + summary { + cursor: pointer; + user-select: none; + list-style: none; + display: block; + &::marker, + &::-webkit-details-marker { + display: none; + } + &::before { + content: '▶ '; + display: inline; + font-size: 0.75em; + transition: transform 0.15s ease; + display: inline-block; + width: 1em; + } + } + details[open] > summary::before { + transform: rotate(90deg); + } } `; diff --git a/src/helpers/rehypeWrapFirstList.ts b/src/helpers/rehypeWrapFirstList.ts new file mode 100644 index 00000000..fcb5a532 --- /dev/null +++ b/src/helpers/rehypeWrapFirstList.ts @@ -0,0 +1,57 @@ +import { visit } from "unist-util-visit"; +import type { Root, Element, ElementContent } from "hast"; + +/** + * Rehype plugin that makes nested list items individually collapsible. + * For each
  • that contains a nested