Skip to content

Commit d80eb2f

Browse files
authored
Add code callouts attribute and replace code-callout shortcodes (#7069)
* feat(layouts): add callout and callout-color code fence attributes Support highlighting code in code blocks via fence attributes instead of the code-callout shortcode. Defaults to green when callout-color is omitted. Works alongside placeholders on the same code block. * docs: update code callouts docs with fence attribute syntax Document the new callout and callout-color code fence attributes as the preferred approach. Move the shortcode syntax to a backward-compatibility note. * feat(callouts): add new callout attribute, replace and remove code-callout shortcode
1 parent 30f2c60 commit d80eb2f

File tree

36 files changed

+146
-331
lines changed

36 files changed

+146
-331
lines changed

DOCS-SHORTCODES.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Use the `{{< api-endpoint >}}` shortcode to generate a code block that contains
146146
- **method**: HTTP request method (get, post, patch, put, or delete)
147147
- **endpoint**: API endpoint
148148
- **api-ref**: Link the endpoint to a specific place in the API documentation
149-
- **influxdb_host**: Specify which InfluxDB product host to use *if the `endpoint` contains the `influxdb/host` shortcode*. Uses the current InfluxDB product as default. Supports the following product values:
149+
- **influxdb\_host**: Specify which InfluxDB product host to use *if the `endpoint` contains the `influxdb/host` shortcode*. Uses the current InfluxDB product as default. Supports the following product values:
150150
- oss
151151
- cloud
152152
- serverless
@@ -737,16 +737,32 @@ InfluxDB 3 Enterprise and InfluxDB 3 Core support different kinds of tokens. The
737737

738738
### Code callouts
739739

740-
Use the `{{< code-callout >}}` shortcode to highlight and emphasize a specific piece of code (for example, a variable, placeholder, or value) in a code block. Provide the string to highlight in the code block. Include a syntax for the codeblock to properly style the called out code.
740+
Use the `callout` code fence attribute to highlight and emphasize specific code (for example, a variable, placeholder, or value) in a code block.
741+
Provide a regular expression pattern to match the text to highlight.
742+
Use the optional `callout-color` attribute to specify the highlight color (defaults to `green`).
741743

742-
````md
743-
{{< code-callout "03a2bbf46249a000" >}}
744+
**Available colors:** `green` (default), `magenta`, `orange`, `delete`/`strike`
744745

745-
```sh
746+
````md
747+
```sh { callout="03a2bbf46249a000" }
746748
http://localhost:8086/orgs/03a2bbf46249a000/...
747749
```
750+
````
751+
752+
With an explicit color:
753+
754+
````md
755+
```sh { callout="--host" callout-color="orange" }
756+
influx query --host http://localhost:8086
757+
```
758+
````
748759

749-
{{< /code-callout >}}
760+
You can use both `callout` and `placeholders` attributes on the same code block:
761+
762+
````md
763+
```sh { placeholders="DATABASE_NAME" callout="--host" callout-color="magenta" }
764+
influx query --host http://localhost:8086 --database DATABASE_NAME
765+
```
750766
````
751767

752768
### Placeholders in code samples

content/influxdb/cloud/admin/organizations/view-orgs.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ Use the InfluxDB UI or `influx` CLI to view your organization ID.
3535

3636
After logging in to the InfluxDB UI, your organization ID appears in the URL.
3737

38-
{{< code-callout "03a2bbf46249a000" >}}
39-
```sh
38+
```sh { callout="03a2bbf46249a000" }
4039
https://cloud2.influxdata.com/orgs/03a2bbf46249a000/...
4140
```
42-
{{< /code-callout >}}
4341

4442
### Organization ID in the CLI
4543

content/influxdb/cloud/reference/regions.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,16 @@ Use the URLs below to interact with your InfluxDB Cloud instances with the
2020

2121
<a href="https://www.influxdata.com/influxdb-cloud-2-0-provider-region/" target="_blank" class="btn">Request a cloud region</a>
2222

23-
{{% note %}}
24-
#### Regions with multiple clusters
25-
26-
Some InfluxDB Cloud regions have multiple Cloud clusters, each with a unique URL.
27-
To find your cluster URL, [log in to your InfluxDB Cloud organization](https://cloud2.influxdata.com)
28-
and review your organization URL. The first subdomain identifies your
29-
InfluxDB Cloud cluster. For example:
30-
31-
{{< code-callout "us-west-2-1" >}}
32-
```sh
33-
https://us-west-2-1.aws.cloud2.influxdata.com/orgs/03a2bbf46249a000/...
34-
```
35-
{{< /code-callout >}}
36-
37-
{{% /note %}}
23+
> [!Note]
24+
> #### Regions with multiple clusters
25+
>
26+
> Some InfluxDB Cloud regions have multiple Cloud clusters, each with a unique URL.
27+
> To find your cluster URL, [log in to your InfluxDB Cloud organization](https://cloud2.influxdata.> com)
28+
> and review your organization URL. The first subdomain identifies your
29+
> InfluxDB Cloud cluster. For example:
30+
>
31+
> ```sh { callout="us-west-2-1" }
32+
> https://us-west-2-1.aws.cloud2.influxdata.com/orgs/03a2bbf46249a000/...
33+
> ```
3834
3935
{{< cloud_regions >}}

content/influxdb/cloud/visualize-data/dashboards/_index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ Use the InfluxDB UI or `influx` CLI to view your dashboard ID.
2222

2323
When viewing a dashboard in the InfluxDB UI, your dashboard ID appears in the URL.
2424

25-
{{< code-callout "04b6b15034cc000" >}}
26-
```sh
25+
```sh { callout="04b6b15034cc000" }
2726
https://cloud2.influxdata.com/orgs/03a2bbf46249a000/dashboards/04b6b15034cc000/...
2827
```
29-
{{< /code-callout >}}
3028

3129
### Dashboard ID in the CLI
3230
Use [`influx dashboards`](/influxdb/cloud/reference/cli/influx/dashboards/) to view a list of dashboards and IDs.

content/influxdb/v1/administration/backup_and_restore.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,13 @@ the legacy format.
100100
To create or restore from a backup or in the portable format, include the
101101
`-portable` flag with your backup command.
102102

103-
{{< code-callout "-portable" >}}
104-
```sh
103+
```sh { callout="-portable" }
105104
# Create a backup in the portable format
106105
influxd backup -portable /path/to/backup-destination
107106

108107
# Restore from a portable backup
109108
influxd restore -portable /path/to/backup-destination
110109
```
111-
{{< /code-callout >}}
112110

113111
### Determine your backup's format
114112
Use the directory structure of the backup directory to determine the format of the backup.

content/influxdb/v2/admin/organizations/view-orgs.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,9 @@ Use the InfluxDB UI or `influx` CLI to view your organization ID.
4646
### Organization ID in the UI
4747

4848
After logging in to the InfluxDB UI, your organization ID appears in the URL.
49-
50-
{{< code-callout "03a2bbf46249a000" >}}
51-
```sh
49+
```sh { callout="03a2bbf46249a000" }
5250
http://localhost:8086/orgs/03a2bbf46249a000/...
5351
```
54-
{{< /code-callout >}}
55-
5652

5753
### Organization ID in the CLI
5854

content/influxdb/v2/visualize-data/dashboards/_index.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ Use the InfluxDB UI or `influx` CLI to view your dashboard ID.
2121
### Dashboard ID in the UI
2222

2323
When viewing a dashboard in the InfluxDB UI, your dashboard ID appears in the URL.
24-
25-
{{< code-callout "04b6b15034cc000" >}}
26-
```sh
24+
```sh { callout="04b6b15034cc000" }
2725
http://localhost:8086/orgs/03a2bbf46249a000/dashboards/04b6b15034cc000/...
2826
```
29-
{{< /code-callout >}}
3027

3128
### Dashboard ID in the CLI
3229
Use [`influx dashboards`](/influxdb/v2/reference/cli/influx/dashboards/) to view a list of dashboards and IDs.

content/influxdb3/cloud-dedicated/process-data/visualize/superset.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,17 +226,13 @@ With Superset running, you're ready to [log in](#log-in-to-superset) and set up
226226
- **`?database`**: URL-encoded InfluxDB [database name](/influxdb3/cloud-dedicated/admin/databases/list/)
227227
- **`?token`**: InfluxDB [API token](/influxdb3/cloud-dedicated/get-started/setup/) with `READ` access to the specified database
228228
229-
{{< code-callout "&lt;(domain|port|database-name|token)&gt;" >}}
230-
{{< code-callout "cluster-id\.influxdb\.io|443|example-database|example-token" >}}
231-
```sh
232-
# Syntax
233-
datafusion+flightsql://<domain>:<port>?database=<database-name>&token=<token>
229+
```sh { callout = "(&lt;(domain|port|database-name|token)&gt;)|cluster-id\.influxdb\.io|443|example-database|example-token"}
230+
# Syntax
231+
datafusion+flightsql://<domain>:<port>?database=<database-name>&token=<token>
234232
235-
# Example
236-
datafusion+flightsql://{{< influxdb/host >}}:443?database=example-database&token=example-token
237-
```
238-
{{< /code-callout >}}
239-
{{< /code-callout >}}
233+
# Example
234+
datafusion+flightsql://{{< influxdb/host >}}:443?database=example-database&token=example-token
235+
```
240236
241237
6. Click **Test Connection** to ensure the connection works.
242238
7. Click **Connect** to save the database connection.

content/influxdb3/cloud-dedicated/query-data/execute-queries/client-libraries/python.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,9 @@ to install a recent version of the Python programming language for your system.
188188
{{< /tabs-wrapper >}}
189189

190190
When a virtual environment is activated, the name displays at the beginning of your terminal command line--for example:
191-
192-
{{% code-callout "(virtualenv-1)"%}}
193-
```sh
191+
```sh { callout="(virtualenv-1)" }
194192
(virtualenv-1) $ PROJECT_DIRECTORY
195193
```
196-
{{% /code-callout %}}
197194
198195
## Query InfluxDB
199196
@@ -263,9 +260,7 @@ If using a non-POSIX-compliant operating system (such as Windows), specify the r
263260
264261
The following example shows how to use the Python `certifi` package and client library options to pass the certificate path:
265262
266-
{{% code-placeholders "DATABASE_(NAME|TOKEN)" %}}
267-
{{< code-callout "flight_client_options|tls_root_certs|(cert\b)" >}}
268-
```py
263+
```py { placeholders="DATABASE_(NAME|TOKEN)" callout="flight_client_options|tls_root_certs|(cert\b)" }
269264
from influxdb_client_3 import InfluxDBClient3, flight_client_options
270265
import certifi
271266
@@ -282,8 +277,6 @@ flight_client_options=flight_client_options(
282277
tls_root_certs=cert))
283278
...
284279
```
285-
{{< /code-callout >}}
286-
{{% /code-placeholders %}}
287280
288281
For more information, see [`influxdb_client_3` query exceptions](/influxdb3/cloud-dedicated/reference/client-libraries/v3/python/#query-exceptions).
289282

content/influxdb3/cloud-dedicated/query-data/troubleshoot-and-optimize/analyze-query-plan.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,12 @@ The following steps summarize the [physical plan execution and data flow](#physi
200200

201201
If your table doesn't contain data for the time range in your query, the physical plan starts with an `EmptyExec` leaf node--for example:
202202

203-
{{% code-callout "EmptyExec"%}}
204-
205-
```sql
203+
```sql { callout="EmptyExec" }
206204
ProjectionExec: expr=[temp@0 as temp]
207205
SortExec: expr=[time@1 ASC NULLS LAST]
208206
EmptyExec: produce_one_row=false
209207
```
210208

211-
{{% /code-callout %}}
212-
213209
## Analyze a query plan for leading edge data
214210

215211
The following sections guide you through analyzing a physical query plan for a typical time series use case--aggregating recently written (_leading edge_) data.
@@ -621,14 +617,10 @@ The remaining ParquetExec_B expressions are similar to those in [ParquetExec_A](
621617

622618
If you compare [`file_group`](#file_groups) paths in [ParquetExec_A](#parquetexec_a) to those in [ParquetExec_B](#parquetexec_b), you'll notice that both contain files from the same partition:
623619

624-
{{% code-callout "b862a7e9b329ee6a4..." %}}
625-
626-
```text
620+
```text { callout="b862a7e9b329ee6a4..." }
627621
1/1/b862a7e9b329ee6a4.../...
628622
```
629623

630-
{{% /code-callout %}}
631-
632624
The planner may distribute files from the same partition to different scan nodes for several reasons, including optimizations for handling [overlaps](#how-a-query-plan-distributes-data-for-scanning)--for example:
633625

634626
- to separate non-overlapped files from overlapped files to minimize work required for deduplication (which is the case in this example)

0 commit comments

Comments
 (0)