Skip to content

docs: fix code-block lint errors across plugin READMEs#18830

Draft
jstirnaman wants to merge 1 commit intoinfluxdata:masterfrom
jstirnaman:fix/docs-codeblock-lint-errors
Draft

docs: fix code-block lint errors across plugin READMEs#18830
jstirnaman wants to merge 1 commit intoinfluxdata:masterfrom
jstirnaman:fix/docs-codeblock-lint-errors

Conversation

@jstirnaman
Copy link
Copy Markdown
Contributor

Summary

InfluxData docs-v2 (influxdata/docs-v2#7136) added a parse/compile lint check for fenced code blocks. JSON, YAML, and TOML blocks that fail to parse block CI on the docs site.

The plugin READMEs in this repo are mirrored verbatim into docs-v2 by the sync process, so several blocks that were never valid JSON or TOML now break the docs build downstream. The corresponding influxdata/docs-v2 fixes and JSON fixes explicitly defer these 14 files to upstream because any in-place fix would be overwritten on the next sync.

These changes preserve the original intent and content where possible. Where a block is genuinely illustrative (placeholders, ellipses, mixed HTTP-method-line plus body, or vendor query languages), the fence is relabeled to the closer-fit language so the lint check skips it.

TOML fixes (6 files)

File Fix
inputs/jti_openconfig_telemetry/README.md sensors = [...] was redefined twice; commented out the alternative-form example
inputs/opcua_listener/README.md // ... default values ... C-style comments inside an inline-table list. Converted to trailing # comments
inputs/postgresql_extensible/README.md sqlquery = "...where \ line continuations in basic strings are invalid TOML. Switched to multi-line basic strings ("""...""") which preserve the \ line-end continuation form for readability and parse cleanly per the TOML 1.0 spec
inputs/win_eventlog/README.md xpath_query = ''' opened a literal multi-line string but never closed; surrounding text says "set xpath_query empty" — replaced with ""
outputs/dynatrace/README.md api_token = "..." // hard-coded ... — converted // to #
processors/converter/README.md timestamp_format = "unix missing close quote

JSON fixes (8 files)

File Fix
inputs/bind/README.md BIND config (statistics-channels { ... };) tagged json. Relabeled text
inputs/ctrlx_datalayer/README.md (3 blocks) "key" : value lines (the OPC UA address-value rendering) are not JSON. Relabeled text
inputs/docker/README.md (2 blocks) docker_label_exclude = [...] / docker_label_include = [...] are TOML config snippets. Relabeled toml
outputs/azure_data_explorer/README.md KQL function definition tagged json. Relabeled kusto
outputs/clarify/README.md "signal" { ... } / "values" { ... } are Clarify's representation, not JSON. Relabeled text
outputs/elasticsearch/README.md (2 blocks) PUT /_cluster/settings and POST https://... HTTP request lines mixed with JSON body. Relabeled text
outputs/zabbix/README.md (2 blocks) Line-delimited multiple JSON objects. Relabeled jsonl
processors/lookup/README.md Illustrative template with ... ellipsis relabeled text; data block had a trailing comma that was removed

Why this approach

  • No code or behavior changes — all changes are in README markdown only.
  • Telegraf's TOML parser supports the multi-line basic string form with \ line-end continuation. Confirmed by influxdata/toml/parse.peg: mlBasicBody <- ... / escape newline wsnl and exercised by config/testdata/special_types.toml.
  • postgresql_extensible SQL queries are functionally identical before and after — the multi-line form folds whitespace per TOML 1.0, so the resulting query string is unchanged.
  • Relabeling fences as text for non-syntax-language blocks is the standard fix when a snippet was only ever illustrative (HTTP request examples, vendor query languages, partial fragments with placeholders).

Verification

Linted locally with the same script as docs-v2 CI:

$ node scripts/ci/lint-codeblocks.mjs <14 plugin READMEs>
$ echo $?
0

Test plan

  • CI passes
  • Reviewers confirm no semantic changes to the configuration examples (TOML """...""" continuation parses to identical query strings; relabeled fences render with appropriate or no syntax highlighting)

InfluxData docs-v2 added a parse/compile lint check for fenced code
blocks. JSON, YAML, and TOML blocks that fail to parse block CI on
the docs site. The plugin READMEs in this repo are mirrored verbatim
into docs-v2 by the sync process, so several blocks that were never
valid JSON or TOML now break the docs build downstream.

These fixes preserve the original intent and content where possible.
Where a block is genuinely illustrative (placeholders, ellipses, mixed
HTTP-method-line plus body, vendor query languages) the fence is
relabeled to the closer-fit language so the lint check skips it.

TOML fixes (6 files):
  - inputs/jti_openconfig_telemetry: `sensors = [...]` was redefined
    twice; commented out the alternative-form example.
  - inputs/opcua_listener: `// ... default values ...` C-style
    comments inside an inline-table list. TOML uses `#` for comments;
    converted to trailing `#` comments.
  - inputs/postgresql_extensible: `sqlquery = "...where \` line
    continuations in basic strings are invalid TOML. Switched to
    multi-line basic strings (`"""..."""`) which preserve the `\`
    line-end continuation form for readability and parse cleanly per
    the TOML 1.0 spec (`mlBasicBody <- ... / escape newline wsnl` in
    influxdata/toml's parse.peg).
  - inputs/win_eventlog: `xpath_query = '''` opened a TOML literal
    multi-line string but never closed; the surrounding text says
    "set xpath_query empty" — replaced with `""`.
  - outputs/dynatrace: `api_token = "..." // hard-coded ...` —
    converted `//` to `#`.
  - processors/converter: `timestamp_format = "unix` missing close
    quote.

JSON fixes (8 files):
  - inputs/bind: BIND nameserver config (`statistics-channels { ... };`)
    was tagged `json`. Relabeled `text`.
  - inputs/ctrlx_datalayer (3 blocks): `"key" : value` lines (the OPC
    UA server's address-value rendering) are not JSON. Relabeled `text`.
  - inputs/docker (2 blocks): `docker_label_exclude = [...]` and
    `docker_label_include = [...]` are TOML config snippets, not JSON.
    Relabeled `toml`.
  - outputs/azure_data_explorer: KQL function definition (`.create-or-
    alter function ... { ... }`) tagged `json`. Relabeled `kusto`.
  - outputs/clarify: `"signal" { ... }` and `"values" { ... }` are
    Clarify's representation, not JSON. Relabeled `text`.
  - outputs/elasticsearch (2 blocks): `PUT /_cluster/settings` and
    `POST https://...` are HTTP request lines mixed with a JSON body.
    Relabeled `text`.
  - outputs/zabbix (2 blocks): line-delimited multiple JSON objects.
    Relabeled `jsonl`.
  - processors/lookup: illustrative template with `...` ellipsis
    relabeled `text`; the actual data block had a trailing comma
    that was removed.

No code or behavior changes — README content only.
@telegraf-tiger telegraf-tiger Bot added the docs Issues related to Telegraf documentation and configuration descriptions label May 1, 2026
@srebhan
Copy link
Copy Markdown
Member

srebhan commented May 4, 2026

@jstirnaman changes to the configuration should be made to the corresponding sample.conf and you should run a make docs afterwards to update the README files.

Note

In Telegraf the configs embedded in the README.md files are auto-generated through make docs from the sample.conf files of the plugin to ensure both are consistent!

@srebhan srebhan self-assigned this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Issues related to Telegraf documentation and configuration descriptions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants