{"id":"2f78dc12159cc08c","repo":"clap-rs/clap","slug":"feature-not-enabled-event","errorCode":null,"errorMessage":"feature not enabled {event:?}","messagePattern":"feature not enabled (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"clap_derive/src/utils/doc_comments.rs","lineNumber":401,"sourceCode":"                )\n                | Event::End(\n                    TagEnd::FootnoteDefinition\n                    | TagEnd::DefinitionList\n                    | TagEnd::DefinitionListTitle\n                    | TagEnd::DefinitionListDefinition\n                    | TagEnd::Table\n                    | TagEnd::TableHead\n                    | TagEnd::TableRow\n                    | TagEnd::TableCell\n                    | TagEnd::MetadataBlock(_)\n                    | TagEnd::Superscript\n                    | TagEnd::Subscript,\n                )\n                | Event::InlineMath(_)\n                | Event::DisplayMath(_)\n                | Event::FootnoteReference(_)\n                | Event::TaskListMarker(_) => {\n                    unimplemented!(\"feature not enabled {event:?}\")\n                }\n            }\n        }\n        let short = short.unwrap_or_else(|| writer.output.trim_end().to_owned());\n        let long = writer.output.trim_end();\n        let long = has_details.then(|| long.to_owned());\n        (short, long)\n    }\n}\n","sourceCodeStart":383,"sourceCodeEnd":411,"githubUrl":"https://github.com/clap-rs/clap/blob/ccc92c3b1171c00a6ef610bfa0018fa59c8510f9/clap_derive/src/utils/doc_comments.rs#L383-L411","documentation":"This is a runtime panic (`unimplemented!`) inside clap_derive's markdown doc-comment renderer, `parse_markdown` in `clap_derive/src/utils/doc_comments.rs:401`. The function is only compiled when the `unstable-markdown` Cargo feature is enabled (it pulls in `pulldown-cmark` + `anstyle`); it turns /// doc comments into styled help text. The match arm panics for pulldown-cmark events that clap does not yet know how to render: footnote definitions/references, definition lists, tables, metadata blocks, superscript/subscript, inline/display math, and task-list markers. The message literally means \"this markdown feature is recognized by the parser but rendering support is not enabled/implemented in clap.\"","triggerScenarios":"Enable the `unstable-markdown` feature (e.g. `clap = { version = \"4\", features = [\"unstable-markdown\"] }`) and write a /// doc comment containing unsupported markdown: a footnote `[^1]`, a GFM table, an inline/display math `$x$`/`$$x$$`, a task list `- [x]`, a definition list, a metadata block, or super/subscript `^x^`/`~x~`. The panic fires when the doc comment is actually processed — i.e. when help text is rendered via `--help`, `-h`, or when an arg-parse error prints usage. It does NOT fire at compile time.","commonSituations":"Adopting the experimental `unstable-markdown` feature to get rich help formatting and pasting README-style markdown (which often contains tables, footnotes, or task lists) into struct doc comments. Upgrading pulldown-cmark across clap versions can newly emit events (e.g. `Tag::MetadataBlock`, definition lists) for syntax that used to be ignored. Copying markdown from GitHub/issues into `///` blocks is the typical trigger.","solutions":["Remove the unsupported markdown construct (tables, footnotes, math, task lists, definition lists, super/subscript, metadata blocks) from the /// doc comment and replace it with syntax clap supports: headings, paragraphs, emphasis/strong/strike-through, inline code, links, ordered/unordered lists, and blockquotes.","If you need the feature genuinely, disable `unstable-markdown` (remove it from `features`) so doc comments are treated as plain text and `parse_markdown` is never called, until clap adds support.","Track/check the clap CHANGELOG for the `unstable-markdown` feature; because it is unstable, supported event coverage changes between versions, so pin the clap version whose renderer matches your doc-comment content."],"exampleFix":"// before (clap with features = [\"unstable-markdown\"])\n/// Render a table.\n///\n/// | col a | col b |\n/// |-------|-------|\n/// | 1     | 2     |\n#[derive(clap::Parser)]\nstruct Cli { name: String }\n\n// after\n/// Render a table.\n///\n/// col a: 1, col b: 2\n#[derive(clap::Parser)]\nstruct Cli { name: String }","handlingStrategy":"validation","validationCode":"// Pre-build / CI check. Only needed if you enable clap's `unstable-markdown` feature.\n// clap_derive's markdown help renderer hits unimplemented!(\"feature not enabled {event:?}\")\n// during macro expansion for the constructs below when present in `///` doc comments on\n// #[derive(Parser|Args|Subcommand|ValueEnum)] items.\nuse pulldown_cmark::{Event, Options, Parser, Tag};\n\nfn unsupported_markdown_in_docs(doc: &str) -> Option<&'static str> {\n    for ev in Parser::new_ext(doc, Options::all()) {\n        match ev {\n            Event::Start(Tag::FootnoteDefinition(_)) => return Some(\"footnote\"),\n            Event::Start(Tag::DefinitionList | Tag::DefinitionListTitle | Tag::DefinitionListDefinition) => return Some(\"definition list\"),\n            Event::Start(Tag::Table(_) | Tag::TableHead | Tag::TableRow | Tag::TableCell) => return Some(\"table\"),\n            Event::Start(Tag::MetadataBlock(_)) => return Some(\"metadata block\"),\n            Event::Start(Tag::Superscript | Tag::Subscript) => return Some(\"super/subscript\"),\n            Event::InlineMath(_) | Event::DisplayMath(_) => return Some(\"math\"),\n            Event::FootnoteReference(_) => return Some(\"footnote reference\"),\n            Event::TaskListMarker(_) => return Some(\"task list\"),\n            _ => {}\n        }\n    }\n    None\n}\n\n// usage over each extracted doc-comment string before `cargo build`:\n// if let Some(bad) = unsupported_markdown_in_docs(&doc) { /* strip or rewrite it */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["This panic only occurs when clap's `unstable-markdown` cargo feature is enabled; if you do not need ANSI-rendered markdown help, stay on the default features and it can never trigger.","If you do enable `unstable-markdown`, keep `///` doc comments on clap-derived types to simple markdown: headings, lists, bold/italic, inline code, code blocks, links, and blockquotes.","Avoid GFM tables, footnotes (`[^x]`), math (`$...$`), task-list checkboxes (`- [ ]`), definition lists, superscript/subscript, and YAML metadata blocks in those doc comments.","Run `cargo check` plus the doc-comment scan above in CI so an unsupported construct fails the build early instead of panicking during a release build.","If a complex doc comment is needed for rustdoc but breaks clap's renderer, keep it on a non-clap type or out of the `///` on the derived item."],"tags":["clap","derive","doc-comments","markdown","help","panic","unstable"],"analyzedSha":"ccc92c3b1171c00a6ef610bfa0018fa59c8510f9","analyzedAt":"2026-08-01T15:49:18.624Z","schemaVersion":2}