1
0
mirror of synced 2025-12-19 09:57:42 -05:00

Document and fix indented data refs (#38806)

This commit is contained in:
Hector Alfaro
2023-07-10 12:21:27 -04:00
committed by GitHub
parent 6eee2ba75e
commit eb716827bf
4 changed files with 29 additions and 15 deletions

View File

@@ -143,7 +143,7 @@ other custom queries. For example, `custom-queries/java/queries/EmptyThen.ql`.
1. Create a {% data variables.product.prodname_codeql %} pack for your Java tests by adding a `qlpack.yml` file with the following contents to `custom-queries/java/tests`, updating the `dependencies` to match the name of your {% data variables.product.prodname_codeql %} pack of custom queries:
{% data reusables.codeql-cli.test-qlpack %}
{% indented_data_reference reusables.codeql-cli.test-qlpack spaces=2 %}
1. Run `codeql pack install` in the root of the test directory. This generates a `codeql-pack.lock.yml` file that specifies all of the transitive dependencies required to run queries in this pack.
@@ -166,7 +166,7 @@ which is declared as a dependency for `my-query-tests`. Therefore, `EmptyThen.ql
System.out.println("Empty argument");
}
}
public void good(String arg) {
if (arg.isEmpty()) {
System.out.println("Empty argument");

View File

@@ -137,6 +137,8 @@ In YAML examples, such as actions and workflow files, use two spaces to indent l
python-version: {% raw %}${{ matrix.python }}{% endraw %}
```
To indent reusables, see [`data/reusables/README.md`](/data/reusables/README.md).
### Scheduled workflows
Workflow runs are delayed when too many workflows run at once. Since many users copy code from the GitHub docs, we should use examples that guide users away from congested times.
@@ -151,7 +153,7 @@ Use italics to emphasize words or parts of a sentence. Use emphasis sparingly fo
- **Use:** _Fine-grained personal access tokens_ have several security advantages over personal access tokens (classic).
- **Use:** _For types of packages other than containers_, to the right of the package version click **Delete**.
- **Avoid:** Next to _**Title**_, add a descriptive label for your new key.
- **Avoid:** Next to _**Title**_, add a descriptive label for your new key.
## Footnotes
@@ -893,7 +895,7 @@ For example, in "[Autoscaling with self hosted runners](https://docs.github.com/
### Use proper markup for row and column headers
Tables in which the first column describes the data values in the table (but is not data itself) need to be marked up with row headers. This is important for assistive technology to understand relationships between cells.
Tables in which the first column describes the data values in the table (but is not data itself) need to be marked up with row headers. This is important for assistive technology to understand relationships between cells.
For example in the following table, in order to make sense of the "Yes" and "No" values in the table, you need to know both the column header (role) and row header (permission).
@@ -955,11 +957,11 @@ See "[Footnotes](https://github.com/github/docs/blob/main/contributing/content-s
### Align table content consistently
All columns in a table should be left-aligned, except for columns containing only octicons which should be center-aligned. If a column contains both text and octicons, use center alignment.
All columns in a table should be left-aligned, except for columns containing only octicons which should be center-aligned. If a column contains both text and octicons, use center alignment.
Table content is left-aligned by default. Use Markdown table formatting, colons (`:`) to either the right or left of the dashes in the header row, to specify the alignment of each column. Read "[Organizing information with tables](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables#formatting-content-within-your-table)" for more information.
The following example shows part of a table from "[Configuration options for the dependabot.yml file](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file)".
The following example shows part of a table from "[Configuration options for the dependabot.yml file](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file)".
<table>
@@ -994,7 +996,7 @@ The following example shows part of a table from "[Configuration options for the
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/github/docs-internal/assets/12902836/fd97adaf-5ac5-4da0-9de1-89d70f0edc45">
<source media="(prefers-color-scheme: light)" srcset="https://github.com/github/docs-internal/assets/12902836/6e531ef9-275b-4630-8217-3a2399e450bf">
<img alt="Supported">
</picture>
</picture>
</td>
<td align=left>Package manager to use</td>
</tr>
@@ -1005,8 +1007,8 @@ The following example shows part of a table from "[Configuration options for the
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/github/docs-internal/assets/12902836/fd97adaf-5ac5-4da0-9de1-89d70f0edc45">
<source media="(prefers-color-scheme: light)" srcset="https://github.com/github/docs-internal/assets/12902836/6e531ef9-275b-4630-8217-3a2399e450bf">
<img alt="Supported">
</picture>
</td>
</picture>
</td>
</td>
<td align=center>
<picture>
@@ -1032,7 +1034,7 @@ The following example shows part of a table from "[Configuration options for the
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/github/docs-internal/assets/12902836/fd97adaf-5ac5-4da0-9de1-89d70f0edc45">
<source media="(prefers-color-scheme: light)" srcset="https://github.com/github/docs-internal/assets/12902836/6e531ef9-275b-4630-8217-3a2399e450bf">
<img alt="Supported">
</picture>
</picture>
</td>
</td>
<td align=center>

View File

@@ -12,6 +12,18 @@ For example, a file named `/data/reusables/foo/bar.md` will be accessible as `{%
Reusable files are divided generally into directories by task. For example, if you're creating a reusable string for articles about GitHub notifications, you'd add it in the directory `data/reusables/notifications/` in a file named `data/reusables/notifications/your-reusable-name.md`. The content reference you'd add to the source would look like `{% data reusables.notifications.your-reusable-name %}`.
## Indenting
Indented reusables require a special liquid tag: `indented_data_reference` which also requires the number of spaces to indent as an argument.
For example, to indent `/data/reusables/foo/bar.md` in an ordered list, you could:
```md
1. My first list item
{% indented_data_reference reusables.foo.par spaces=2 %}
1. My second list item
```
## Versioning
Reusables can include Liquid conditionals to conditionally render content depending on the current version being viewed. See [contributing/liquid-helpers.md](/contributing/liquid-helpers.md).

View File

@@ -1,9 +1,9 @@
The following `qlpack.yml` file states that `my-github-user/my-query-tests` depends on `my-github-user/my-custom-queries` at a version greater than or equal to 1.2.3 and less than 2.0.0. It also declares that the CLI should use the Java `extractor` when creating test databases. The `tests: .` line declares that all `.ql` files in the pack should be run as tests when `codeql test run` is run with the `--strict-test-discovery` option. Typically, test packs do not contain a `version` property. This prevents you from accidentally publishing them.
```yaml
name: my-github-user/my-query-tests
dependencies:
my-github-user/my-custom-queries: ^1.2.3
extractor: java
tests: .
name: my-github-user/my-query-tests
dependencies:
my-github-user/my-custom-queries: ^1.2.3
extractor: java
tests: .
```