[doc](sql-functions) numbered-example authoring format — array-filter.md as demo#3784
Open
boluor wants to merge 1 commit into
Open
[doc](sql-functions) numbered-example authoring format — array-filter.md as demo#3784boluor wants to merge 1 commit into
boluor wants to merge 1 commit into
Conversation
Demonstration of a proposed authoring convention for sql-manual function
docs. Each runnable example becomes a numbered pair of fenced blocks:
```sql {example="N"} -- the SQL (copy button, runnable)
```result {example="N"} -- expected output (no copy)
```error {example="N"} -- expected error (no copy)
One-time fixture data goes in ```sql {setup}. Syntax / Description sections
stay unchanged. EN and ZH versions share example=N IDs for mechanical
cross-language consistency checks.
Verified on Apache Doris 4.1.1 single-node cluster: every example runs as
documented (20 pass / 0 fail across both languages).
Bundled fix: the original EN page had a code block at line ~164 with only
the result table (the SELECT statement was missing). Reconstructed the
SELECT from the result column header — it is now Example 9.
Backward compatible: pages that don't use this convention keep working
exactly as today; this is opt-in per page.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Demo PR proposing a small authoring convention for
sql-manual/sql-functions/doc pages, applied here toarray-filter.md(EN + ZH) as a concrete example. Looking for maintainer feedback on the shape before scaling to other pages.The convention in one paragraph
Inside
## Examples, each runnable example becomes a numbered pair of fenced blocks:One-time fixture data goes in
```sql {setup}. The## Syntaxblock stays unchanged. EN and ZH share the sameexample="N"numbers, so cross-language drift becomes mechanically detectable.Why
sql {example="N"}to itsresult|errorblock by ID — zero heuristic guessing about where SQL ends and output begins.What's in this PR
Just
array-filter.md, both languages:versioned_docs/version-4.x/sql-manual/sql-functions/scalar-functions/array-functions/array-filter.mdi18n/zh-CN/docusaurus-plugin-content-docs/version-4.x/sql-manual/sql-functions/scalar-functions/array-functions/array-filter.mdBefore / after (one example)
Before:
After:
Bundled fix
The original EN page had a code block at line ~164 with only the result table (the
SELECTstatement was missing). Reconstructed theSELECTfrom the result column header — it is now Example 9.Verification
Ran every example on a single-node Apache Doris 4.1.1 cluster:
kind=errorexpected output and match the actualerrCode = …, detailMessage = …from Doris, after stripping environment-specific IP prefixes.Rendering
Without any theme changes, docusaurus renders:
sqlfences with syntax highlight + copy button (default behavior, unchanged)resultanderrorfences as plain code blocks (Prism doesn't know these languages, so no highlight; copy button still present by default)The convention's full UX (red-styled
errorblock, no copy onresult/error) needs a small theme override, which would be a separate follow-up PR. This PR does not require any theme change — the markdown is valid and renders correctly today.Asking for
{example="N"}, three fence types) OK?.docs-governance/ordoc-tools/. A separate spec-doc PR can follow.array-*function pages in the same style.Co-authored-by: doris-verify #3781