-
Notifications
You must be signed in to change notification settings - Fork 167
/
index.html
226 lines (207 loc) · 11.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Markdown.css - make HTML look like plain-text</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="http://mrcoles.com/demo/markdown-css/">
<link href="style.css" rel="stylesheet">
<link href="standard.css" rel="stylesheet">
<link href="markdown.css" rel="stylesheet">
</head>
<body>
<a href="https://github.com/mrcoles/markdown-css"><img class="forkme" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
<div id="content-top">
<div class="content-inner">
<a class="right" href="http://mrcoles.com">mrcoles.com</a>
<h1>Markdown.css</h1>
<p>
CSS to make HTML markup look like plain-text markdown.
</p>
<p>
The example below shows HTML that looks like
<a href="http://daringfireball.net/projects/markdown/">markdown</a>
because of the
<a href="https://github.com/mrcoles/markdown-css/blob/master/markdown.css"><code>markdown.css</code></a>
file. Click on the other options to also see what it looks like with
normal styling & as raw HTML.
</p>
<p>
Also, try out the experimental
<a href="javascript:(function()%7Bfunction%20callback()%7B(function(%24)%7Bvar%20jQuery%3D%24%3B%24('link%5Brel%3Dstylesheet%5D').add('style').remove()%3B%24('%5Bstyle%5D').attr('style'%2C%20'')%3B%24('head').append('%3Clink%20rel%3D%22stylesheet%22%20href%3D%22http%3A%2F%2Fmrcoles.com%2Fmedia%2Ftest%2Fmarkdown-css%2Fmarkdown.css%22%20type%3D%22text%2Fcss%22%20%2F%3E')%3B%24('body').addClass('markdown').css(%7Bwidth%3A%20'600px'%2C%20margin%3A%20'2em%20auto'%2C%20'word-wrap'%3A%20'break-word'%7D)%3B%24('a%20img').css(%7B'max-height'%3A%20'1em'%2C%20'max-width'%3A%20'1em'%7D)%7D)(jQuery.noConflict(true))%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.7.1%2Fjquery.min.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()">markdownify</a>
bookmarklet!
<!--
via http://mrcoles.com/bookmarklet/
$('link[rel=stylesheet]').add('style').remove();
$('[style]').attr('style', '');
$('head').append('<link rel="stylesheet" href="http://mrcoles.com/media/test/markdown-css/markdown.css" type="text/css" />');
$('body').addClass('markdown').css({width: '600px', margin: '2em auto', 'word-wrap': 'break-word'});
$('a img').css({'max-height': '1em', 'max-width': '1em'});
-->
</p>
</div>
</div>
<div id="content-main">
<div class="content-inner">
<div id="header">
<div class="content-inner clr">
<a class="demo" href="#" onclick="return false">« demo »</a>
<ul id="toggles">
<li><a href="#html" onclick="return false"><HTML/></a></li>
<li><a href="#standard" onclick="return false">normal styles</a></li>
<li><a class="active" href="#markdown" onclick="return false">markdown.css</a></li>
</ul>
</div>
</div>
<div id="md-example" class="markdown">
<h1>HTML that looks like markdown</h1>
<p>When this section is styled by <code>markdown.css</code> it looks like plain-text, despite being HTML. Inspect it with firebug or click on <HTML/> to see the markup.</p>
<p>A <strong>strong tag</strong> and an <em>em tag</em> get styled like so.</p>
<p>How about a link to <a href="http://mrcoles.com">my site</a>?</p>
<h2>H2 header</h2>
<h3>Lists</h3>
<ul>
<li>they look like this</li>
<li>it’s how you’d format them in pure markdown, if you took the time to indent when it wrapped to a new line.</li>
</ul>
<h3>Ordered lists</h3>
<ol>
<li>here’s one line from a numbered list</li>
<li>here’s another</li>
<li>in markdown, the actual numbers don’t matter—you can toggle this with the class <a href="#" onclick="$('body').toggleClass('markdown-ones');return false"><code>markdown-ones</code></a></li>
</ol>
<h3>Block quotes</h3>
<blockquote>
This is a blockquote that extends<br>
to multiple lines.<br><br>
With repeating email-style angle brackets.
</blockquote>
<h3>Code blocks</h3>
<pre><code>(function() {
console.log('code blocks indent four spaces');
})()</code></pre>
<h3>Different headers</h3>
<h4>h4 header</h4>
<h5>h5 header</h5>
<h6>h6 header</h6>
<hr>
<p>That’s an hr above. It just works!</p>
<p>
However, images will still look like images. Deal with it.
</p>
<p>
<img alt="kitten" src="http://placekitten.com/g/180/200">
</p>
<p>
Made by <a href="http://mrcoles.com">Peter Coles</a> /<br>
aka <a href="https://twitter.com/lethys">@lethys</a> /<br>
code on <a href="https://github.com/mrcoles/markdown-css">github</a>
</p>
</div>
<p>Get the <a href="https://github.com/mrcoles/markdown-css/blob/master/markdown.css">markdown.css</a> now!</p>
<p>Since sharing this with people, I have learned about an <a href="http://fvsch.com/code/remarkdown/">older markdown CSS project</a> that does the same sort of things in a very similar way. So it goes. Great job, Florent!</p>
<br><br><br><br>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>
// add html div
$('<div>', {
id: 'md-html',
text: $('#md-example').html().replace(/ {20}/g, '')
}).insertAfter('#md-example').hide();
// toggle click handler
$('#toggles').find('a').click(function(e) {
e.preventDefault();
var $this = $(this),
action = $this.attr('href').substring(1),
$example = $('#md-example'),
$html = $('#md-html');
if ('html' == action) {
$example.hide();
$html.show();
} else {
$html.hide();
$example.show().attr('class', action);
}
$('#toggles').find('.active').removeClass('active');
$this.addClass('active')
});
$(function() {
// scroll handler
var top = $('#header').offset().top, fixed = false, $window = $(window);
$window.on('scroll', function(e) {
var scrollTop = $window.scrollTop();
if (fixed && scrollTop < top) {
fixed = false;
$('.fixed').removeClass('fixed');
} else if (!fixed && scrollTop >= top) {
fixed = true;
$('#header').add('#md-html').add('#md-example').addClass('fixed');
}
});
// demo
var demoing = false, delay = 4000;
var $msg = $('<div>', {'class': 'message'}).appendTo('body');
$('.demo').click(function(e) {
if (demoing) {
$msg.find('a.next').click();
return false;
}
demoing = true;
var $toggles = $('#toggles');
var steps = [
{text: '1. This is some HTML code ↑',
link: 'next →',
click: 'a[href=#html]'},
{text: '2. It normally renders like this ↑',
prevLink: '← prev',
link: 'next →',
click: 'a[href=#standard]'},
{text: '3. but adding markdown.css to the page makes it look like markdown!',
prevLink: '← prev',
link: 'done.',
click: 'a[href=#markdown]'}
];
var curStep = -1;
$msg.html('<div><span></span><a class="next" href="#"></a><a class="prev" href="#"></a></div>')
.find('a').click(function(e) {
e.preventDefault();
var next = $(this).hasClass('next');
curStep += next ? 1 : -1;
var step = steps[curStep];
console.log('step?', curStep, step, 'next?', next);
if (step) {
$msg.find('span').text(step.text);
$msg.find('a.next').text(step.link);
if (step.prevLink) {
$msg.find('a.prev').text(step.prevLink).show()
} else {
$msg.find('a.prev').hide();
}
$toggles.find(step.click).click();
$msg.fadeIn();
} else {
$msg.fadeOut('normal', function() {
demoing = false;
});
}
});
$msg.find('a.next').click();
if ($window.scrollTop() < top) {
$window.scrollTop(top - 1);
}
});
});
</script>
<script>
if (/^https?:\/\/mrcoles.com\//.test(window.location.href)) {
var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-4202460-2']); _gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = 'http://www.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
}
</script>
</body>
</html>