fix(website): render code config examples as code blocks - #25958
Merged
Conversation
🎉 All green!🧪 All tests passed 🔗 Commit SHA: c34c237 | Docs | Datadog PR Page | Give us feedback! |
pront
force-pushed
the
website-pront-fix-config-example-newlines
branch
from
July 28, 2026 14:32
6802cdc to
a4f6513
Compare
pront
marked this pull request as ready for review
July 28, 2026 14:34
pront
enabled auto-merge
July 28, 2026 14:36
Field examples were rendered via jsonify, which escapes newlines to a literal \n, so multi-line VRL and Lua programs displayed as a single run-together escaped string. Render examples as a highlighted code block for fields whose declared `syntax` denotes source code, driven by a syntax -> lexer map (vrl_program -> coffee, lua -> lua, yaml -> yaml, toml -> toml); every other syntax stays inline JSON. Also rename the `remap_program` syntax to `vrl_program` and mark the lua transform's program/hook fields as `lua` so their examples render as code too.
pront
force-pushed
the
website-pront-fix-config-example-newlines
branch
from
July 28, 2026 14:44
a4f6513 to
c34c237
Compare
thomasqueirozb
approved these changes
Jul 28, 2026
Contributor
|
Your preview sites will be ready in a few minutes, please allow time for them to build. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Component reference pages render each field's example through
jsonify, which escapes newlinesto a literal
\n. Fields whose value is a program — VRL (remap'ssource) or Lua (theluatransform's hooks) — therefore showed their multi-line examples as one run-together escaped
string. This drives example rendering off the field's declared
syntax: code syntaxes render asa highlighted code block with newlines intact, everything else stays inline. Doing it declaratively
via
syntaxavoids brittle content-sniffing and extends to any code-valued field with a singlemap entry.
Changes
config-examplesrenders a field's examples as a highlighted code block when itssyntaxis asource-code type, via a
syntax → lexermap (vrl_program → coffee,lua → lua,yaml,toml); every other syntax renders inline as JSON.remap_programsyntax tovrl_program(the language is VRL, not "remap").luatransform's program and hook fields withsyntax: luaso their examples renderas code too.
How did you test this PR?
remapsource(VRL) and theluahook examples nowrender as multi-line code blocks, while non-code examples — e.g. the
filesource's\r\ndelimiter — stay inline.
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References