michaelfox + markdown 48
css for use with marked.app — Gist
august 2011 by michaelfox
/*
My hacked up copy of Marked.app/Contents/Resources/gridless.css
Changes:
1. Smaller headings
2. No scrollbars
3. Styling of definition lists ala LaTeX description lists
4. Dark color scheme
Original information from gridless.css:
Main stylesheet: contains CSS normalization, base styles, typography with a vertical rhythm and some mobile-first media queries
Credit is left where credit is due
Much content and inspiration was taken from the normalize.css project: http://necolas.github.com/normalize.css/ and https://github.com/jonathantneal/normalize.css
*/
/* `HTML5 elements display-role
---------------------------------------- */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, dialog {
display: block;
}
/* `Base structure
---------------------------------------- */
html {
height: 100%;
font-size: 100%;
-webkit-text-size-adjust: 100%; /* Remove iOS text size adjust without disabling user zoom */
}
body {
margin: 0;
min-height: 100%;
font: 16px/1.625 Georgia, serif;
*font-size: 1em; /* IE7 and older: IE can't resize px based text and most mobiles don't default the text to 16px */
color: #ddd; /* White on black is too much contrast, #ddd is a lot better */
background: black;
}
/* Font settings */
body, button, input, select, textarea {
font: 16px/1.625 Georgia, serif;
*font-size: 1em; /* IE7 and older: IE can't resize px based text and most mobiles don't default the text to 16px */
color: #ddd; /* White on black is too much contrast, #ddd is a lot better */
}
p, blockquote, q, pre, address, hr, code, samp, dl, ol, ul, form, table, fieldset, menu, h4, h5, h6, img {
margin: 0 0 1.625em;
}
/* `Headings and small
---------------------------------------- */
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
font-family: 'Palatino', 'Palatino Linotype', 'Book Antiqua', 'FreeSerif', serif;
}
h1 {
font-size: 2em; /* 68px */
line-height: 1.1471em;
margin: 0 0 0.3824em;
}
h2 {
font-size: 1.5em; /* 42px */
line-height: 1.2381em;
margin: 0 0 0.619em;
}
h3 {
font-size: 1.25em; /* 26px */
line-height: 1em;
margin: 0 0 1em;
}
h4, h5, h6 {
font-size: 1em;
}
small {
font-size: 0.625em; /* 10px */
margin: 0 0 2.6em;
}
/* `Code
---------------------------------------- */
/* Allows line wrapping of 'pre' */
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
pre, code, kbd, samp {
font: 1em/1.625em Menlo, Consolas, 'DejaVu Sans Mono', Monaco, monospace;
}
/* `Tables
---------------------------------------- */
table {
border-collapse: collapse;
border-spacing: 0;
}
th {
text-align: left;
}
tr, th, td {
padding-right: 1.625em;
border-bottom: 1px solid #333;
}
/* `Forms
---------------------------------------- */
form {
margin: 0;
}
fieldset {
border: 0;
padding: 0;
}
textarea {
overflow: auto;
vertical-align: top;
}
legend {
*margin-left: -7px;
}
button, input, select, textarea {
font: 1em/1.625em Georgia, serif;
color: #ddd;
vertical-align: baseline;
*vertical-align: middle; /* IE7 and older */
}
button, input {
line-height: normal;
*overflow: visible;
}
button, input[type="button"], input[type="reset"], input[type="submit"] {
cursor: pointer;
-webkit-appearance: button;
}
input[type="checkbox"], input[type="radio"] {
box-sizing: border-box;
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
button::-moz-focus-inner, input::-moz-focus-inner {
border: 0;
padding: 0;
}
/* `Quotes
---------------------------------------- */
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
content: '';
content: none;
}
blockquote, q, cite {
font-style: italic;
}
blockquote {
padding-left: 1.625em;
border-left: 3px solid #ccc;
}
blockquote > p {
padding: 0;
}
/* `Lists
---------------------------------------- */
ul, ol {
list-style-position: inside;
padding: 0;
}
li ul, li ol {
margin: 0 1.625em;
}
dt {
font-weight: bold;
float: left;
clear: left;
padding-right: 1em;
}
dl {
padding: 0;
}
dd p {
display: inline;
}
/* `Hyperlinks
---------------------------------------- */
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:focus {
outline: thin dotted;
}
/* Better CSS outline suppression: people.opera.com/patrickl/experiments/keyboard/test */
a:hover, a:active {
outline: none;
}
/* `Figures and images
---------------------------------------- */
figure {
margin: 0;
}
img {
border: 0;
-ms-interpolation-mode: bicubic; /* Improve IE's resizing of images: http://css-tricks.com/ie-fix-bicubic-scaling-for-images */
}
/* `Abbreviations
---------------------------------------- */
abbr[title], dfn[title] {
border-bottom: 1px dotted #333;
cursor: help;
}
/* `Marked/inserted and deleted text
---------------------------------------- */
ins, mark {
text-decoration: none;
}
mark {
background: #ff0;
}
ins {
background: #ff9;
}
del {
text-decoration: line-through;
}
/* `Others
---------------------------------------- */
strong, b, dt {
font-weight: bold;
}
dfn {
font-style: italic;
}
var, address {
font-style: normal;
}
/* Position 'sub' and 'sup' without affecting line-height: gist.github.com/413930 */
sub, sup {
font-size: 0.625em;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* `Clearfix hack: http://nicolasgallagher.com/micro-clearfix-hack/
---------------------------------------- */
.cf:before, .cf:after {
content: "";
display: table;
}
.cf:after {
clear: both;
}
.cf {
*zoom: 1;
}
/* `Default (mobile) styles
---------------------------------------- */
/* Centering pages without a wrapper: http://www.camendesign.com/code/developpeurs_sans_frontieres */
/* The body will work like a 'div#wrapper': add the background of the page to the 'html' tag and the background of the wrapper to the 'body' tag */
body {
width: 92%;
margin: 0 auto;
}
/* `Wide mobile devices styles
---------------------------------------- */
@media only screen and (min-width: 480px) {
body {
}
}
/* `Tablets/netbooks styles
---------------------------------------- */
@media only screen and (min-width: 768px) {
body {
}
}
/* `Desktop devices styles
---------------------------------------- */
@media only screen and (min-width: 1024px) {
body {
}
}
/* `Print styles
---------------------------------------- */
@media print {
* {
background: transparent !important;
color: black !important; /* The woes of CSS color in print typography: sanbeiji.com/archives/953 */
text-shadow: none !important;
filter: none !important;
-ms-filter: none !important;
}
a, a:visited {
color: #222 !important;
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
/* Do not show javascript and internal links */
a[href^="javascript:"]:after, a[href^="#"]:after {
content: "";
}
/* Printing Tables: css-discuss.incutio.com/wiki/Printing_Tables */
thead {
display: table-header-group;
}
tr, img {
page-break-inside: avoid;
}
@page {
margin: 0.5cm;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3{
page-break-after: avoid;
}
}
.footnote {
font-size: .8em;
vertical-align: super;
color: rgb(13,110,161)
}
#contentdiv img {
max-width: 100%
}
@media print {body {
overflow: auto
}
#wrapper {
background: #fff;
position: relative
}
#contentdiv {
position: relative;
background: transparent;
color: #303030;
text-indent: 0px;
padding: 10px;
font-size:85%;
}
}
@media screen {
body {
overflow: hidden
}
.inverted, .inverted #wrapper { background:#eee !important }
.inverted #contentdiv {background:transparent !important }
.inverted p,.inverted td,.inverted li,.inverted h1,.inverted h2,
.inverted h3,.inverted h4, .inverted h5, .inverted h6, .inverted pre,
.inverted code,.inverted th {
color:#111 !important;
}
.inverted a { color:#fff;text-decoration:underline }
#wrapper {
background: #333;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
#contentdiv {
position: fixed;
top: 5px;
left: 5px;
right: 5px;
bottom: 5px;
background: transparent;
color: #ccc;
overflow: auto;
text-indent: 0px;
padding: 15px;
margin: 10px;
}
#contentdiv::-webkit-scrollbar {
width: 6px;
display: none;
}
#contentdiv::-webkit-scrollbar:horizontal {
height: 6px;
display: none
}
#contentdiv::-webkit-scrollbar-track {
background: transparent;
-webkit-border-radius: 0;
right: 10px;
display: none;
}
#contentdiv::-webkit-scrollbar-track:disabled {
display: none
}
#contentdiv::-webkit-scrollbar-thumb {
border-width: 0;
min-height: 20px;
background: #aaa;
opacity: 0.2;
-webkit-border-radius: 5px;
display: none;
}
}
.footnotes p {display:inline}
marked
css
markdown
My hacked up copy of Marked.app/Contents/Resources/gridless.css
Changes:
1. Smaller headings
2. No scrollbars
3. Styling of definition lists ala LaTeX description lists
4. Dark color scheme
Original information from gridless.css:
Main stylesheet: contains CSS normalization, base styles, typography with a vertical rhythm and some mobile-first media queries
Credit is left where credit is due
Much content and inspiration was taken from the normalize.css project: http://necolas.github.com/normalize.css/ and https://github.com/jonathantneal/normalize.css
*/
/* `HTML5 elements display-role
---------------------------------------- */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, dialog {
display: block;
}
/* `Base structure
---------------------------------------- */
html {
height: 100%;
font-size: 100%;
-webkit-text-size-adjust: 100%; /* Remove iOS text size adjust without disabling user zoom */
}
body {
margin: 0;
min-height: 100%;
font: 16px/1.625 Georgia, serif;
*font-size: 1em; /* IE7 and older: IE can't resize px based text and most mobiles don't default the text to 16px */
color: #ddd; /* White on black is too much contrast, #ddd is a lot better */
background: black;
}
/* Font settings */
body, button, input, select, textarea {
font: 16px/1.625 Georgia, serif;
*font-size: 1em; /* IE7 and older: IE can't resize px based text and most mobiles don't default the text to 16px */
color: #ddd; /* White on black is too much contrast, #ddd is a lot better */
}
p, blockquote, q, pre, address, hr, code, samp, dl, ol, ul, form, table, fieldset, menu, h4, h5, h6, img {
margin: 0 0 1.625em;
}
/* `Headings and small
---------------------------------------- */
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
font-family: 'Palatino', 'Palatino Linotype', 'Book Antiqua', 'FreeSerif', serif;
}
h1 {
font-size: 2em; /* 68px */
line-height: 1.1471em;
margin: 0 0 0.3824em;
}
h2 {
font-size: 1.5em; /* 42px */
line-height: 1.2381em;
margin: 0 0 0.619em;
}
h3 {
font-size: 1.25em; /* 26px */
line-height: 1em;
margin: 0 0 1em;
}
h4, h5, h6 {
font-size: 1em;
}
small {
font-size: 0.625em; /* 10px */
margin: 0 0 2.6em;
}
/* `Code
---------------------------------------- */
/* Allows line wrapping of 'pre' */
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
pre, code, kbd, samp {
font: 1em/1.625em Menlo, Consolas, 'DejaVu Sans Mono', Monaco, monospace;
}
/* `Tables
---------------------------------------- */
table {
border-collapse: collapse;
border-spacing: 0;
}
th {
text-align: left;
}
tr, th, td {
padding-right: 1.625em;
border-bottom: 1px solid #333;
}
/* `Forms
---------------------------------------- */
form {
margin: 0;
}
fieldset {
border: 0;
padding: 0;
}
textarea {
overflow: auto;
vertical-align: top;
}
legend {
*margin-left: -7px;
}
button, input, select, textarea {
font: 1em/1.625em Georgia, serif;
color: #ddd;
vertical-align: baseline;
*vertical-align: middle; /* IE7 and older */
}
button, input {
line-height: normal;
*overflow: visible;
}
button, input[type="button"], input[type="reset"], input[type="submit"] {
cursor: pointer;
-webkit-appearance: button;
}
input[type="checkbox"], input[type="radio"] {
box-sizing: border-box;
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
button::-moz-focus-inner, input::-moz-focus-inner {
border: 0;
padding: 0;
}
/* `Quotes
---------------------------------------- */
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
content: '';
content: none;
}
blockquote, q, cite {
font-style: italic;
}
blockquote {
padding-left: 1.625em;
border-left: 3px solid #ccc;
}
blockquote > p {
padding: 0;
}
/* `Lists
---------------------------------------- */
ul, ol {
list-style-position: inside;
padding: 0;
}
li ul, li ol {
margin: 0 1.625em;
}
dt {
font-weight: bold;
float: left;
clear: left;
padding-right: 1em;
}
dl {
padding: 0;
}
dd p {
display: inline;
}
/* `Hyperlinks
---------------------------------------- */
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:focus {
outline: thin dotted;
}
/* Better CSS outline suppression: people.opera.com/patrickl/experiments/keyboard/test */
a:hover, a:active {
outline: none;
}
/* `Figures and images
---------------------------------------- */
figure {
margin: 0;
}
img {
border: 0;
-ms-interpolation-mode: bicubic; /* Improve IE's resizing of images: http://css-tricks.com/ie-fix-bicubic-scaling-for-images */
}
/* `Abbreviations
---------------------------------------- */
abbr[title], dfn[title] {
border-bottom: 1px dotted #333;
cursor: help;
}
/* `Marked/inserted and deleted text
---------------------------------------- */
ins, mark {
text-decoration: none;
}
mark {
background: #ff0;
}
ins {
background: #ff9;
}
del {
text-decoration: line-through;
}
/* `Others
---------------------------------------- */
strong, b, dt {
font-weight: bold;
}
dfn {
font-style: italic;
}
var, address {
font-style: normal;
}
/* Position 'sub' and 'sup' without affecting line-height: gist.github.com/413930 */
sub, sup {
font-size: 0.625em;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* `Clearfix hack: http://nicolasgallagher.com/micro-clearfix-hack/
---------------------------------------- */
.cf:before, .cf:after {
content: "";
display: table;
}
.cf:after {
clear: both;
}
.cf {
*zoom: 1;
}
/* `Default (mobile) styles
---------------------------------------- */
/* Centering pages without a wrapper: http://www.camendesign.com/code/developpeurs_sans_frontieres */
/* The body will work like a 'div#wrapper': add the background of the page to the 'html' tag and the background of the wrapper to the 'body' tag */
body {
width: 92%;
margin: 0 auto;
}
/* `Wide mobile devices styles
---------------------------------------- */
@media only screen and (min-width: 480px) {
body {
}
}
/* `Tablets/netbooks styles
---------------------------------------- */
@media only screen and (min-width: 768px) {
body {
}
}
/* `Desktop devices styles
---------------------------------------- */
@media only screen and (min-width: 1024px) {
body {
}
}
/* `Print styles
---------------------------------------- */
@media print {
* {
background: transparent !important;
color: black !important; /* The woes of CSS color in print typography: sanbeiji.com/archives/953 */
text-shadow: none !important;
filter: none !important;
-ms-filter: none !important;
}
a, a:visited {
color: #222 !important;
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
/* Do not show javascript and internal links */
a[href^="javascript:"]:after, a[href^="#"]:after {
content: "";
}
/* Printing Tables: css-discuss.incutio.com/wiki/Printing_Tables */
thead {
display: table-header-group;
}
tr, img {
page-break-inside: avoid;
}
@page {
margin: 0.5cm;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3{
page-break-after: avoid;
}
}
.footnote {
font-size: .8em;
vertical-align: super;
color: rgb(13,110,161)
}
#contentdiv img {
max-width: 100%
}
@media print {body {
overflow: auto
}
#wrapper {
background: #fff;
position: relative
}
#contentdiv {
position: relative;
background: transparent;
color: #303030;
text-indent: 0px;
padding: 10px;
font-size:85%;
}
}
@media screen {
body {
overflow: hidden
}
.inverted, .inverted #wrapper { background:#eee !important }
.inverted #contentdiv {background:transparent !important }
.inverted p,.inverted td,.inverted li,.inverted h1,.inverted h2,
.inverted h3,.inverted h4, .inverted h5, .inverted h6, .inverted pre,
.inverted code,.inverted th {
color:#111 !important;
}
.inverted a { color:#fff;text-decoration:underline }
#wrapper {
background: #333;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
#contentdiv {
position: fixed;
top: 5px;
left: 5px;
right: 5px;
bottom: 5px;
background: transparent;
color: #ccc;
overflow: auto;
text-indent: 0px;
padding: 15px;
margin: 10px;
}
#contentdiv::-webkit-scrollbar {
width: 6px;
display: none;
}
#contentdiv::-webkit-scrollbar:horizontal {
height: 6px;
display: none
}
#contentdiv::-webkit-scrollbar-track {
background: transparent;
-webkit-border-radius: 0;
right: 10px;
display: none;
}
#contentdiv::-webkit-scrollbar-track:disabled {
display: none
}
#contentdiv::-webkit-scrollbar-thumb {
border-width: 0;
min-height: 20px;
background: #aaa;
opacity: 0.2;
-webkit-border-radius: 5px;
display: none;
}
}
.footnotes p {display:inline}
august 2011 by michaelfox
MultiMarkdown
june 2011 by michaelfox
Go to the downloads page on github to find the latest versions of:
MultiMarkdown installer for Mac OS X
MMD support files installer for Mac OS X
QuickLook generator for MMD text files and for OPML files
Mac OS X drag and drop applications for MMD
MultiMarkdown installer for Windows
latest source code to compile MMD yourself (e.g. for *nix)
If you are interested in the LaTeX features, you also download the LaTeX support files on github.
You can also download:
LaTeX support files — required for compiling the sample documents, and useful for your own documents
MultiMarkdown Test Suite for developers
A gallery of sample MultiMarkdown documents demonstrating various output formats and features
A MMD bundle for TextMate
A MMD export plug-in for OmniOutliner
The MMD support files for other systems
downloads
latex
markdown
textmate
markup
tools
osx
MultiMarkdown installer for Mac OS X
MMD support files installer for Mac OS X
QuickLook generator for MMD text files and for OPML files
Mac OS X drag and drop applications for MMD
MultiMarkdown installer for Windows
latest source code to compile MMD yourself (e.g. for *nix)
If you are interested in the LaTeX features, you also download the LaTeX support files on github.
You can also download:
LaTeX support files — required for compiling the sample documents, and useful for your own documents
MultiMarkdown Test Suite for developers
A gallery of sample MultiMarkdown documents demonstrating various output formats and features
A MMD bundle for TextMate
A MMD export plug-in for OmniOutliner
The MMD support files for other systems
june 2011 by michaelfox
Pandoc - About pandoc
april 2011 by michaelfox
If you need to convert files from one markup format into another, pandoc is your swiss-army knife. Need to generate a man page from a markdown file? No problem. LaTeX to Docbook? Sure. HTML to MediaWiki? Yes, that too. Pandoc can read markdown and (subsets of) reStructuredText, textile, HTML, and LaTeX, and it can write plain text, markdown, reStructuredText, HTML, LaTeX, ConTeXt, PDF, RTF, DocBook XML, OpenDocument XML, ODT, GNU Texinfo, MediaWiki markup, textile, groff man pages, Emacs org-mode, EPUB ebooks, and S5 and Slidy HTML slide shows. PDF output (via LaTeX) is also supported with the included markdown2pdf wrapper script.
Pandoc understands a number of useful markdown syntax extensions, including document metadata (title, author, date); footnotes; tables; definition lists; superscript and subscript; strikeout; enhanced ordered lists (start number and numbering style are significant); delimited code blocks; markdown inside HTML blocks; and TeX math. Other options include “smart” punctuation, syntax highlighting, automatically generated tables of contents, and automatically generated citations (using citeproc-hs). If strict markdown compatibility is desired, all of these extensions can be turned off with a command-line flag.
Pandoc includes a Haskell library and a standalone executable. The library includes separate modules for each input and output format, so adding a new input or output format just requires adding a new module.
html
latex
markdown
markup
pdf
textile
text
convert
docbook
Pandoc understands a number of useful markdown syntax extensions, including document metadata (title, author, date); footnotes; tables; definition lists; superscript and subscript; strikeout; enhanced ordered lists (start number and numbering style are significant); delimited code blocks; markdown inside HTML blocks; and TeX math. Other options include “smart” punctuation, syntax highlighting, automatically generated tables of contents, and automatically generated citations (using citeproc-hs). If strict markdown compatibility is desired, all of these extensions can be turned off with a command-line flag.
Pandoc includes a Haskell library and a standalone executable. The library includes separate modules for each input and output format, so adding a new input or output format just requires adding a new module.
april 2011 by michaelfox
Make.text
february 2011 by michaelfox
javascript:(function(){/** Make.text 1.5. Trevor Jim. License: GPL v2 (www.fsf.org/copyleft/gpl.html). **/ var logging = false; var logString = ''; var unhandled = {}; function log(exn,msg) { if (!logging) return; logString += msg + ': ' + exn + '%5cn'; } var w = window.open(''); var d = w.document; var last = null; function addText(s) { if (last != null) d.write(last); last = s; } function llapLast(s) { if (last) last = last.replace(/ $/,s); } function finishOutput() { addText(%22%22); } var links = new Array(window.location); var rlinks = {}; rlinks[window.location] = 0; var linkTitles = new Array(); var atP = true; var atLeft = true; var atNoWS = true; var left = '%5cn'; function pushLeft(s) { var oldLeft = left; left += s; if (atP) addText(s); else p(); function r() { left = oldLeft; atP = atLeft = false; p(); } return r; } function p() { if (atP) return; if (!atLeft) { addText(left); atLeft = true; } addText(left); atP = atNoWS = true; } function llap(s) { if (!atLeft) { addText(left.replace(/ $/,s)); atLeft = atP = atNoWS = true; return; } else { llapLast(s); return; } } function br(s) { addText(' ' + left); atLeft = atNoWS = true; } function o(s) { if (!s) return; if (!inPRE) { if (atNoWS) s = s.replace(/^[ %5ct%5cn]+/,''); else if (/^[ %5ct]*%5cn/.test(s)) s = s.replace(/^[ %5ct%5cn]+/,'%5cn'); else s = s.replace(/^[ %5ct]+/,' '); } if (s == '') return; atP = /%5cn%5cn$/.test(s); atLeft = /%5cn$/.test(s); atNoWS = /[ %5ct%5cn]$/.test(s); addText(s.replace(/%5cn/g,left)); } function oThunk(s) { function r() { o(s); } return r; } var inPRE = false; function pre() { var old = inPRE; inPRE = true; function r() { inPRE = old; } return r; } var inCODE = false; function code() { var old = inCODE; inCODE = true; function r() { inCODE = old; } return r; } var inOL = false; function ol() { var old = inOL; inOL = true; function r() { inOL = old; } return r; } function ul() { var old = inOL; inOL = false; function r() { inOL = old; } return r; } var replacements = { '%5c%5c%5c%5c': '%5c%5c%5c%5c', '%5c%5c[': '%5c%5c[', '%5c%5c]': '%5c%5c]', '>': '%5c%5c>', '_': '%5c%5c_', '%5c%5c*': '%5c%5c*', '`': '%5c%5c`', '#': '%5c%5c#', '([0-9])%5c%5c.(%5c%5cs|$)': '$1%5c%5c.$2', '%5cu00a9': '(c)', '%5cu00ae': '(r)', '%5cu2122': '(tm)', '%5cu00a0': ' ', '%5cu00b7': '%5c%5c*', '%5cu2002': ' ', '%5cu2003': ' ', '%5cu2009': ' ', '%5cu2018': %22'%22, '%5cu2019': %22'%22, '%5cu201c': '%22', '%5cu201d': '%22', '%5cu2026': '...', '%5cu2013': '--', '%5cu2014': '---' }; var regex = {}; for (var key in replacements) { regex[key] = new RegExp(key, 'g'); } function nonPREproc(s) { s = s.replace(/%5cn([ %5ct]*%5cn)+/g,'%5cn'); s = s.replace(/%5cn[ %5ct]+/g,'%5cn'); s = s.replace(/[ %5ct]+/g,' '); for (var key in replacements) { s = s.replace(regex[key], replacements[key]); } return s; } function inCODEproc(s) { s = s.replace(/`/g,'%5c%5c`'); return s; } function isAbsolute(s) { return /^[a-zA-Z]([a-zA-Z0-9+-.])*:/.test(s); } function isSiteRelative(s) { return /^%5cx2f/.test(s); } function isPageRelative(s) { return /^#/.test(s); } var urlBase = location.href; var urlDir = urlBase.replace(/%5c/[^%5c/]*$/,'/'); var urlPage = urlBase.replace(/#[^%5c/#]*$/,''); var urlSite = urlBase; if (isAbsolute(urlBase)) { urlSite = urlBase.replace(/^([a-zA-Z]([a-zA-Z0-9+-.])*:%5c/%5c/[^%5c/]*).*/,'$1'); } function makeAbsolute(s) { if (isAbsolute(s)) return s; else if (isSiteRelative(s)) return urlSite + s; else if (isPageRelative(s)) return urlPage + s; else return urlDir + s; } function urlEscape(s) { s = makeAbsolute(s); s = s.replace(/%5cx22/g,'%2522'); s = s.replace(/%5cx27/g,'%2527'); s = s.replace(/%5cx20/g,'%2520'); s = s.replace(/%5cx09/g,'%2509'); s = s.replace(/%5cx0a/g,'%250a'); s = s.replace(/%5cx0d/g,'%250d'); s = s.replace(/%5cx28/g,'%2528'); s = s.replace(/%5cx29/g,'%2529'); s = s.replace(/%5cx5b/g,'%255b'); s = s.replace(/%5cx5d/g,'%255d'); s = s.replace(/%5cx5c/g,'%255c'); return s; } if (!window.Node) Node = {}; if (!Node.ELEMENT_NODE) Node.ELEMENT_NODE = 1; if (!Node.TEXT_NODE) Node.TEXT_NODE = 3; function dfs(e) { if (window.getComputedStyle) { try { var style = window.getComputedStyle(e,null); if (style.getPropertyValue %26%26 style.getPropertyValue('display') == 'none') return; } catch (exn) { log(exn,'computedStyle'); } } if (e.nodeType == Node.ELEMENT_NODE) { var after = null; var skipChildren = false; try { switch (e.tagName) { case 'HEAD': case 'STYLE': case 'SCRIPT': case 'SELECT': case 'OPTION': case 'NOSCRIPT': case 'NOFRAMES': case 'INPUT': case 'BUTTON': case 'SELECT': case 'TEXTAREA': case 'LABEL': skipChildren = true; break; case 'BODY': case 'FORM': break; case 'H1': p(); o('# '); break; case 'H2': p(); o('## '); break; case 'H3': p(); o('### '); break; case 'H4': p(); o('#### '); break; case 'H5': p(); o('##### '); break; case 'H6': p(); o('###### '); break; case 'P': p(); break; case 'DIV': p(); break; case 'BR': br(); break; case 'HR': p(); o('--------------------------------'); p(); break; case 'EM': case 'I': case 'U': o('_'); atNoWS = true; after = oThunk('_'); break; case 'DT': p(); case 'STRONG': case 'B': o('**'); atNoWS = true; after = oThunk('**'); break; case 'OL': var r1 = pushLeft(' '); var r2 = ol(); after = function() { r1(); r2(); }; break; case 'UL': var r1 = pushLeft(' '); var r2 = ul(); after = function() { r1(); r2(); }; break; case 'LI': if (inOL) llap('1. '); else llap('* '); break; case 'PRE': var r1 = pushLeft(' '); var r2 = pre(); after = function() { r1(); r2(); }; break; case 'CODE': if (!inPRE) { o('`'); var r1 = code(); var r2 = oThunk('`'); after = function() { r1(); r2(); }; } break; case 'DD': case 'BLOCKQUOTE': after = pushLeft('> '); break; case 'A': var href = e.getAttribute('href'); if (!href) break; href = urlEscape(href); var n; if (rlinks[href]) { n = rlinks[href]; } else { n = links.length; links[n] = href; rlinks[href] = n; if (e.getAttribute('title')) linkTitles[n] = e.getAttribute('title'); } o('['); atNoWS = true; after = oThunk('][' + n + ']'); break; case 'IMG': skipChildren = true; var src = e.getAttribute('src'); if (!src) break; src = urlEscape(src); var alt = e.getAttribute('alt'); if (!alt) alt = ''; o(''); break; case 'IFRAME': case 'FRAME': skipChildren = true; try { if (e.contentDocument %26%26 e.contentDocument.documentElement) { dfs(e.contentDocument.documentElement); } } catch (exn) { log(exn,'contentDocument'); } break; case 'TR': after = p; break; default: if (logging) unhandled[e.tagName] = null; break; } } catch (exn) { log(exn,e.tagName); } if (!skipChildren) { var c = e.childNodes; for (var i = 0; i < c.length; i++) { dfs(c[i]); } } if (after) after(); } else if (e.nodeType == Node.TEXT_NODE) { if (inPRE) o(e.nodeValue); else if (inCODE) o(inCODEproc(e.nodeValue)); else o(nonPREproc(e.nodeValue)); } } addText('<pre>'); addText('%26lt;!-- [' + window.document.title + '][0] --%26gt;%5cn%5cn'); dfs(window.document.body); addText('%5cn%5cn'); for (var i = 0; i < links.length; i++) { var title = '%5cn'; if (linkTitles[i]) title = ' %22' + linkTitles[i] + '%22%5cn'; if (links[i]) addText('[' + i + ']: ' + links[i] + title); } if (logging) { addText('%5cn%5cn%26lt;!-- Make.text debugging:%5cn'); for (var i in unhandled) addText('Not handled: ' + i + '%5cn'); addText('%5cn'); addText(logString); addText('--%26gt;%5cn'); } addText('</pre>'); finishOutput(); d.close(); })();void(0);
html
javascript
markdown
markup
convert
format
bookmarklets
february 2011 by michaelfox
related tags
admin ⊕ app ⊕ applescript ⊕ automation ⊕ automator ⊕ bookmarklets ⊕ bundle ⊕ byword ⊕ c ⊕ cli ⊕ code ⊕ collection ⊕ config ⊕ content ⊕ convert ⊕ converter ⊕ css ⊕ data ⊕ demo ⊕ development ⊕ docbook ⊕ documentation ⊕ dotfiles ⊕ download ⊕ downloads ⊕ editor ⊕ ee ⊕ embed ⊕ environment ⊕ evernote ⊕ example ⊕ expressionengine ⊕ fonts ⊕ foobar ⊕ format ⊕ formulas ⊕ gist ⊕ git ⊕ github ⊕ github-repo ⊕ github-user:spf13 ⊕ help ⊕ html ⊕ icons ⊕ inspiration ⊕ ios ⊕ ipad ⊕ iphone ⊕ javascript ⊕ jquery ⊕ keyboardmaestro ⊕ latex ⊕ library ⊕ linux ⊕ lists ⊕ lorem ⊕ mac ⊕ macosx ⊕ man ⊕ markdown ⊖ marked ⊕ markup ⊕ math ⊕ md ⊕ merlinmann ⊕ omnioutliner ⊕ opml ⊕ osx ⊕ outline ⊕ parser ⊕ pdf ⊕ php ⊕ placeholder ⊕ plugins ⊕ prompter ⊕ python ⊕ reference ⊕ repo ⊕ repository ⊕ resources ⊕ ruby ⊕ sample ⊕ scripting ⊕ scripts ⊕ service ⊕ services ⊕ setup ⊕ shell ⊕ snippets ⊕ stylesheet ⊕ sublime ⊕ symbol ⊕ symbols ⊕ test ⊕ testdata ⊕ testing ⊕ text ⊕ textexpander ⊕ textile ⊕ textmate ⊕ tools ⊕ unix ⊕ vim ⊕ wiki ⊕ wishlist ⊕ wordpress ⊕ wysiwyg ⊕ xml ⊕Copy this bookmark: