1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
# html2markdown - convert html to markdown [version 2.3.4-test]
Convert HTML to Markdown. Even works with entire websites!
## Basics
By default the "Commonmark" Plugin will be enabled. You can customize the options,
for example changing the appearance of bold with --opt-strong-delimiter="__"
Other Plugins can also be enabled. For example "GitHub Flavored Markdown" (GFM)
extends Commonmark with more features.
## Relative / Absolute Links
Use --domain="https://example.com" to convert *relative* links to *absolute* links.
The same also works for images.
## Escaping
Some characters have a special meaning in markdown. The library escapes these — if necessary.
See the documentation for more info.
## Security
Once you convert this markdown *back* to HTML you need to be careful of malicious content.
Use a HTML sanitizer before displaying the HTML in the browser!
## Examples
echo "<strong>important</strong>" | html2markdown
curl --no-progress-meter http://example.com | html2markdown
html2markdown --input file.html --output file.md
html2markdown --input "src/*.html" --output "dist/"
## Flags
-v, --version
show the version of html2markdown and exit
--help
--input PATH
Input file, directory, or glob pattern (instead of stdin)
--output PATH
Output file or directory (instead of stdout)
--output-overwrite
Replace existing files
If --input is a directory or glob pattern, --output must be a directory.
--domain
The url of the web page, used to convert relative links to absolute links.
--exclude-selector
css query selector to exclude parts of the input
--include-selector
css query selector to only include parts of the input
--opt-strong-delimiter
Make bold text. Should <strong> be indicated by two asterisks or two underscores?
"**" or "__" (default: "**")
--opt-table-header-promotion
[for --plugin-table] first row should be treated as a header
--opt-table-newline-behavior
[for --plugin-table] how tables containing newlines should be handled: "skip" or "preserve"
--opt-table-presentation-tables
[for --plugin-table] whether tables with role="presentation" should be converted
--opt-table-skip-empty-rows
[for --plugin-table] omit empty rows from the output
--opt-table-span-cell-behavior
[for --plugin-table] how colspan/rowspan should be rendered: "empty" or "mirror"
--plugin-strikethrough
enable the plugin ~~strikethrough~~
--plugin-table
enable the plugin table
For more information visit the documentation:
https://github.com/Johanneskaufmann/html-to-markdown
|