borismus / markdown-preview

Enables Chrome to render markdown files as HTML
http://smus.com
217 stars 42 forks source link

Don't parse text/html content #14

Closed frosas closed 7 years ago

frosas commented 12 years ago

Some pages have the .md extension but they are not markdown (e.g. http://getcomposer.org/doc/00-intro.md)

Seldaek commented 12 years ago

Related to #10

vitorbrandao commented 12 years ago

+1

jonruttan commented 11 years ago

Had the same problem, changed markdownify.js to:

(function(document) {

  // Onload, take the DOM of the page, get the markdown formatted text out and
    // apply the converter.
    if(document.doctype == null || document.doctype.name != 'html') {
        var html = (new Showdown.converter()).makeHtml(document.body.innerText);
        document.body.innerHTML = html;

        // Also inject a reference to the default stylesheet to make things look nicer.
        var ss = document.createElement('link');
        ss.rel = 'stylesheet';
        ss.href = chrome.extension.getURL('markdown.css');
        document.head.appendChild(ss);
    }

}(document));

Works for http://getcomposer.org/doc/00-intro.md, could be further improved by having a list of excluded doctypes.

felixrabe commented 10 years ago

About the referenced just above — it could only be closed by disabling Markdown Preview 0.6. Please fix this issue. (+1)