borismus / markdown-preview

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

Chrome Extension Causes Page to Render Improperly #46

Open TedStudley opened 9 years ago

TedStudley commented 9 years ago

I've been having issues with the documentation for the factory_girl ruby gem. The page will render properly for a split-second, then turns into this:

screen shot 2015-09-01 at 11 54 56 am

when it should actually look like this:

screen shot 2015-09-01 at 12 14 04 pm

I traced the issue using the developer console, and found that the page mangling is happening on line 6 of markdownify.js, which is part of this chrome extension. Sure enough, removing or disabling the extension will cause the page to render properly again.

This seems to be caused by issue #10, but since that issue is so stale I figured it may be a good idea to open a new issue. markdown-preview is a very useful extension, but I sort of need to be able to read documentation.

A good work-around might be to check document.doctype when deciding whether or not to render as markdown. This pre-rendered markdown file has a doctype of <!DOCTYPE html>, while a few actual markdown files that I checked have doctype of null. I would assume that this should catch quite a few cases where the extension is trying to re-render markdown that's already been rendered, without preventing it from attempting to render legitimate unrendered markdown unless somebody's being stupid about their doctypes.