March 28, 2008
filed just before lunchtime by DrScofield in: hacking
technorati tags:
QR code for this entry · average time to read 0:32 minutes

i realized the other day that the markdown-extra plugin i am using for text markup was generating non-unique footnote anchors, resulting in any footnote #1 in a blog entry on referring back to footnote #1′s anchor in the very first blog on a page with multiple blog entries. not good. so, i had a look at the markdown-extra.php’s source — it already contains a variable fn_id_prefix but that is initialized to the empty string

# Prefix for footnote ids. var $fn_id_prefix = “”;

yet, that is a nice starting point, because all we have to do to get unique anchors is to add the following line of code in _hashHTMLBlocks_inMarkdown():1

$this->fn_id_prefix = md5($text);


  1. right after the initial

    if ($text === '') return array('', '');
    

    test. 

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.