8000 docs: regenerate gh readme by machow · Pull Request #385 · machow/quartodoc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

docs: regenerate gh readme #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ jobs:
python -m pip install shiny shinylive
python -m pip install --no-deps dascore==0.0.8
- uses: quarto-dev/quarto-actions/setup@v2
- name: Test building starter template
run: |
make test-overview-template
- name: Build docs
run: |
make docs-build
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,7 @@ docs-build: docs-build-examples
cd docs && quarto add --no-prompt ..
quarto render docs

test-overview-template:
python scripts/build_tmp_starter.py

test-interlinks: quartodoc/tests/example_interlinks/test.md
24 changes: 16 additions & 8 deletions README.md
< 10000 td class="blob-num blob-num-expandable" colspan="2"> Expand All
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Overview


[![CI](https://github.com/machow/quartodoc/actions/workflows/ci.yml/badge.svg)](https://github.com/machow/quartodoc/actions/workflows/ci.yml)

**quartodoc** lets you quickly generate Python package API reference
Expand All @@ -11,6 +12,7 @@ Check out the below screencast for a walkthrough of creating a
documentation site, or read on for instructions.

<p align="center">

<a href="https://www.loom.com/share/fb4eb736848e470b8409ba46b514e2ed">
<img src="https://cdn.loom.com/sessions/thumbnails/fb4eb736848e470b8409ba46b514e2ed-00001.gif" width="75%">
</a>
Expand All @@ -30,16 +32,14 @@ or from GitHub
python -m pip install git+https://github.com/machow/quartodoc.git
```

<div>

> **Install Quarto**
> [!IMPORTANT]
>
> ### Install Quarto
>
> If you haven’t already, you’ll need to [install
> Quarto](https://quarto.org/docs/get-started/) before you can use
> quartodoc.

</div>

## Basic use

Getting started with quartodoc takes two steps: configuring quartodoc,
@@ -54,21 +54,29 @@ you need to add a `quartodoc` section to the top level your
`_quarto.yml` file. Below is a minimal example of a configuration that
documents the `quartodoc` package:

<!-- Starter Template -->

``` yaml
project:
type: website

# tell quarto to read the generated sidebar
metadata-files:
- _sidebar.yml
- reference/_sidebar.yml

# tell quarto to read the generated styles
format:
html:
css:
- reference/_styles-quartodoc.css

quartodoc:
# the name used to import the package you want to create reference docs for
package: quartodoc

# write sidebar data to this file
sidebar: _sidebar.yml
# write sidebar and style data
sidebar: reference/_sidebar.yml
css: reference/_styles-quartodoc.css

sections:
- title: Some functions
Expand Down
13 changes: 8 additions & 5 deletions docs/get-started/overview.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,29 @@ Getting started with quartodoc takes two steps: configuring quartodoc, then gene

You can configure quartodoc alongside the rest of your Quarto site in the [`_quarto.yml`](https://quarto.org/docs/projects/quarto-projects.html) file you are already using for Quarto. To [configure quartodoc](./basic-docs.qmd#site-configuration), you need to add a `quartodoc` section to the top level your `_quarto.yml` file. Below is a minimal example of a configuration that documents the `quartodoc` package:

<!-- Starter Template -->

```yaml
project:
type: website

# tell quarto to read the generated sidebar
metadata-files:
- api/_sidebar.yml
- reference/_sidebar.yml

# tell quarto to read the generated styles
format:
css:
- api/_styles-quartodoc.css
html:
css:
- reference/_styles-quartodoc.css

quartodoc:
# the name used to import the package you want to create reference docs for
package: quartodoc

# write sidebar and style data
sidebar: api/_sidebar.yml
css: api/_styles-quartodoc.css
sidebar: reference/_sidebar.yml
css: reference/_styles-quartodoc.css

sections:
- title: Some functions
Expand Down
32 changes: 32 additions & 0 deletions scripts/build_tmp_starter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import re
import tempfile
import subprocess
from pathlib import Path
from quartodoc.__main__ import build

p = Path("docs/get-started/overview.qmd")
overview = p.read_text()

indx = overview.index("<!-- Starter Template -->")
yml_blurb = overview[indx:]

match = re.search(r"```yaml\s*(.*?)```", yml_blurb, re.DOTALL)
if match is None:
raise Exception()

template = match.group(1)

with tempfile.TemporaryDirectory() as tmpdir:
tmpdir = Path(tmpdir)
# Write the template to a file
p_quarto = tmpdir / "_quarto.yml"
p_quarto.write_text(template)

try:
build(["--config", str(p_quarto), "--filter", "quartodoc"])
except SystemExit as e:
if e.code != 0:
raise Exception() from e
subprocess.run(["quarto", "render", str(p_quarto.parent)])

print("SITE RENDERED SUCCESSFULLY")
Loading
0