Skip to content

Commit

Permalink
Add hard-coded styles sheet which adjusts dl style to make dd element…
Browse files Browse the repository at this point in the history
…s start on the same line as dt elements.
  • Loading branch information
Matthew Brandt committed Jan 14, 2025
1 parent 915fd77 commit 8ca3f76
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lattice/docs/extra_styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dl {
display: grid;
grid-template-columns: auto 1fr;
gap: 0.5em 1ch;
}

:is([dir="ltr"], [dir="rtl"]) .md-typeset dt {
text-align: right;
}

:is([dir="ltr"], [dir="rtl"]) .md-typeset dd {
margin: 0;
}

dl > dd > * {
/* TODO: Increase selector specificity so we don't have to use !important. */
margin: 0 !important;
}
6 changes: 6 additions & 0 deletions lattice/docs/mkdocs_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def make_config(self): # pylint: disable=missing-function-docstring
str(Path(self.logo_path).relative_to(self.content_directory_path)) if self.logo_path is not None else None
)
return {
"extra_css": ["assets/stylesheets/extra_styles.css"],
"site_name": self.title,
"site_url": self.base_url,
"site_author": self.author,
Expand Down Expand Up @@ -178,6 +179,11 @@ def make_pages(self):
if self.favicon_path is not None:
self.favicon_path = str(shutil.copy(self.favicon_path, self.assets_directory_path))

# Make stylesheets directory and copy extra_styles.css into this path.
# Nesting inside stylesheets directory allows it to live with the other Mkdocs-generated css assets.
self.style_css_dir = make_dir(Path(self.assets_directory_path, 'stylesheets'))
self.style_css_path = str(shutil.copy(Path(Path(__file__).parent.resolve(), 'extra_styles.css'), self.style_css_dir))

# Specifications
self.make_specification_pages()

Expand Down

0 comments on commit 8ca3f76

Please sign in to comment.