oxc-project/oxc · error · syn::Error
unclosed markdown code block in documentation, please close
Error message
unclosed markdown code block in documentation, please close all ``` fences
What it means
Compile-time error raised inside the declare_oxc_lint! proc-macro (ruledocs feature) after counting markdown fence tokens in the rule's documentation. An odd count means a ``` code block was opened but never closed, which would render broken docs on the website, so the macro aborts expansion.
Source
Thrown at crates/oxc_macros/src/declare_oxc_lint.rs:211
if !remaining.is_empty() {
return Err(Error::new_spanned(
remaining,
"unexpected tokens in rule declaration, missing a comma?",
));
}
let Some(version) = version else {
return Err(Error::new(
struct_name.span(),
"missing `version = \"x.y.z\"` or `version = \"next\"` in `declare_oxc_lint!`",
));
};
// Validate that any markdown fenced code blocks (```) in rule docs are properly closed.
// If the total number of fences found is odd, a block was not closed.
#[cfg(feature = "ruledocs")]
if !backtick_fences_count.is_multiple_of(2) {
return Err(Error::new(
struct_name.span(),
"unclosed markdown code block in documentation, please close all ``` fences",
));
}
#[cfg(feature = "ruledocs")]
let Some(documentation) = documentation else {
return Err(Error::new(
struct_name.span(),
"rule documentation must be specified either via doc comments or the `docs` attribute",
));
};
Ok(Self {
name: struct_name,
is_tsgolint_rule,
plugin,
category,
fix,View on GitHub (pinned to a3d33dda7c)
Solutions
- Close every opened ``` code fence in the rule's doc comments
- Ensure fences inside indented or nested doc sections still balance to an even count
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_macros/src/declare_oxc_lint.rs:191 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@a3d33dda7c (2026-08-20).
Data as JSON: /api/errors/0ca1c6f6f23dae59.
Report an issue: GitHub.