octalmage / Marknote

Markdown Note Taking.
36 stars 13 forks source link

Add better support for linking to headers. [assets/js/app.js] #27

Closed octalmage closed 10 years ago

octalmage commented 10 years ago

filename : assets/js/app.js line # : 39 tag : todo md5 : 12b20defa024dfe4412bee761dc4b7d5

//[todo] - Add better support for linking to headers.
renderer.link = function(href, title, text)
{
    var output;
    if (href.indexOf("://") !== -1)
    {
        output = "<a target=\"_blank\" href=\"" + href + "\">" + text + "</a>";
    }
    else if (href.indexOf("#") !== -1) //Allow linking to a header using #. 
    {
        output = "<a href=\"" + href + "\">" + text + "</a>";
    }
    else
    {
        output = "<a target=\"_blank\" href=\"note://" + href + "\">" + text + "</a>";
    }
octalmage commented 10 years ago

I need to modify the check f

octalmage commented 10 years ago

I need to modify the check for "#" to only match the beginning of the link, so I don't break linking to sections in external links.