Markdown Code Fence Extractor

Extract fenced Markdown code blocks with language labels, metadata and source lines without running code.

Markdown is parsed in this browser. No extracted URLs are fetched. Input limit: 50,000 UTF-16 code units.

Extracts backtick and tilde fenced blocks parsed as Markdown code. Indented code is excluded. Labels are not validated and code never executes.

Collect fenced examples without executing code

Paste Markdown and select Inspect Markdown to extract backtick and tilde fenced code blocks. Each row contains the opening fence's one-based source line, language label, code content and remaining fence metadata. The tool treats code as text and never runs it.

Example: two fenced blocks

Load the example to insert a JavaScript fence and a text fence. The report contains two rows. The first begins on line 1, has language js, metadata title=demo, and content const total = 2 + 3;. The second begins on line 5, has language text and content A second block. Delimiter lines themselves are not included in code content.

Extraction rules

The Markdown parser determines whether a block is code; its opening delimiter distinguishes fenced code from indented code. Fences nested inside lists or blockquotes are supported. Four-space indented code and inline backtick spans are excluded. Unclosed fences can still become code blocks extending to the end of their container under Markdown parsing rules; a returned row is not proof that every delimiter was properly closed.

The first word in an info string becomes the language label, and the remainder becomes metadata. Labels are not validated against installed languages. Code content is the parser's value, with container indentation removed where required; it is not a byte-for-byte slice of the original file. Browser textarea line endings may also normalize. No syntax highlighting, compilation, formatting or dependency resolution is performed.

Inspect and download

The table previews 200 blocks. JSON copy and download include all blocks, with escaped newlines inside string values. Keep the original document if exact whitespace or fence spelling matters. A source without fenced blocks yields an empty report. Input is limited to 50,000 UTF-16 code units, 20,000 syntax nodes and 100 nesting levels; reduce deeply nested documents if the complexity error appears. Source edits clear the previous result.

Use Markdown Heading Extractor to locate surrounding sections and Markdown Link Extractor to audit prose references without confusing code examples with links.