Markdown Front Matter Extractor
Split a Markdown file into its YAML front matter and its body. Paste the file and press Extract: the server parses the metadata into JSON and returns the raw YAML, the content without front matter, and a combined JSON result you can copy or download as markdown-front-matter.json.
प्रयोग गर्नुहोस् Markdown Front Matter Extractor
इनपुट मार्कडाउन
उत्पादित परिणाम
सामग्री पढ्नुहोस्
Separate YAML metadata from the body of a Markdown file
Static site generators and content platforms such as Jekyll, Hugo, Eleventy, Astro, Docusaurus and many headless CMS tools store page settings at the top of each Markdown file in a block called front matter. It holds the title, date, author, tags, slug, draft flag and anything else the site needs. The Markdown Front Matter Extractor splits a file into its two halves: the YAML metadata, parsed into JSON, and the Markdown content with the front matter removed. Both are shown separately so you can copy whichever part you need.
What front matter looks like
A typical file starts like this:
---title: Getting starteddate: 2024-01-15tags: [setup, install]draft: false---# Getting started
The opening --- must be the very first line of the file and the block ends at the next line that is exactly ---. Everything in between is read as YAML.
What the result contains
After extraction, the Extracted Result card shows five fields:
| Field | Contents |
|---|---|
has_front_matter | true when a valid front matter block was found, otherwise false |
| metadata JSON | The YAML parsed into a JSON object, for example {"title": "Getting started", "draft": false} |
raw_front_matter | The YAML text exactly as written, without the --- lines |
| content without front matter | The Markdown body, with leading blank lines removed |
| full JSON | has_front_matter, metadata, raw front matter and content combined in one JSON object |
Two status cards summarise the result: Detection status shows "Front matter found" or "No front matter", and Metadata fields counts the top-level keys. The footer reports the size of the full JSON and the word count of the content.
How to extract front matter
- Paste a Markdown file into Input Markdown, or press Paste in the header. The footer shows its character and line counts.
- Press Extract. The button shows "Working" while the request is processed.
- Check Detection status. If it says "No front matter", read the troubleshooting tips below.
- Copy the part you need: Copy Raw YAML for the original metadata block, Copy Content for the body only, or Copy Full JSON for everything.
- Press Download JSON to save the full result as
markdown-front-matter.json.
Copy Input copies your original text, and Clear resets the input and all result fields.
Server-side parsing
The YAML is parsed on this site's server with the Symfony YAML component, a widely used PHP parser. When you press Extract, your Markdown is sent to the server, split and parsed there, and the result is returned to your browser. Input is limited to 200,000 characters per request; larger files are rejected with an error. Do not paste files that contain secrets such as API keys in their front matter.
How YAML values come out in JSON
Most values convert the way you would expect: strings stay strings, true and false become booleans, numbers become numbers, lists become arrays and nested keys become nested objects. One case needs attention:
- Unquoted dates become numbers. The parser turns a bare date such as
date: 2024-01-15into a Unix timestamp, so the metadata JSON shows1705276800instead of the date text. If you need the date as written, put it in quotes in your YAML,date: "2024-01-15", or read it from the raw front matter field, which always keeps the original text.
If the YAML has a syntax error, for example a bad indent or an unclosed quote, the block is still detected and raw_front_matter still holds the text, but the metadata JSON is left empty. That combination, "Front matter found" with 0 keys, is a reliable sign of invalid YAML.
Where this saves time
- Migrating between site generators. Pull the metadata out of each post so you can map fields from one platform's naming to another.
- Feeding a CMS or database. The full JSON is easy to import, with metadata and body already separated.
- Checking a post before publishing. Confirm the title, tags and draft flag parse the way your site generator will read them.
- Cleaning content for reuse. Copy the body without front matter to paste into an editor, an email or a word counter.
- Debugging build errors. When a static site build fails on one file, the empty metadata result quickly shows whether the YAML is at fault.
Troubleshooting "No front matter"
- Make sure the very first characters of the file are
---followed by a line break. A blank line, a space or an invisible byte order mark before it prevents detection. - Make sure the closing
---sits on its own line and is followed by a line break. A file that ends immediately after the closing dashes, with nothing after them, is not detected; add a newline or a line of content. - Use three hyphens. TOML front matter between
+++lines and JSON front matter are not supported. - An empty block with nothing between the two
---lines is not detected.
Raw YAML or parsed JSON: which to copy
Copy the raw YAML when you are moving a post to another YAML-based site generator, because it keeps comments, quoting and key order exactly as written. Copy the metadata JSON, or the full JSON, when the destination is a script, an API or a database that expects structured data. If the two disagree, for example a date that turned into a number, trust the raw YAML as the record of what the author wrote.
Things to avoid
- Do not rely on the metadata JSON for unquoted dates; use the raw YAML or quote the value.
- Do not assume the content field is untouched: leading blank lines after the front matter are trimmed.
- Do not paste confidential configuration. The text is processed on the server.
- Do not expect the tool to fix YAML. It reports what parses and keeps the raw text; correcting errors is up to you.
Limitations
- YAML front matter only, delimited by
---at the very top of the file. - Invalid YAML produces empty metadata rather than an error message pointing to the problem line.
- Unquoted dates are converted to Unix timestamps in the metadata JSON.
- Input is capped at 200,000 characters and needs a network connection.
- One file at a time; there is no batch mode.
Related tools
To create a new front matter block from form fields rather than read one, use the Markdown Metadata Generator. To list the headings in the body you just extracted, try the Markdown Heading Extractor.
Frequently Asked Questions
बारम्बार सोधिने प्रश्नहरू
Suggested Tools
टिप्पणीहरू (0)
तपाईंले भोग्नुभएको समस्या वर्णन गर्नुहोस् ताकि हामी अनुसन्धान गरी उपकरण सुधार गर्न सकौँ।