1.0.1 • Published 11 months ago

@charlespalmerbf/html-to-gfm v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

@charlespalmerbf/html-to-gfm

The code provided is a custom JavaScript function called convertHtmlToMarkdown that converts HTML content into GitHub Flavored Markdown (GFM) format. Here's a breakdown of what each part of the code does:

Installation

npm install @charlespalmerbf/html-to-gfm

Usage

node

const convertHtmlToMarkdown = require("@charlespalmerbf/html-to-gfm");

const html = '<h1>Hello, world!</h1><p>This is <strong>HTML</strong> content.</p><ul><li>Item 1</li><li>Item 2</li></ul>';

const markdown = convertHtmlToMarkdown(html);
console.log(markdown); //# Hello, world!This is **HTML** content.- Item 1- Item 2

Build

npm run build

Contribute

If you would like to contribute, you are welcome. Clone repository and open pull request.

About

The code provided is a custom JavaScript function called convertHtmlToMarkdown that converts HTML content into GitHub Flavored Markdown (GFM) format. Here's a breakdown of what each part of the code does:

The function takes an HTML string as input.

The code uses regular expressions and string replacements to convert specific HTML tags and elements into their Markdown equivalents.

The following HTML tags are converted to Markdown headings:

The code replaces and tags with single asterisks (*) to represent italic text in Markdown.

tags are transformed into Markdown links by extracting the URL and anchor text.

tags are converted to inline code snippets by surrounding the content with backticks.

1.0.1

11 months ago

1.0.0

11 months ago