Skip to content

Instantly share code, notes, and snippets.

@Andr3as
Last active August 29, 2015 14:03
Show Gist options
  • Save Andr3as/bfee6e814b6b2989a1a1 to your computer and use it in GitHub Desktop.
Save Andr3as/bfee6e814b6b2989a1a1 to your computer and use it in GitHub Desktop.
Display markdown preview in a modal
<!--
Copyright (c) Codiad & Andr3as, distributed
as-is and without warranty under the MIT License.
See http://opensource.org/licenses/MIT for more information.
This information must remain intact.
-->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>__title__</title>
<link rel="stylesheet" href="plugins/Codiad-MarkdownPreview-master/markdown.css">
<script src="js/jquery-1.7.2.min.js"></script>
<script src="plugins/Codiad-MarkdownPreview-master/template.js"></script>
</head>
<body id="markdown_preview_modal">
<header>
Change layout: <button id="markdown">Markdown.css</button><button id="github">GitHub.css</button>
</header>
__content__
</body>
</html>
/*
* Copyright (c) Codiad & Andr3as, distributed
* as-is and without warranty under the MIT License.
* See http://opensource.org/licenses/MIT for more information.
* This information must remain intact.
*/
$(document).ready(function(){
var markdown = '<link rel="stylesheet" href="plugins/Codiad-MarkdownPreview-master/markdown.css">';
var github = '<link rel="stylesheet" href="plugins/Codiad-MarkdownPreview-master/github.css">';
$('#markdown').click(function(){
$('link[href="plugins/Codiad-MarkdownPreview-master/github.css"]').replaceWith(markdown);
});
$('#github').click(function(){
$('link[href="plugins/Codiad-MarkdownPreview-master/markdown.css"]').replaceWith(github);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment