I'm planning to package some of my tutorials on my blog and upload it as CPAN distribution. Here's an example blog post. Some of these posts present a piece of source code and discuss it part by part, mentioning line number or line number ranges (BTW, as you see, WordPress shows line numbers and allows us to highlight some lines.)

MetaCPAN also has a source code viewer which shows line number and can highlight a single line (example). I'm not sure if the source code viewer can be instructed to highlight multiple lines. In my tutorial POD (converted from the tutorial blog post) I can link to a specific line. The drawback is: 1) the link is specific to MetaCPAN; 2) the source code needs to be in a separate file in the distribution. For source code embedded in the POD as verbatim paragraphs, by default there is no line number or line highlighting.

Any advice on how to make this kind of tutorial also convenient to read on MetaCPAN?


In reply to Creating tutorial POD that refers to source code lines by perlancar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.