From 8da0240dbc4446c081878c87c73b2a9bf0445fa0 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 4 Jun 2024 19:46:45 -0700 Subject: [PATCH] Improve docs --- doc/fmt.css | 6 +++++- doc/index.md | 2 +- support/mkdocstrings_handlers/cxx/__init__.py | 10 ++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/fmt.css b/doc/fmt.css index 3cd92f9b..43588998 100644 --- a/doc/fmt.css +++ b/doc/fmt.css @@ -1,5 +1,5 @@ :root { - --md-primary-fg-color: #0065C9; + --md-primary-fg-color: #0050D0; } .md-grid { @@ -14,6 +14,10 @@ margin-left: 1em; } +pre > code.decl { + white-space: pre-wrap; +} + .features-container { display: flex; flex-wrap: wrap; diff --git a/doc/index.md b/doc/index.md index 4eaf5eb1..eef135b8 100644 --- a/doc/index.md +++ b/doc/index.md @@ -105,7 +105,7 @@ hide: per-call binary code. For example, a call to fmt::print with a single argument is fewer than ten x86-64 instructions, comparable to printf despite adding - runtime safety and much smaller than the equivalent iostreams code. + runtime safety, and much smaller than the equivalent iostreams code.

The library itself has small binary footprint and some components such as diff --git a/support/mkdocstrings_handlers/cxx/__init__.py b/support/mkdocstrings_handlers/cxx/__init__.py index 984314ad..7adaed34 100644 --- a/support/mkdocstrings_handlers/cxx/__init__.py +++ b/support/mkdocstrings_handlers/cxx/__init__.py @@ -105,17 +105,17 @@ def render_decl(d: Definition) -> None: text = '' if d.id is not None: text += f'\n' - text += '

'
+  text += '
'
 
   if d.template_params is not None:
     text += 'template <'
     text += ', '.join(
-      [f'{p.type} {p.name}'.rstrip() for p in d.template_params])
+      [f'{p.type} {p.name}'.rstrip() for p in d.template_params])
     text += '>\n'
 
   end = ';'
   if d.kind == 'function' or d.kind == 'variable':
-    text += d.type + ' '
+    text += d.type + ' ' if len(d.type) > 0 else ''
   elif d.kind == 'typedef':
     text += 'using '
   elif d.kind == 'define':
@@ -129,9 +129,7 @@ def render_decl(d: Definition) -> None:
       (p.type + ' ' if p.type else '') + p.name for p in d.params])
     text += '(' + escape_html(params) + ')'
     if d.trailing_return_type:
-      text += '\n ' \
-        if len(d.name) + len(params) + len(d.trailing_return_type) > 68 else ''
-      text += ' -> ' + escape_html(d.trailing_return_type)
+      text += ' -⁠> ' + escape_html(d.trailing_return_type)
   elif d.kind == 'typedef':
     text += ' = ' + escape_html(d.type)