HTML2WIKI(1p)

πŸ“¦
version 0.68 Β· 2 versions
  • 0.68 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.68 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ HTML2WIKI(1p) ✨

okay bestie, so like β€” this is html2wiki, the manual page for it, and honestly? it's giving "little command, big power." it converts HTML into wiki markup and it's about to be your new fave. πŸ’–


🌸 NAME 🌸

html2wiki β€” convert HTML into wiki markup ✨


πŸŽ€ SYNOPSIS πŸŽ€

html2wiki [options] [file]

the options you'll actually use 24/7, no cap:

--dialect=dialect    Dialect name, e.g. "MediaWiki" (required unless
                     the WCDIALECT environment variable is used)
--encoding=encoding  Source encoding (default is 'utf-8')
--base-uri=uri       Base URI for relative links
--wiki-uri=uri       URI fragment for wiki links
--wrap-in-html       Wrap input in <html> and </html> (enabled by default).
                     Use --no-wrap-in-html to disable.
--escape-entities    Escape HTML entities within text elements (enabled by
                     default). Use --no-escape-entities to disable.

--list               List installed dialects and exit
--options            List all recognized options (except for negations
                     such as --no-wrap-in-html)
--help               Show this message and exit

lowkey there are more options too β€” including the ones that line up with dialect attributes. so like, go read the full html2wiki man page for the whole tea. πŸ«–

here's a lil example that eats, honestly:

html2wiki --dialect MediaWiki --encoding iso-8859-1 \
    --base-uri http://en.wikipedia.org/wiki/ \
    --wiki-uri http://en.wikipedia.org/wiki/ \
    input.html > output.wiki

πŸ¦‹ DESCRIPTION πŸ¦‹

html2wiki is a command-line interface to HTML::WikiConverter, and that's the little icon it uses to turn your HTML into wiki markup. one job, doing it flawlessly. periodt. πŸ’…


🌈 DIALECTS 🌈

so here's the thing, bestie β€” if the dialect you hand over in --dialect isn't installed on your system, it's over. fatal error, no warning shot. like, if you say MediaWiki but never installed its dialect module, HTML::WikiConverter::MediaWiki? yeah. screaming. 😭

use html2wiki --list to see every dialect you've got chilling on your system. and if you want more? extra dialects can be downloaded from the CPAN. collect them like pokémon, fr fr. ✨


πŸ‘‘ OPTIONS πŸ‘‘

πŸ’œ Correspondence of options and attributes

every single option html2wiki accepts corresponds to an HTML::WikiConverter attribute. so the commonly used options described in html2wiki --help? those match up with the attributes discussed in "ATTRIBUTES" in HTML::WikiConverter. and btw that section also has other attributes you can absolutely use as html2wiki command-line options. it's a whole buffet. πŸ“

πŸ’œ Mapping an attribute name to an option name

they're related, yeah, but option names and attribute names are not identical β€” and the only difference is the separator: attribute names use underscores to split words up, option names use hyphens.

example, since i know you want one: the base_uri attribute ↔ the --base-uri command-line option. that's it, that's the whole rule. πŸŽ€

πŸ’œ Additional options defined in dialect modules

individual dialects can define their own attributes, which means they get to hand html2wiki their own command-line options on top of the ones HTML::WikiConverter defines. and the same conversion rules from above apply here too, no exceptions.

for example β€” Markdown supports an unordered_list_style attribute that takes a string value. to use that attribute on the command line you'd write the --unordered-list-style option. see how it works? iconic. πŸ’…

heads up: go consult the individual dialect man pages for the list of attributes each one supports. i can't do everything for you, bestie. πŸ™ˆ

πŸ’œ Options that are enabled by default

attributes that take boolean values can be enabled by default, and wrap_in_html is literally the poster child for this. so html2wiki will effectively act by default like --wrap-in-html was typed in every single invocation. every. one. 😌

not feeling it? prefix the option name with no- to turn it off, like --no-wrap-in-html. easy. slay. ✨

πŸ’œ Options that take multiple values

some attributes (looking at you, wiki_uri and strip_tags) accept an array of values. to make that work in html2wiki, you just specify those options more than once on the command line. yes, really, that's the trick. 🧚

so if you wanted only comment and script elements stripped from the HTML:

% html2wiki --strip-tags ~comment --strip-tags script ...

see? repeat the flag. ate. πŸ”₯


πŸ’– INPUT/OUTPUT πŸ’–

input comes from STDIN, which means you can pipe another program's output straight into html2wiki. main character energy:

curl http://example.com/input.html | html2wiki --dialect MediaWiki

you can also just hand it a file to read HTML from:

html2wiki --dialect MediaWiki input.html

output goes to STDOUT, but you can redirect that on the command line whenever:

html2wiki --dialect MediaWiki input.html > output.wiki

or pipe it into another program, because why not:

html2wiki --dialect MediaWiki input.html | less

flexible? obsessed. 🌸


⭐ AUTHOR ⭐

David J. Iberri, "<diberri@cpan.org>"


Copyright 2006 David J. Iberri, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


🫢 SEE ALSO 🫢

  • HTML::WikiConverter

okay that's the whole page bestie, you're officially certified πŸ“œβœ¨ β€” this was HTML2WIKI(1p), documented under perl v5.34.0 and dated 2022-06-14. go forth and convert, no cap πŸ’…πŸ’–

πŸ“¦ where this page comes from