String Utilities Công cụ đã được cập nhật 2 ngày trước

Markdown Remove HTML

Markdown Remove HTML strips HTML tags from Markdown while keeping the text between them and all Markdown syntax. Lines inside fenced code blocks are left untouched. Your text is cleaned line by line on the server, up to 200,000 characters, and returned for copying or download. Tags are removed, not converted, so links and images written in HTML lose their URLs.

Luôn miễn phí Dễ sử dụng Kết quả ngay lập tức Riêng tư và an toàn

Sử dụng Markdown Remove HTML

Markdown: Loại bỏ HTML

Loại bỏ các thẻ và khối HTML thô trong khi vẫn giữ cho nội dung Markdown của bạn gọn gàng và dễ đọc.

Nhập Markdown

Dán mã Markdown chứa HTML thô
Loại bỏ các khối và thẻ HTML thô, đồng thời giữ nguyên định dạng Markdown khi có thể.

Xuất ra định dạng Markdown

Kết quả Markdown đã được làm sạch
Mẹo dọn dẹp
Sử dụng công cụ này khi nội dung Markdown được nhập vào chứa các thẻ HTML không mong muốn từ các tệp xuất từ hệ thống quản lý nội dung (CMS), các trang web được sao chép, các trình tạo email hoặc các trình soạn thảo văn bản định dạng phong phú.
Liên kết công cụ
Đã sao chép vào khay nhớ tạm.
Hãy giúp cải thiện công cụ này

Đọc nội dung

Tìm hiểu cách thức hoạt động của công cụ này và khi nào nên sử dụng nó.

Strip HTML tags from Markdown, keep the words

Markdown Remove HTML takes Markdown that has HTML tags mixed into it and removes the tags, leaving the text between them and all of your Markdown syntax in place. A line like Our <strong>new</strong> plan is <span style="color:red">live</span> comes out as Our new plan is live. Headings, lists, links, emphasis written with asterisks, tables and fenced code blocks are not touched.

HTML ends up in Markdown for many reasons: CMS exports, content copied from a web page, newsletters built in an email designer, rich text editors that save inline formatting, or older documentation that used <br> and <div align="center"> for layout. Some platforms then refuse that HTML, show it as raw text, or render it inconsistently. Removing it gives you portable, plain Markdown.

How the tool decides what to remove

When you click Remove HTML, your Markdown is sent to the site's Markdown API. The server normalises line endings and goes through the document one line at a time:

  • Lines inside fenced code blocks (opened by ``` or ~~~) are kept exactly, so HTML examples in your code samples survive.
  • On every other line, anything that starts with < and runs to the next > on the same line is deleted.
  • Blank space at the start and end of the whole document is trimmed.

The result is returned to your browser and shown in the output editor. The endpoint returns the text and does not save it. Requests are limited to 200,000 characters.

Tags go, content stays

It is important to understand that the tool removes tags, not elements. The text inside an element remains:

Input lineOutput line
<p align="center">Welcome</p>Welcome
Line one<br>Line twoLine oneLine two
<img src="logo.png" alt="Logo">empty line
<!-- draft note -->empty line
<kbd>Ctrl</kbd> + <kbd>C</kbd>Ctrl + C
<script>track()</script>track()

The last row is the one to watch: the contents of script and style elements are left behind as plain text, because only the tags are stripped. Delete those leftovers by hand. Similarly, an HTML image disappears entirely, alt text included, since the alt text lives inside the tag.

Using the tool

  1. Paste your Markdown into Input Markdown, or click Paste at the top. The footer shows the character count and a count of possible HTML tags, a quick indication of how much there is to clean.
  2. Click Remove HTML. The button changes to "Working" until the server responds.
  3. Review the Output Markdown editor. Its footer shows characters and words.
  4. Use the copy icon on the output card, or the download icon to save markdown-without-html.md.
  5. The trash icon on the input card clears both editors.

Before you run it: things HTML was doing for you

Because the tool removes tags without converting them, any meaning carried by those tags is lost. Consider replacing these in Markdown first, or after cleaning:

  • Line breaks. <br> between two words leaves them stuck together. Put a real line break, or end the line with a backslash.
  • Images. Rewrite important <img> tags as ![alt](src) so they are kept.
  • Links. An <a href="...">text</a> becomes just text; the URL disappears. Convert key links to [text](url) beforehand.
  • Collapsible sections. <details> and <summary> wrappers are removed and their contents become normal paragraphs.

Watch out for angle brackets that are not HTML

The removal rule looks for any <...> pair on a line. That catches more than HTML:

  • Autolinks. Markdown's <https://example.com> autolink form and email autolinks are removed completely.
  • Inline code on normal lines. An example like `<div>` outside a fenced block loses its tag and leaves empty backticks.
  • Comparisons and placeholders. Text such as a < b and c > d or git checkout <branch> outside code fences can lose the part between the brackets.

If your document has these, put command examples in fenced blocks before cleaning, and convert autolinks to the [text](url) form.

What the tool does not do

  • It does not convert HTML to Markdown. A bold tag does not become **text**; the formatting is simply dropped.
  • It does not decode HTML entities. &nbsp;, &amp; and similar entities stay as written.
  • It does not remove tags that span several lines. A tag that opens on one line and only closes its > on the next is left in place, because matching is done line by line.
  • It does not delete blank lines left behind by removed tags. Run Markdown Remove Empty Lines or Markdown Minifier afterwards if you want to tighten the spacing.

A sensible clean-up order for exported content

Content exported from a CMS or copied from a web page usually needs more than one pass. A sequence that avoids losing information looks like this:

  1. Normalise line endings first with Markdown Normalize Line Breaks, so later steps see consistent lines.
  2. In your editor, convert the HTML you want to keep: important links to [text](url), meaningful images to ![alt](src), and <br> tags to real line breaks.
  3. Move any command examples that contain angle brackets into fenced code blocks.
  4. Run this tool to remove the remaining tags.
  5. Search the output for leftover script or style text and delete it.
  6. Tighten blank lines left where tags used to be.

Done in this order, the final Markdown keeps everything a reader needs and loses only the markup that was getting in the way.

Good practice

  • Keep the original until you have checked the output, especially around images and links.
  • Compare the possible HTML tags count before cleaning with a quick search of the output for <. Anything still there is either inside a code fence, which is intended, or a tag that spans lines and needs manual removal.
  • Search the result for leftover script or style text.
  • Preview the cleaned file with Markdown Previewer to confirm paragraphs and lists still render as intended.

Limitations in short

  • Requires a connection; processing is done by the server.
  • Maximum 200,000 characters per request.
  • Line-based matching: multi-line tags are not removed.
  • Anything between angle brackets outside code fences is treated as a tag.
  • Element contents, including script and style code, remain as text.

Frequently Asked Questions

Câu hỏi thường gặp

Các câu trả lời ngắn gọn cho những thắc mắc mà người dùng thường đặt ra trước khi tin tưởng vào kết quả.

No. Only the tags are removed. The text between an opening and closing tag stays, including the contents of script and style elements, which you should delete by hand.

No. Lines inside fenced code blocks marked with ``` or ~~~ are kept exactly, so HTML examples in code survive.

Markdown autolinks are written inside angle brackets, and the tool removes anything between < and > on a line outside code fences. Rewrite them as [text](url) before cleaning.

No. Tags are removed, not converted. Bold, italic, links and images written as HTML lose their formatting and, for links and images, their URLs.

Yes. The text is sent to the site's API, cleaned and returned to your browser. The endpoint does not save it. The limit is 200,000 characters per request.

It probably spans more than one line, or it sits inside a fenced code block. Matching works one line at a time and skips code fences.

The cleaned document is saved as markdown-without-html.md.

Bình luận (0)

Dành cho các cuộc thảo luận của người dùng, các trường hợp ngoại lệ và các mẹo bổ sung.
Để lại bình luận
Bình luận của bạn sẽ được hiển thị công khai sau khi gửi.
Chưa có bình luận nào. Hãy là người đầu tiên bình luận!
Hãy cho chúng tôi biết!
Báo cáo sự cố liên quan đến công cụ này

Hãy mô tả vấn đề mà bạn gặp phải để chúng tôi có thể tìm hiểu và cải thiện công cụ này.

Điều gì hữu ích nhất
Vui lòng cung cấp thông tin về dữ liệu đầu vào, kết quả mong đợi, kết quả thực tế, trình duyệt/thiết bị và ảnh chụp màn hình (nếu có thể).
Nút chụp màn hình sẽ chụp lại trang web trong trình duyệt và đính kèm hình ảnh được tạo ra vào biểu mẫu này.
Ảnh chụp màn hình toàn trang
Được ghi lại trên trình duyệt của bạn bằng newisty.
Chưa có ảnh chụp màn hình nào được chụp.
Công cụ Báo cáo