html2md
v1.6.0
Simple and fast HTML to Markdown converter
|
Class for converting HTML to Markdown. More...
#include <html2md.h>
Public Member Functions | |
Converter (std::string &html, struct Options *options=nullptr) | |
Standard initializer, takes HTML as parameter. Also prepares everything. | |
std::string | convert () |
Convert HTML into Markdown. | |
Converter * | appendToMd (char ch) |
Append a char to the Markdown. | |
Converter * | appendToMd (const char *str) |
Append a char* to the Markdown. | |
Converter * | appendToMd (const std::string &s) |
Append a string to the Markdown. | |
Converter * | appendBlank () |
Appends a ' ' in certain cases. | |
bool | ok () const |
Checks if everything was closed properly(in the HTML). | |
void | reset () |
Reset the generated Markdown. | |
bool | operator== (const Converter *c) const |
Checks if the HTML matches and the options are the same. | |
bool | operator== (const Converter &c) const |
operator bool () const | |
Returns ok(). | |
Class for converting HTML to Markdown.
This class converts HTML to Markdown. There is also a static wrapper for this class (see html2md::Convert).
Option 1: Use the class:
Option 2: Use the static wrapper:
Advanced: use Options:
|
inlineexplicit |
Standard initializer, takes HTML as parameter. Also prepares everything.
html | The HTML as std::string. |
options | Options for the Conversation. See html2md::Options() for more. |
This is the default initializer.
You can use appendToMd() to append something to the beginning of the generated output.
Converter * html2md::Converter::appendBlank | ( | ) |
Appends a ' ' in certain cases.
This function appends ' ' if:
*
\n
aka newline Definition at line 208 of file html2md.cpp.
Converter * html2md::Converter::appendToMd | ( | char | ch | ) |
Append a char to the Markdown.
ch | The char to append. |
Definition at line 165 of file html2md.cpp.
Converter * html2md::Converter::appendToMd | ( | const char * | str | ) |
Append a char* to the Markdown.
str | The char* to append. |
Definition at line 189 of file html2md.cpp.
|
inline |
|
nodiscard |
Convert HTML into Markdown.
This function actually converts the HTML into Markdown. It also cleans up the Markdown so you don't have to do anything.
Definition at line 361 of file html2md.cpp.
|
nodiscard |
Checks if everything was closed properly(in the HTML).
Definition at line 218 of file html2md.cpp.
|
inlineexplicit |
|
inline |
|
inline |
void html2md::Converter::reset | ( | ) |
Reset the generated Markdown.
Definition at line 971 of file html2md.cpp.