Convert html to markdown
Function: Convert HTML to Markdown
This action takes a piece of HTML content and transforms it into Markdown format. Markdown is a lightweight markup language that is easy to read and write, often used for documentation, web content, and notes. This is useful when you need to convert web page content or rich text into a simpler, more portable text format.
Input
- HTML: The HTML content you wish to convert. This should be provided as a text string.
Output
- Output: The name of the variable where the resulting Markdown content will be stored. By default, this variable will be named
MARKDOWN. The output will be a text string.
Execution Flow
Real-Life Examples
Example 1: Converting a Blog Post for Documentation
- Scenario: You have a blog post published on your website, and you want to include its content in your internal documentation system, which uses Markdown.
- Inputs:
- HTML:
<h1>My Awesome Blog Post</h1>
<p>This is the <strong>first paragraph</strong> of my blog post. It contains some <em>important information</em>.</p>
<p>Here's a list:</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
- HTML:
- Result: The action converts the HTML into Markdown, and the following content is stored in a variable named
MARKDOWN:# My Awesome Blog Post
This is the **first paragraph** of my blog post. It contains some *important information*.
Here's a list:
* Item 1
* Item 2
Example 2: Preparing Email Content for a Plain-Text Newsletter
- Scenario: You've drafted an email with rich HTML formatting, but you also need a plain-text version for subscribers who prefer it or for systems that don't support HTML emails.
- Inputs:
- HTML:
<p>Dear Customer,</p>
<p>We are excited to announce our <a href="https://example.com/new-product">new product launch</a>!</p>
<p>Best regards,<br>The Team</p>
- HTML:
- Result: The action converts the HTML into Markdown, and the following content is stored in a variable named
MARKDOWN:Dear Customer,
We are excited to announce our [new product launch]\(https://example.com/new-product\)!
Best regards,
The Team
Example 3: Extracting Clean Text from a Web Page for Analysis
- Scenario: You're scraping content from a web page for data analysis, and you need to remove all HTML tags, converting the content into a clean, readable text format (Markdown is a good intermediate step before further processing).
- Inputs:
- HTML:
<div>
<h2>Product Features</h2>
<p>Our product offers:</p>
<ul>
<li>Fast performance</li>
<li>Easy integration</li>
<li>24/7 Support</li>
</ul>
<img src="product.jpg" alt="Product Image">
</div>
- HTML:
- Result: The action converts the HTML into Markdown, and the following content is stored in a variable named
MARKDOWN:## Product Features
Our product offers:
* Fast performance
* Easy integration
* 24/7 Support
![Product Image]\(product.jpg\)