MKDoc::Text::Structured::Inline - convert text to HTML without handling block-level tags


  my $text = some_structured_text();
  my $this = MKDoc::Text::Structured::Inline::process ($text);
  my $that = MKDoc::Text::Structured::Inline::process_entities_only ($text);


MKDoc::Text::Structured::Inline is used by MKDoc::Text::Structured to generate inline HTML elements such as hyperlinks, emphasis and entities.

This module is also useful directly when the full block-level rendering of MKDoc::Text::Structured is unwanted.


Processing text and adding HTML tags

For example, when processing text that is going to end up in an <h1> header, you wouldn't want any block level tags generated:

  $header = "< My (c) symbol should be *bold* > -- and 'linked'";
  $header = MKDoc::Text::Structured::Inline::process ($title);

$header is now:

  &lt; My &copy; symbol should be <strong>bold</strong> &gt; &mdash; and <a href=""><a> &lsquo;linked&rsquo;

Processing text without adding tags

Another example, if you were processing text that will end up in an HTML <title> tag, this tag should never contain any other tags, so you should use the MKDoc::Text::Structured::Inline::process_entities_only() method:

  $title = "< My (c) symbol shouldn't be *bold* > -- or 'linked'";
  $title = MKDoc::Text::Structured::Inline::process_entities_only ($title);

$title is now:

  &lt; My &copy; symbol shouldn't be *bold* &mdash; &gt; or &lsquo;linked&rsquo;