Instantly share code, notes, and snippets.
- Star(1,106)
You must be signed in to star a gist - Fork(97)
You must be signed in to fork a gist
Save imjasonh/c00cdd7aece6945fb8ea to your computer and use it in GitHub Desktop.
* { | |
font-size:12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} | |
h1::before {content:"# "; } | |
h2::before {content:"## "; } | |
h3::before {content:"### "; } | |
h4::before {content:"#### "; } | |
h5::before {content:"##### "; } | |
h6::before {content:"###### "; } | |
strike::after,strike::before {content:"~~"; } | |
i::before,i::after {content:"*"; } | |
b::before,b::after {content:"**"; } | |
ol,ul {list-style: none;padding-left:0; } | |
ulli::before {content:"* "; } | |
olli::before {content:"1. "; } | |
code::before,code::after {content:"`"; } | |
pre::before {content:"```"attr(lang)"\A"; } | |
pre::after {content:"```\A"; } | |
a::before {content:"["; } | |
a::after {content:"]("attr(href)")"; } | |
tr::before {content:"| "; } | |
td::after {content:" | "; } | |
theadtd::after {content:" | \A-----| ";white-space: pre; } |
jomo commentedApr 10, 2015
@cash2m@jbrooksuk incrementing is nice but I prefer to use0.
for ordered lists. It makes it so much easier to insert a line somewhere without messing up the markup.
The number doesn't matter anyway, it just has to be[0-9]+\.
pluma commentedApr 11, 2015
Worked on something similar a while back but never used it for anything:https://gist.github.com/pluma/6b51b2601ddea34d5abf
timmc commentedApr 11, 2015
Of course, this doesn't actually reverse the (lossy) Markdown transformation. For example, the source9.
turns into an ordered list that looks like "1." and CSS won't reverse that. (I see this problem on reddit all the time.)
Cais commentedApr 13, 2015
Very cool ... now to find a place to implement/integrate this!
fvsch commentedApr 13, 2015
I did something similar a few years ago and updated it last year, if you want to check it out:
https://github.com/fvsch/remarkdown
grabcode commentedApr 14, 2015
That's actually the easiest way for me to remember/learn markdown. Thanks mate.
OrganicPanda commentedApr 14, 2015
I think the list styles should be something like:
ol,ul {list-style: none;padding-left:0; }ulli::before {content:"* "; }ol {counter-reset: section; }olli::before {counter-increment: section;content:counters(section,".")". ";}
nghuuphuoc commentedApr 15, 2015
Very, very nice!
zoghal commentedApr 15, 2015
woow
theory commentedApr 16, 2015
i::before, i::after, em::before, em::after { content: "*"; }b::before, b::after, strong::before, strong::after { content: "**"; }
kruszczynski commentedApr 17, 2015
That's brilliant!
myobie commentedApr 17, 2015
I did this for my current site at nathanherald.com, but I never imagined anyone else would do it! Awesome and thanks for sharing.
Avelar commentedApr 17, 2015
That's Awesome!
mrmlnc commentedApr 20, 2015
All of Genius is Simple! Awesome!
Can play with counters for lists.
elky commentedApr 21, 2015
Awesome. How aboutth
tag?
renestalder commentedApr 21, 2015
Cool idea. But just one question: What use case does this have? Because I'm not even able to copy & paste the visible output, thanks to the shadow DOM.
nolim1t commentedApr 23, 2015
This could prove useful for those who keep forgetting markdown markup but know HTML
jasonkarns commentedApr 23, 2015
I think everyone's ready for this gist to become a legit git repo :)
teeheehee commentedApr 25, 2015
Here's a handygreasemonkey script that takes this styling and applies it to any webpage by typing "md".
ChaseFlorell commentedMay 14, 2015
hr {height: 0px; border:none;}hr::after {content: "-----";}
Also,forked it to add.md
class support so that it's not necessarily global.
ChaseFlorell commentedMay 14, 2015
+1 for@jasonkarns comment. make it a repo that we can submit PR's to :)
0xMF commentedMay 14, 2015
Amazing...truly amazing. I am still recovering from it's simplicity and elegance.
ahmetb commentedMay 15, 2015
img
s?
tcelestino commentedMay 15, 2015
amazing!
👏
daftspaniel commentedMay 15, 2015
Funky!
Pierstoval commentedMay 18, 2015
There should be something done for thepre code {}
selector which is created in some Markdown parsers (especially when you have a language specified in the "```" block)
afolson commentedMay 21, 2015
I'd like to add my voice to the chorus of people suggesting that this become a repo. :D
jslegers commentedMay 28, 2015
When I try to actually copy/paste/select the generated characters, both Firefox and Chrome consistently skip any generated characters.
Judging by what I find on Stackoverflow, the problem seems to be neither OS nor browser specific :
- Select text in ::before or ::after pseudo-element
- Is it possible to select css generated content?
- How can I make generated content selectable?
That means you'll still need a nasty JS-based hack to actually copy-paste the generated output into a textarea on Github or elsewhere.
Workaround:
- Use Google Chrome
- Go to the print preview
- Copy-paste your result from the print preview
This technique is a bit convoluted, but it appears to be the best we've got so far.
ghost commentedJun 4, 2015
Awesome :)
hboon commentedOct 5, 2015
Thanks for sharing, ever since I saw this, I've been meaning to find a place to use it. I've just applied thislightly athttps://motionobj.com/wilfredapp/.