String Utilities 도구 업데이트됨 3일 전

Markdown Heading Extractor

List every heading in a Markdown document with its level, text and an anchor-style slug. Paste your Markdown and press Extract; the server reads hash-style headings from level 1 to 6, skips fenced code blocks, and returns a table plus JSON you can copy or download as markdown-headings.json.

항상 무료 사용하기 쉬움 즉각적인 결과 비공개이며 안전합니다

사용법 Markdown Heading Extractor

마크다운 제목 추출기

마크다운 문서에서 제목 수준, 텍스트 및 슬러그를 구조화된 JSON 형식으로 추출합니다.

마크다운 입력

여기에 마크다운 제목을 붙여넣으세요

추출된 제목

레벨, 텍스트 및 생성된 슬러그
레벨 본문 슬러그
아직 제목이 추출되지 않았습니다.
제목 작성 팁
다음에서 가져온 표준 마크다운 제목 # ~에 ###### 지원됩니다. 추출된 슬러그는 앵커, 목차 링크 및 문서 내 탐색에 유용합니다.
도구 링크
클립보드에 복사되었습니다.
이 도구를 개선하는 데 도움을 주세요

내용 읽기

이 도구의 작동 방식과 사용 시기를 알아보세요.

Turn a Markdown document's headings into structured data

Headings are the skeleton of any Markdown document. They decide the table of contents, the anchor links people share, and how readers and search engines understand the page. The Markdown Heading Extractor reads a document and returns every heading as a row with its level, its text and a URL-friendly slug, plus a JSON copy you can use in scripts. It is a quick way to review an outline, build navigation, or check that anchors match what your site generates.

What is extracted

The tool recognises ATX headings, the style that starts a line with one to six hash signs followed by a space:

# Title is level 1, ## Section is level 2, and so on down to ###### Detail at level 6.

For each heading the JSON contains four keys:

KeyExampleMeaning
level2Number of hash signs, 1 to 6
textInstall on WindowsHeading text with surrounding spaces trimmed
sluginstall-on-windowsAnchor-style identifier generated from the text
line## Install on WindowsThe original source line

The Extracted Headings table on the page shows level, text and slug; the line value appears in the Raw JSON and the downloaded file.

How slugs are generated

The slug follows a GitHub-style recipe: the text is lower-cased, every character that is not a letter, digit, space or hyphen is removed, spaces become hyphens, repeated hyphens collapse into one, and hyphens at either end are trimmed. Letters from any alphabet are kept, so headings in German, Spanish, Hindi or Japanese produce readable slugs.

A few examples show the rules in action:

  • Hello World! becomes hello-world.
  • What's new in 2.0? becomes whats-new-in-20.
  • API_v2 `config` becomes apiv2-config, because underscores and backticks are removed.

Two differences from GitHub are worth knowing. GitHub keeps underscores in anchors, while this tool removes them. And when two headings have the same text, GitHub adds -1, -2 to later ones; this tool gives them identical slugs. If you build links for a GitHub-rendered README, check headings with underscores or duplicate names by hand.

A short example

Take this outline from a project guide:

# Acme CLI
## Installation
### macOS & Linux
## Usage

The extractor returns four rows. Acme CLI is level 1 with the slug acme-cli. Installation and Usage are level 2 with the slugs installation and usage. The third line becomes level 3 with the slug macos-linux: the ampersand is removed and the two spaces it leaves behind turn into a single hyphen. In the JSON each row also carries the original line, which is useful when you want to search for and replace a heading in the source file later. Reading just the level column, 1, 2, 3, 2, you can already see the document's shape without opening it.

Using the extractor

  1. Paste your Markdown into Input Markdown, or press Paste in the header. The footer shows the character count and a live "possible headings" count.
  2. Press Extract. The button shows "Working" while the request runs.
  3. Review the Extracted Headings table to see the outline.
  4. Use the copy icon (Copy JSON) to copy the array, or the download icon (Download JSON) to save markdown-headings.json.
  5. The trash icon on the input card clears the input, table and JSON.

The possible headings count is a quick estimate made in the browser and also counts hash lines inside code blocks. The table after extraction is the accurate result, because code blocks are skipped on the server.

Processing and privacy

Extraction runs on this site's server. Pressing Extract sends your Markdown there, the headings are collected, and the list comes back to your browser. Each request accepts up to 200,000 characters; longer input returns an error message. Lines inside fenced code blocks marked with ``` or ~~~ are skipped, so shell comments and Python comments that start with a hash are not mistaken for headings.

Reasons to extract headings

Review the outline before publishing

A table of levels makes structural problems obvious: two level-1 headings on one page, a jump from level 2 straight to level 4, or a section that is much deeper than the rest. Fixing those helps screen-reader users and keeps the page outline clean for search engines.

Build navigation and in-page links

The slug column gives you the anchor for each section. Combine text and slug to create a custom sidebar, a "jump to" menu or links from another page directly into a section.

Compare structure across documents

Extract headings from a set of similar pages, such as product docs or lesson notes, and compare them in a spreadsheet to make sure every page follows the same template.

Feed scripts and search indexes

The JSON is ready for a script that builds a search index, generates a sitemap of sections, or splits a large file at its level-2 headings.

Tips

  • Always put a space after the hash signs. #Heading without a space is not a heading in CommonMark and is not extracted.
  • Start headings at the beginning of the line. Headings indented with spaces are not picked up.
  • Avoid closing hash signs, as in ## Title ##. They stay in the text field as part of the heading, although the slug drops them.
  • Give each section a unique heading if you rely on slugs for links.

Checking heading hierarchy in practice

A healthy document usually has exactly one level-1 heading, followed by level-2 sections that each contain level-3 subsections, and so on. Read down the Level column after extraction. Any step down by more than one, such as 2 followed by 4, is a skipped level that can confuse assistive technology. Several level-1 rows usually mean the page title was repeated or a section was promoted by mistake.

What it does not do

  • Setext headings, written as a line of text underlined with === or ---, are not detected.
  • HTML headings such as <h2> are ignored.
  • Inline Markdown in the heading text, such as bold or links, is kept as written in the text field.
  • It does not build a nested Markdown table of contents. For that, use a dedicated table of contents generator.

Limitations

  • ATX headings only, starting at the first column with a space after the hashes.
  • Slugs drop underscores and are not de-duplicated.
  • Input is capped at 200,000 characters and needs a connection to the server.
  • JSON is the only export format.

Related tools

When you want a ready-to-paste nested list of links rather than raw data, the Markdown TOC Generator builds one. To number your sections automatically, try Markdown Add Heading Numbers.

Frequently Asked Questions

자주 묻는 질문

사용자가 결과를 신뢰하기 전에 자주 묻는 질문에 대한 간결한 답변.

All six levels of ATX headings, from a single hash for level 1 to six hashes for level 6, as long as there is a space after the hashes.

No. Lines inside fenced code blocks are skipped, so comments that start with a hash in shell or Python examples are not treated as headings.

Mostly. They follow the same lower-case and hyphen rules, but underscores are removed and duplicate headings are not given -1 or -2 suffixes, so check those cases by hand.

Setext headings, where text is underlined with equals signs or hyphens, are not supported. Convert them to hash-style headings first.

On this site's server. The text is sent when you press Extract and the heading list is returned to your browser.

Up to 200,000 characters per request. Longer documents are rejected, so split them into parts.

markdown-headings.json holds an array with the level, text, slug and original line of each heading, in document order.

댓글 (0)

사용자 토론, 예외적인 사례 및 추가 팁을 위한 공간입니다.
댓글 남기기
댓글을 제출하면 공개적으로 표시됩니다.
아직 댓글이 없습니다. 가장 먼저 댓글을 남겨보세요!
저희에게 알려주세요!
이 도구와 관련된 문제를 신고하기

발생한 문제를 자세히 설명해 주시면, 저희가 이를 조사하고 도구를 개선할 수 있습니다.

가장 도움이 되는 것은 무엇인가
입력 내용, 예상 결과, 실제 결과, 브라우저/기기 정보를 기재해 주시고, 도움이 될 경우 스크린샷도 첨부해 주세요.
스크린샷 버튼은 브라우저에 표시된 페이지를 캡처하여 생성된 이미지를 이 양식에 첨부합니다.
전체 화면 스크린샷
newisty를 통해 브라우저에서 캡처되었습니다.
아직 스크린샷을 찍지 않았습니다.
도구 보고서