News for hackers. Stuff that matters.
Re:Show HN: CSS to render Markdown as unrendered Markdown by jbrooksuk on Friday April 10, 2015 @12:48PM (#9355541)
This is pretty nice for a "toggle source" feature. I added the use of CSS counters: https://gist.github.com/jbrooksuk/2d6989c35c77bf0c62f9
Re:Show HN: CSS to render Markdown as unrendered Markdown by rkuykendall-com on Friday April 10, 2015 @03:16PM (#9356526)
Except it excludes the css content when you copy it, so it wouldn't really work for that feature.
Re:Show HN: CSS to render Markdown as unrendered Markdown by michaelmior on Friday April 10, 2015 @02:03PM (#9356024)
I think a more accurate description is that this renders HTML as unrendered Markdown.
Re:Show HN: CSS to render Markdown as unrendered Markdown by elwell on Saturday April 11, 2015 @02:38AM (#9358748)
Yes. Also, the word elegantly should be somewhere in there.
Re:Show HN: CSS to render Markdown as unrendered Markdown by masukomi on Sunday April 12, 2015 @07:42AM (#9363016)
I don't think it quite makes it to "elegantly" because it's not actually useful markdown. I can't copy it and do anything with it because all the tags disappear. :/
Re:Show HN: CSS to render Markdown as unrendered Markdown by Foomandoonian on Friday April 10, 2015 @12:36PM (#9355466)
See also ReMarkdown: http://fvsch.com/code/remarkdown/

I'm sure there was another one too. I was going to make a WordPress theme with it at the time, but never got around to it.

You can go in the opposite direction with markdown.css too: http://kevinburke.bitbucket.org/markdowncss/

Re:Show HN: CSS to render Markdown as unrendered Markdown by neckro23 on Friday April 10, 2015 @12:43PM (#9355500)
This is almost perfectly useless.

I approve.

Re:Show HN: CSS to render Markdown as unrendered Markdown by phyzome on Saturday April 11, 2015 @11:26AM (#9359625)
Of course, it doesn't actually reverse the (lossy) Markdown transformation. For example, the source "9." turns into an ordered list that looks like "1." and CSS won't reverse that.
Re:Show HN: CSS to render Markdown as unrendered Markdown by captn3m0 on Friday April 10, 2015 @11:48AM (#9355091)
Any usecases for this?

I was thinking that this could be useful for giving people markdown to copy directly, but css:before and after doesn't get copied.

I'm so gonna use this _somewhere_, just not sure where.

Re:Show HN: CSS to render Markdown as unrendered Markdown by ImJasonH on Friday April 10, 2015 @11:51AM (#9355106)
I didn't have any real use cases in mind when I made it, I just wanted to see if it was possible.

In theory you could use it to demonstrate the underlying Markdown for some HTML, but unfortunately I haven't been able to figure out how to make the CSS ::before and ::after content user-selectable[0], so you wouldn't be able to copy it back out to make a simple HTML-to-Markdown converter.

[0] http://stackoverflow.com/questions/19914349/how-can-i-make-g...

Re:Show HN: CSS to render Markdown as unrendered Markdown by leeoniya on Friday April 10, 2015 @12:03PM (#9355191)
the table stuff doesnt work too well either, understandably. if you actually want to do conversion though, check out reMarked.js [1], disclaimer: mine. it's not too heavy, either.

[1] https://github.com/leeoniya/reMarked.js

Re:Show HN: CSS to render Markdown as unrendered Markdown by anoother on Friday April 10, 2015 @03:15PM (#9356521)
Yes.

I often find myself using http://markdown-here.com/ to compose an email, and then wanting to get back at the source to send another, slightly modified email, or to insert into a README.md.

This will make my life a lot easier. Just need to package it up into a nice browser toolbar button.

Re:Show HN: CSS to render Markdown as unrendered Markdown by masukomi on Sunday April 12, 2015 @07:45AM (#9363021)
no, because you can't copy paste the tags. they're just visual sugar that isn't actionable.
Re:Show HN: CSS to render Markdown as unrendered Markdown by makenosound on Friday April 10, 2015 @07:54PM (#9357741)
Not super practical, but I use [something similar on my site](http://makenosound.com/2012/10/07/going-paperless.html) as a stylistic thing.
Re:Show HN: CSS to render Markdown as unrendered Markdown by stronglikedan on Friday April 10, 2015 @03:37PM (#9356639)
Complex tables? You could use a WYSIWYG HTML editor to quickly create them, and then use this to convert to MD. That's the only thing I can think of.
Re:Show HN: CSS to render Markdown as unrendered Markdown by filearts on Friday April 10, 2015 @02:40PM (#9356283)
Not nearly as impressive, but I did this using Angular directives a while back: http://embed.plnkr.co/zSjqqh/preview

This is the jQuery README.md rendered as html, then with a series of angular directives to convert that rendered markdown back to what the source would have looked like.

Re:Show HN: CSS to render Markdown as unrendered Markdown by thomasfoster96 on Saturday April 11, 2015 @12:35AM (#9358515)
This would actually pretty useful if someone was implementing a Markdown editor using the `contenteditable` HTML attribute. Toggling a class on the editor wrapper element could switch between rendered and non-rendered Markdown. No JS needed.
Re:Show HN: CSS to render Markdown as unrendered Markdown by TazeTSchnitzel on Saturday April 11, 2015 @11:53AM (#9359685)
Lacks handling of <p> and <br>. For <p> prepend (append?) two newlines. For <br>, suffix two spaces.
Re:Show HN: CSS to render Markdown as unrendered Markdown by zamalek on Friday April 10, 2015 @06:53PM (#9357562)
It goes to show you how well designed markdown is. It's humane markup but machines can still do fancy stuff with this.
Re:Show HN: CSS to render Markdown as unrendered Markdown by alphapapa on Friday April 10, 2015 @10:56PM (#9358239)
Hard to beat Org though.
Re:Show HN: CSS to render Markdown as unrendered Markdown by bevacqua on Friday April 10, 2015 @12:31PM (#9355417)
Completely useless, you can't even copy and paste
Re:Show HN: CSS to render Markdown as unrendered Markdown by _august on Friday April 10, 2015 @02:11PM (#9356074)
Alternatively, you could say it the browser's job to support copy/paste of content inserted with CSS.
Re:Show HN: CSS to render Markdown as unrendered Markdown by artursapek on Friday April 10, 2015 @12:52PM (#9355571)
Classic HN comment