Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The xmp tag doesn't have to be a child of body #68

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/strapdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
var newNode = document.createElement('div');
newNode.className = 'container';
newNode.id = 'content';
document.body.replaceChild(newNode, markdownEl);
markdownEl.parentNode.replaceChild(newNode, markdownEl);

// Insert navbar if there's none
var newNode = document.createElement('div');
Expand Down
13 changes: 9 additions & 4 deletions v/0.2/strapdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,6 @@ doWork();}
var PR=win['PR']={'createSimpleLexer':createSimpleLexer,'registerLangHandler':registerLangHandler,'sourceDecorator':sourceDecorator,'PR_ATTRIB_NAME':PR_ATTRIB_NAME,'PR_ATTRIB_VALUE':PR_ATTRIB_VALUE,'PR_COMMENT':PR_COMMENT,'PR_DECLARATION':PR_DECLARATION,'PR_KEYWORD':PR_KEYWORD,'PR_LITERAL':PR_LITERAL,'PR_NOCODE':PR_NOCODE,'PR_PLAIN':PR_PLAIN,'PR_PUNCTUATION':PR_PUNCTUATION,'PR_SOURCE':PR_SOURCE,'PR_STRING':PR_STRING,'PR_TAG':PR_TAG,'PR_TYPE':PR_TYPE,'prettyPrintOne':win['prettyPrintOne']=prettyPrintOne,'prettyPrint':win['prettyPrint']=prettyPrint};if(typeof define==="function"&&define['amd']){define("google-code-prettify",[],function(){return PR;});}})();
;(function(window, document) {

// Hide body until we're done fiddling with the DOM
document.body.style.display = 'none';

//////////////////////////////////////////////////////////////////////
//
// Shims for IE < 9
Expand Down Expand Up @@ -343,6 +340,14 @@ var PR=win['PR']={'createSimpleLexer':createSimpleLexer,'registerLangHandler':re
scriptEls = document.getElementsByTagName('script'),
navbarEl = document.getElementsByClassName('navbar')[0];

if (!markdownEl) {
console.warn('No embedded Markdown found in this document for Strapdown.js to work on! Visit http://strapdownjs.com/ to learn more.');
return;
}

// Hide body until we're done fiddling with the DOM
document.body.style.display = 'none';

//////////////////////////////////////////////////////////////////////
//
// <head> stuff
Expand Down Expand Up @@ -396,7 +401,7 @@ var PR=win['PR']={'createSimpleLexer':createSimpleLexer,'registerLangHandler':re
var newNode = document.createElement('div');
newNode.className = 'container';
newNode.id = 'content';
document.body.replaceChild(newNode, markdownEl);
markdownEl.parentNode.replaceChild(newNode, markdownEl);

// Insert navbar if there's none
var newNode = document.createElement('div');
Expand Down