In a reaction to link to perl documentation

This works in the JS code works inside the console in FF and Chrome and will show hidden html-anchors ready to be cut&paste with PM markup

javascript:(function(){ var path = location.pathname.replace(/^\//,"").replace(/\.html$/," +"); var as =document.getElementsByTagName("a"); for (i in as) { var l = as[i]; if (l.id && l.classList.length == 0 ){ var dlink = path + "#" + l.id; l.innerHTML = "<b>" + path + "#[doc://"+dlink+"]</b><br>"; + l.href = "#" + l.id } } })()

The bold parts are generated by JS

perlintro#[doc://perlintro#Perl-variable-types]

Perl variable types

Perl has three main variable types: scalars, arrays, and hashes.

perlintro#[doc://perlintro#Scalars]

Scalars

A scalar represents a single value:

you can C&P the links then into a PM post, and they'll render as:

I still have problems putting it into a bookmark getting strange JS errors about keyword "var".

NB: This is far from being bug-free perldoc.perl.org and PM markup have their own idiosyncrasies! But it's a start.

Feel free to post better versions!!!

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice alert("LanX")


In reply to Bookmarklet to show deeplinks in perldoc.perl.org by LanX

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.