The API documentation for Mylyn Wikitext has functions to convert Wiki Markup to HTML, but I cannot find functions to convert / parse HTML code to Wiki Markup. Class MarkupParser
has method parseToHTML
, but where can I find the reverse?
Try Wikifier.
It doesn't do exactly what you want, but you might find it does enough, or is a useful starting point.
Wikifier converts snippets of the Confluence 4 XML storage format (that is, as presented by the Confluence Source Editor plugin, without a single document root element) into Confluence 3 wiki markup.
Why is this at all relevant to your question? The Confluence 4 XML storage format includes some elements and attributes that have the same names as XHTML elements and attributes.
For more information, click the Help link on the Wikifier web page.
Note: The XSLT stylesheet used by the Wikifier web page is slightly more recent than the XSLT stylesheet bundled with the related schema package.
This added later: Wikifier RT is even closer to what you want.