Skip to content

Commit 08fec2f

Browse files
authored
Merge pull request #577 from humanmade/701-documentation-linting-issues
Reformat and correct docs files after linting
2 parents a9b7727 + accdfdf commit 08fec2f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+3359
-2299
lines changed

docs/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Documentation
22

3-
![](./assets/banner-docs.png)
3+
![Documentation banner](./assets/banner-docs.png)
44

55
The Documentation module provides documentation for Altis.
66

7-
This module is used to generate the documentation you're currently reading, and can also be used [for your own custom project documentation](custom-documentation.md).
7+
This module is used to generate the documentation you're currently reading, and can also be
8+
used [for your own custom project documentation](custom-documentation.md).

docs/additional-doc-set.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,49 @@ const PROJECT_DOCS_SET_ID = 'project-docs';
1515

1616
// Custom user documentation Set.
1717
add_filter( 'altis.documentation.sets', static function ( array $sets ) {
18-
if ( empty( $sets[ PROJECT_DOCS_SET_ID ] ) ) {
19-
// Create our documentation set
20-
$doc_set = new Set( PROJECT_DOCS_SET_ID, 'Project Documentation' );
18+
if ( empty( $sets[ PROJECT_DOCS_SET_ID ] ) ) {
19+
// Create our documentation set
20+
$doc_set = new Set( PROJECT_DOCS_SET_ID, 'Project Documentation' );
2121

22-
// Add all documentation pages in a group.
23-
$proj_docs = dirname( __DIR__ ) . '/project-docs';
24-
$group = new Group( 'Project Guides' );
25-
Altis\Documentation\add_docs_for_group( $group, $proj_docs );
22+
// Add all documentation pages in a group.
23+
$proj_docs = dirname( __DIR__ ) . '/project-docs';
24+
$group = new Group( 'Project Guides' );
25+
Altis\Documentation\add_docs_for_group( $group, $proj_docs );
2626

27-
// Add the group to the set
28-
$doc_set->add_group( 'guides-group', $group );
29-
$doc_set->set_default_group_id( 'guides-group' );
27+
// Add the group to the set
28+
$doc_set->add_group( 'guides-group', $group );
29+
$doc_set->set_default_group_id( 'guides-group' );
3030

31-
// Add our set to the others.
32-
$sets[ PROJECT_DOCS_SET_ID ] = $doc_set;
33-
}
31+
// Add our set to the others.
32+
$sets[ PROJECT_DOCS_SET_ID ] = $doc_set;
33+
}
3434

35-
return $sets;
35+
return $sets;
3636
} );
3737

3838
```
3939

4040
If you wish to include a link to your additional documentation page under a different menu, for example a top level
41-
functional menu you can. Add a submenu page under a different menu but with the same menu id as the system uses.
41+
functional menu you can. Add a sub-menu page under a different menu but with the same menu id as the system uses.
4242

4343
```php
4444
const PROJECT_DOCS_SET_ID = 'project-docs';
4545

4646
add_action( 'admin_menu', static function () {
47-
$doc_set = \Altis\Documentation\get_documentation_set( PROJECT_DOCS_SET_ID );
48-
$page_hook = add_submenu_page(
49-
'my-custom-menu-id',
50-
$doc_set->get_title(),
51-
$doc_set->get_title(),
52-
'edit_posts',
53-
sprintf( '%s-%s', \Altis\Documentation\UI\PAGE_SLUG, PROJECT_DOCS_SET_ID ),
54-
static function () {
55-
\Altis\Documentation\UI\render_page( PROJECT_DOCS_SET_ID );
56-
} );
57-
58-
// Add custom call back to load styles and scripts.
59-
add_action( "load-$page_hook", static function () {
60-
\Altis\Documentation\UI\load_page_assets();
61-
} );
47+
$doc_set = \Altis\Documentation\get_documentation_set( PROJECT_DOCS_SET_ID );
48+
$page_hook = add_submenu_page(
49+
'my-custom-menu-id',
50+
$doc_set->get_title(),
51+
$doc_set->get_title(),
52+
'edit_posts',
53+
sprintf( '%s-%s', \Altis\Documentation\UI\PAGE_SLUG, PROJECT_DOCS_SET_ID ),
54+
static function () {
55+
\Altis\Documentation\UI\render_page( PROJECT_DOCS_SET_ID );
56+
} );
57+
58+
// Add custom call back to load styles and scripts.
59+
add_action( "load-$page_hook", static function () {
60+
\Altis\Documentation\UI\load_page_assets();
61+
} );
6262
} );
6363
```

docs/custom-documentation.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
# Custom Documentation
22

3-
The documentation module can be used for your own [custom modules](docs://getting-started/custom-modules.md), allowing you to build an internal knowledge base for your development team.
3+
The documentation module can be used for your own [custom modules](docs://getting-started/custom-modules.md), allowing you to build
4+
an internal knowledge base for your development team.
45

5-
The built-in Documentation Set is intended for developer documentation. To add your documentation to the Developer Docs set, see the information below. To add additional sets of Documentation, perhaps for the users of your system, see [Additional Documentation Sets](./additional-doc-set.md).
6+
The built-in Documentation Set is intended for developer documentation. To add your documentation to the Developer Docs set, see the
7+
information below. To add additional sets of Documentation, perhaps for the users of your system,
8+
see [Additional Documentation Sets](./additional-doc-set.md).
69

710
## Documentation Structure
811

9-
Each module provides its own documentation. The Documentation module also includes project-level documentation, such as the [Guides](docs://guides/) and [Getting Started](docs://getting-started/) documentation.
10-
11-
The Documentation module automatically takes Markdown files from a `docs/` directory within each module's root directory, and parses them into pages. These are hierarchically-structured based on the directory structure, with `README.md` acting as the index file for each directory.
12+
Each module provides its own documentation. The Documentation module also includes project-level documentation, such as
13+
the [Guides](docs://guides/) and [Getting Started](docs://getting-started/) documentation.
1214

15+
The Documentation module automatically takes Markdown files from a `docs/` directory within each module's root directory, and parses
16+
them into pages. These are hierarchically-structured based on the directory structure, with `README.md` acting as the index file for
17+
each directory.
1318

1419
## Formatting
1520

16-
Documentation files are standard Markdown, as supported by [Parsedown](https://parsedown.org/). They also support [relative and in-project links](linking.md).
21+
Documentation files are standard Markdown, as supported by [Parsedown](https://parsedown.org/). They also
22+
support [relative and in-project links](linking.md).
1723

18-
Markdown files can contain YAML front-matter, which specifies a list of "meta" information about the page itself. The following fields are supported:
24+
Markdown files can contain YAML front-matter, which specifies a list of "meta" information about the page itself. The following
25+
fields are supported:
1926

2027
```yaml
2128
---
@@ -30,18 +37,21 @@ order: 0
3037
---
3138
```
3239

33-
Headers have automatically generated fragment IDs attached for in-page linking. This automatic ID can be overridden if desired by suffixing with `{#id-name}`:
40+
Headers have automatically generated fragment IDs attached for in-page linking. This automatic ID can be overridden if desired by
41+
suffixing with `{#id-name}`:
3442

3543
```md
3644
# Header Name {#override-id}
3745
```
3846

39-
4047
## Custom Behavior
4148

42-
Internally, the Documentation module stores an ordered list of "groups", which have an ID and associated top-level pages. Each page has metadata, content, and potentially sub-pages.
49+
Internally, the Documentation module stores an ordered list of "groups", which have an ID and associated top-level pages. Each page
50+
has metadata, content, and potentially sub-pages.
4351

44-
The `altis.documentation.groups` filter is provided the ordered list of `Group` objects, and you can add or remove groups from here, or manipulate existing groups. The `Documentation\add_docs_for_group()` function may be useful for this; see `Documentation\filter_add_dev_docs_set()` to see how Altis generates developer documentation for modules.
52+
The `altis.documentation.groups` filter is provided the ordered list of `Group` objects, and you can add or remove groups from here,
53+
or manipulate existing groups. The `Documentation\add_docs_for_group()` function may be useful for this;
54+
see `Documentation\filter_add_dev_docs_set()` to see how Altis generates developer documentation for modules.
4555

4656
For example, to add your own Guides-style section:
4757

@@ -50,10 +60,10 @@ use Altis\Documentation\Group;
5060
use function Altis\Documentation\add_docs_for_group;
5161

5262
add_filter( 'altis.documentation.groups', function ( array $groups, string $set_id ) {
53-
if ( $set_id === 'dev-docs' ) {
54-
$groups['project-guides'] = new Group( 'Project Guides' );
55-
add_docs_for_group( $groups['project-guides'], __DIR__ . '/our-guides' );
56-
}
57-
return $groups;
63+
if ( $set_id === 'dev-docs' ) {
64+
$groups['project-guides'] = new Group( 'Project Guides' );
65+
add_docs_for_group( $groups['project-guides'], __DIR__ . '/our-guides' );
66+
}
67+
return $groups;
5868
} );
5969
```

docs/linking.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
22
order: 10
33
---
4+
45
# Linking
56

67
The Documentation module supports relative links and cross-linking between pages in documentation.
78

8-
99
## Relative Links
1010

11-
Within a given module's documentation, you can use relative links between files. These will be resolved during the rendering of the documentation.
11+
Within a given module's documentation, you can use relative links between files. These will be resolved during the rendering of the
12+
documentation.
1213

1314
For example, to link to a document in the same directory called `doc.md`, you can format your link as:
1415

@@ -24,17 +25,20 @@ To link to a document in a subdirectory or a parent directory, use similar relat
2425
[Document in a subdirectory](./subdir/doc.md)
2526
```
2627

27-
Note that relative links can only be used between documents in a single module, and links to other modules should instead use cross-linking.
28-
28+
Note that relative links can only be used between documents in a single module, and links to other modules should instead use
29+
cross-linking.
2930

3031
## Cross-Linking
3132

3233
Cross-linking refers to links from one module to another. This allows creating richer documentation, tying together various modules.
3334

34-
To link from one module to another, use the special URL scheme `docs://`. This should be followed by the name of the documentation group (typically the module ID), followed by a slash, followed by the page ID (typically a file path within the module's documentation directory). You can also link between Sets of documentation, for example from a developer document to a custom project guide, using an optional leading Set ID.
35+
To link from one module to another, use the special URL scheme `docs://`. This should be followed by the name of the documentation
36+
group (typically the module ID), followed by a slash, followed by the page ID (typically a file path within the module's
37+
documentation directory). You can also link between Sets of documentation, for example from a developer document to a custom project
38+
guide, using an optional leading Set ID.
3539
The full format is:
3640

37-
```
41+
```md
3842
docs://[{set}/]{group}/{id}
3943
```
4044

@@ -47,30 +51,32 @@ Consult the [branding documentation](docs://cms/branding.md)
4751
Or to link to a `block-templates.md` document in the 'Layout guide' of your project's custom documentation set.
4852

4953
```md
50-
All available [block templates](docs://project-docs/layout/block-templates.md) are listed in the [Layout guide](docs://project-docs/layout/)
54+
All available [block templates](docs://project-docs/layout/block-templates.md) are listed in
55+
the [Layout guide](docs://project-docs/layout/)
5156
```
5257

53-
**Note:** while documentation group IDs generally align with module IDs, some special groups exist for meta documentation. This includes the Getting Started (ID `getting-started`) and Guides (ID `guides`) documentation, which are located in the `other-docs` directory of the Documentation module.
54-
58+
**Note:** while documentation group IDs generally align with module IDs, some special groups exist for meta documentation. This
59+
includes the Getting Started (ID `getting-started`) and Guides (ID `guides`) documentation, which are located in the `other-docs`
60+
directory of the Documentation module.
5561

5662
## Internal Linking
5763

5864
To enable rich documentation, you can link to internal resources on the site.
5965

60-
These links use the special `internal://` URL scheme. This is followed by the type of internal link, followed by a slash, followed by an optional additional path. The following types are available:
66+
These links use the special `internal://` URL scheme. This is followed by the type of internal link, followed by a slash, followed
67+
by an optional additional path. The following types are available:
6168

62-
* `internal://home/{path}` - URL on the frontend, equivalent to `home_url( $path )`
63-
* `internal://site/{path}` - URL on the backend, equivalent to `site_url( $path )`
64-
* `internal://admin/{path}` - Page in the admin, equivalent to `admin_url( $path )`
65-
* `internal://network-admin/{path}` - Page in the network admin, equivalent to `network_admin_url( $path )`
69+
- `internal://home/{path}` - URL on the frontend, equivalent to `home_url( $path )`
70+
- `internal://site/{path}` - URL on the backend, equivalent to `site_url( $path )`
71+
- `internal://admin/{path}` - Page in the admin, equivalent to `admin_url( $path )`
72+
- `internal://network-admin/{path}` - Page in the network admin, equivalent to `network_admin_url( $path )`
6673

6774
For example, to link to the current user's profile page:
6875

6976
```md
7077
[View your profile](internal://admin/profile.php)
7178
```
7279

73-
7480
## Link to support
7581

7682
You can easily display a direct link to the Altis support ticket system, pre-filled with the current environment stack name.

0 commit comments

Comments
 (0)