Skip to content

Commit

Permalink
De-boost reference docs; add search gadgets (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
brynpickering authored Sep 6, 2024
1 parent 3cd8caf commit 389e9f2
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### User-facing changes

|changed| API/schema documentation is de-ranked in documentation search bar results (#670).

|new| Math component cross-references in both directions ("uses" and "used in") in Markdown math documentation (#643).

|fixed| Duplicated links in math documentation (#651).
Expand Down
12 changes: 11 additions & 1 deletion docs/hooks/generate_readable_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""

import tempfile
import textwrap
from pathlib import Path

import jsonschema2md
Expand Down Expand Up @@ -55,7 +56,16 @@ def _schema_to_md(schema: dict, filename: str, config: dict) -> File:
assert lines[2] == "## Properties\n\n"
del lines[2]

output_full_filepath.write_text("\n".join(lines))
initial_lines = textwrap.dedent(
"""
---
search:
boost: 0.25
---
"""
)
output_full_filepath.write_text(initial_lines.lstrip() + "\n".join(lines))

return File(
path=output_file,
Expand Down
7 changes: 6 additions & 1 deletion docs/reference/api/attrdict.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
::: calliope.attrdict.AttrDict
---
search:
boost: 0.5
---

::: calliope.attrdict.AttrDict
7 changes: 6 additions & 1 deletion docs/reference/api/backend_model.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
::: calliope.backend.backend_model.BackendModel
---
search:
boost: 0.5
---

::: calliope.backend.backend_model.BackendModel
7 changes: 6 additions & 1 deletion docs/reference/api/example_models.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
::: calliope.examples
---
search:
boost: 0.5
---

::: calliope.examples
7 changes: 6 additions & 1 deletion docs/reference/api/exceptions.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
::: calliope.exceptions
---
search:
boost: 0.5
---

::: calliope.exceptions
7 changes: 6 additions & 1 deletion docs/reference/api/helper_functions.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
::: calliope.backend.helper_functions
---
search:
boost: 0.5
---

::: calliope.backend.helper_functions
7 changes: 6 additions & 1 deletion docs/reference/api/logging.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
::: calliope.util.logging
---
search:
boost: 0.5
---

::: calliope.util.logging
7 changes: 6 additions & 1 deletion docs/reference/api/model.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
::: calliope.Model
---
search:
boost: 0.5
---

::: calliope.Model
7 changes: 6 additions & 1 deletion docs/reference/api/schema.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
::: calliope.util.schema
---
search:
boost: 0.5
---

::: calliope.util.schema
5 changes: 5 additions & 0 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
search:
boost: 0.5
---

# CLI Reference

This page provides documentation for the `calliope` command line tool.
Expand Down
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ theme:
- navigation.top
- content.code.copy
- content.code.annotate
- search.suggest
- search.highlight
- search.share
logo: img/logo-bw.png
favicon: img/favicon.ico
extra_css:
Expand Down

0 comments on commit 389e9f2

Please sign in to comment.