Skip to content

Commit

Permalink
Merge pull request #595 from render-engine/fix-docs
Browse files Browse the repository at this point in the history
fix admonitions and linking
  • Loading branch information
john0isaac committed Feb 18, 2024
2 parents ad25dd9 + 8d45507 commit 8e0a6ba
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 60 deletions.
18 changes: 9 additions & 9 deletions docs/docs/archive.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<!-- markdownlint-disable MD052 -->
# Archive

Archives are a [`BasePage`](./page?id=basepage) object used to display a list of [`Page`](./page?id=page) objects in a [`Collection`](./collection?id=collection).
Archives are a [`BasePage`](../page?id=basepage) object used to display a list of [`Page`](../page?id=page) objects in a [`Collection`](../collection?id=collection).

Archive objects create a customizable page that can be controlled via its parent Collection.

Bases: [`BasePage`](./page?id=basepage)
Bases: [`BasePage`](../page?id=basepage)

The Archive is a [Page](./page?id=page) object used by the collection
The Archive is a [Page](../page?id=page) object used by the collection
that focuses on presenting the Collection's pages.

**Parameters:**

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `pages` | `list[`[`BasePage`](./page?id=basepage)`]` |The list of pages to include in the archive | _required_ |
| `pages` | `list[`[`BasePage`](../page?id=basepage)`]` |The list of pages to include in the archive | _required_ |
| `title` | `str` |The title of the archive | _required_ |
| `template` | `str \| Template` |The template to use for the archive | _required_ |
| `routes` | `list[str \|Path]` |The routes for where the archive page should be generated | _required_ |
| `archive_index` | `int` |The index of the page in the series of archive pages | `0` |
| `num_of_pages` | |The total number of pages in the series of archive pages | _required_ |

>[!WARNING] Not Directly Used
>
> The Archive object is not meant to be used directly.
> It is used by the [Collection](./collection?id=collection) object.
> Attributes can be used to customize.
> !!! Warning Not Directly Used
The Archive object is not meant to be used directly.
It is used by the [Collection](../collection?id=collection) object.
Attributes can be used to customize.

Collection.archives yields a generator of Archive objects. Each Archive object will have a `pages` attribute that is a list of Page objects referenced in that Archive Page. The number of pages is determined by the `Collection.items_per_page` attribute.

Expand Down
27 changes: 14 additions & 13 deletions docs/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,43 @@ The template can be a local path or a git repository.

### `collection-path` (`Path`: default=`"pages"`)

The path to the folder that will contain your [collections](./collection). This is where you will put your data files to be processed.
The path to the folder that will contain your [collections](../collection). This is where you will put your data files to be processed.

### `force` (`bool`: default=`False` as `no-force`)

Overwrite existing files and folders. If `no-force`, an error will be raised if **ANY** of the files already exist.

### `output-path` (`Path`: default=`"output"`)

The path to the [`output`](./site?id=output_path) directory. This is where your rendered site will be served.
The path to the [`output`](../site?id=output_path) directory. This is where your rendered site will be served.

### `project-path-name` (`Path`: default=`"app.py"`)

The name of the python file that will contain the Render Engine setup. This is where you will define your [site](./site), [pages](./page) and [collections](./collection).
The name of the python file that will contain the Render Engine setup. This is where you will define your [site](../site), [pages](../page) and [collections](../collection).

### `project-folder` (`Path`: default=`"."`)

The name of the folder that will contain your project. This is where your [`project-path-name`](#project-path-name-path-defaultapppy), [`output-path`](#output-path-path-defaultoutput), [`templates-path`](#templates-path-path-defaulttemplates), and [`collection-path`](#collection-path-path-defaultpages) will be created.

#### `site-description` (`str|None`: default=`None`)

A short description of your site. This will be passed into the [`Site`](./site) object and available in [`site_vars`](./site?id=site_vars).
A short description of your site. This will be passed into the [`Site`](../site) object and available in [`site_vars`](../site?id=site_vars).

#### `site-author` - (`str|None` default: `None`)

The author of the site. This will be passed into the [`Site`](./site) object and available in [`site_vars`](./site?id=site_vars).
The author of the site. This will be passed into the [`Site`](../site) object and available in [`site_vars`](../site?id=site_vars).

#### `skip-collection` (`bool`: default=`False` as `no-skip-collection`)

If `True`, a [`collection-path`](./collection?id=content_path) folder will not be created.
If `True`, a [`collection-path`](../collection?id=content_path) folder will not be created.

#### `skip-static` - (`bool`: default: `False` as `no-skip-static`)

If `True`, will not create the [`static`](./site?id=static_path) folder. This is where you will put your static files (images, css, js, etc).
If `True`, will not create the [`static`](../site?id=static_path) folder. This is where you will put your static files (images, css, js, etc).

#### `templates-path` (`Path`: default=`"templates"`)

The path to the folder that will contain your [`templates`](./templates). This is where you will put your Jinja2 templates.
The path to the folder that will contain your [`templates`](../templates). This is where you will put your Jinja2 templates.

## Building your site with `render-engine build`

Expand All @@ -78,8 +78,9 @@ You can also use the `--reload` flag to have the site rebuild when changes are m

Create an HTTP server to serve the site at `localhost`.

> [!WARNING]
> This is only for development purposes and should not be used in production.
> !!! Warning
This is only for development purposes and should not be used in production.

| Name | Type | Description | Default |
| --- | --- | --- | --- |
Expand All @@ -89,6 +90,6 @@ Create an HTTP server to serve the site at `localhost`.
| `directory` | `Annotated[str, Option(--directory, -d, help='Directory to serve', show_default=False)]` |Directory to serve. If `module_site`is provided, this will be the `output_path`of the site. | `None` |
| `port` | `Annotated[int, Option(--port, -p, help='Port to serve on', show_default=False)]` |Port to serve on | `8000` |

> [!NOTE]
>
> `--reload` triggers a rebuild after re-importing the site object. Certain changes will not be picked up in the rebuild and reload.
> !!! Note
`--reload` triggers a rebuild after re-importing the site object. Certain changes will not be picked up in the rebuild and reload.
10 changes: 5 additions & 5 deletions docs/docs/collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BasicCollection(Collection):

Collection pages **MUST** come from a `content_path` and all be the same content type.

`content_path` can be a string representing a path or URL, depending on the [parser](./parsers?id=basepageparser) used.
`content_path` can be a string representing a path or URL, depending on the [parser](../parsers?id=basepageparser) used.

Attributes:

Expand All @@ -45,15 +45,15 @@ archive_template str | None: The template to use for the archive pages.

`archives: typing.Generator[Archive, None, None]` `property`

Returns a [Archive](./archive) objects containing the pages from the `content_path`.
Returns a [Archive](../archive) objects containing the pages from the `content_path`.

Archives are an iterable and the individual pages are built shortly after the collection pages are built. This happens when [Site.render](./site?id=render) is called.
Archives are an iterable and the individual pages are built shortly after the collection pages are built. This happens when [Site.render](../site?id=render) is called.

## Functions

`get_page(content_path=None)`

Returns the [page](./page) Object for the specified Content Path
Returns the [page](../page) Object for the specified Content Path

`iter_content_path()`

Expand Down Expand Up @@ -96,4 +96,4 @@ You can have archives generated by setting the `has_archive` to True.
If you call `archives` from your collection and neither `has_archive` nor `items_per_page` is set, an error will be raised and an archive containing all pages will be generated.
For more information, see [Collection Archives](./archive.md).
For more information, see [Collection Archives](../archive.md).
38 changes: 19 additions & 19 deletions docs/docs/feeds.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ Feed Objects for Generating RSS Feeds

`RSSFeed`

Bases: [`BasePage`](./page?id=basepage)
Bases: [`BasePage`](../page?id=basepage)

Creates an RSS feed [Page](./page) Object.
Creates an RSS feed [Page](../page) Object.

> [!NOTE]
> This is the base object type and should only contain the params identified by the standards defined in the [RSS 2.0 Specification](http://www.rssboard.org/rss-specification).
> !!! Note
This is the base object type and should only contain the params identified by the standards defined in the [RSS 2.0 Specification](http://www.rssboard.org/rss-specification).

This is built using the built-in `rss2.0.xml` jinja template.

> [!NOTE]
> Some browsers may not support the `rss` extension. If you are having issues with your feed, try changing the extension to `xml`.
>
> ```Python
> from render_engine import Site, RSSFeed
>
> class MyFeed(RSSFeed):
> extension = "xml"
>
> site = Site()
>
> @site.collection
> class MyCollection(Collection):
> Feed = MyFeed
> ```
> !!! Note
Some browsers may not support the `rss` extension. If you are having issues with your feed, try changing the extension to `xml`.
```Python
from render_engine import Site, RSSFeed

class MyFeed(RSSFeed):
extension = "xml"
site = Site()

@site.collection
class MyCollection(Collection):
Feed = MyFeed
```
2 changes: 1 addition & 1 deletion docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ pip install render-engine

## Getting Started

Check out the [Getting Started](./getting-started/getting-started.md).
Check out the [Getting Started](../getting-started/getting-started.md).
18 changes: 9 additions & 9 deletions docs/docs/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,26 @@ Returns the URL for the page including the first route.

This gets the relative URL for a page.

> [!NOTE]
>
> Pages don't have access to the Site attrs. You cannot get an abolute URL from a Page object.
> Use `{{SITE_URL}}` in your templates to get the absolute URL.
> !!! Note
Pages don't have access to the Site attrs. You cannot get an abolute URL from a Page object.
Use `{{SITE_URL}}` in your templates to get the absolute URL.

This is the preferred way to reference a page inside of a template.

## Page

When you're creating a `Page`. You may want to provide a [`parser`](./parsers) or `content`/`content_path`. To do this, you will need to create a `Page` object.
When you're creating a `Page`. You may want to provide a [`parser`](../parsers) or `content`/`content_path`. To do this, you will need to create a `Page` object.

Bases: [`BasePage`](./page?id=basepage)
Bases: [`BasePage`](../page?id=basepage)

The general BasePage object used to make web pages.

Pages can be rendered directly from a template or generated from a file.

> [!NOTE]
>
> Not all attributes are defined by default (those that are marked optional) but will be checked for in other areas of the code.
> !!! Note
Not all attributes are defined by default (those that are marked optional) but will be checked for in other areas of the code.

When you create a page, you specify variables passed into rendering template.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/parsers.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Parsers control how content is parsed and rendered.

All [`Page`](./page?id=page) and [`Collection`](./collection?id=collection) objects have a `parser`
All [`Page`](../page?id=page) and [`Collection`](../collection?id=collection) objects have a `parser`
attribute that is used to parse the content of the object.

Parsers use [staticmethods](https://docs.python.org/3/library/functions.html#staticmethod) to parse content. This allows you to create custom parsers that can be used to parse content in any way you want. Render Engine comes with a [BasePageParser](https://github.com/render-engine/render-engine-parser) and a [MarkdownPageParser](https://github.com/render-engine/render-engine-markdown) that can be used out of the box.
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/site.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ Register multiple themes.
Render all pages and collections.

These are pages and collections that have been added to the site using
the [`Site.page`](./site?id=page)
and [`Site.collection`](./site?id=collection) methods.
the [`Site.page`](../site?id=page)
and [`Site.collection`](../site?id=collection) methods.

Render should be called after all pages and collections have been added to the site.

You can choose to call it manually in your file or
use the CLI command [`render-engine build`](./cli?id=build)
use the CLI command [`render-engine build`](../cli?id=build)

0 comments on commit 8e0a6ba

Please sign in to comment.