diff --git a/lattice/docs/extra_styles.css b/lattice/docs/extra_styles.css new file mode 100644 index 0000000..0bb36f7 --- /dev/null +++ b/lattice/docs/extra_styles.css @@ -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; +} diff --git a/lattice/docs/mkdocs_web.py b/lattice/docs/mkdocs_web.py index b070130..875b1f5 100644 --- a/lattice/docs/mkdocs_web.py +++ b/lattice/docs/mkdocs_web.py @@ -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, @@ -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()