TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: CSS to render Markdown as unrendered Markdown

161 点作者 ImJasonH大约 10 年前

11 条评论

jbrooksuk大约 10 年前
This is pretty nice for a &quot;toggle source&quot; feature. I added the use of CSS counters: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;jbrooksuk&#x2F;2d6989c35c77bf0c62f9" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;jbrooksuk&#x2F;2d6989c35c77bf0c62f9</a>
评论 #9356526 未加载
michaelmior大约 10 年前
I think a more accurate description is that this renders HTML as unrendered Markdown.
评论 #9358748 未加载
Foomandoonian大约 10 年前
See also ReMarkdown: <a href="http:&#x2F;&#x2F;fvsch.com&#x2F;code&#x2F;remarkdown&#x2F;" rel="nofollow">http:&#x2F;&#x2F;fvsch.com&#x2F;code&#x2F;remarkdown&#x2F;</a><p>I&#x27;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.<p>You can go in the opposite direction with markdown.css too: <a href="http:&#x2F;&#x2F;kevinburke.bitbucket.org&#x2F;markdowncss&#x2F;" rel="nofollow">http:&#x2F;&#x2F;kevinburke.bitbucket.org&#x2F;markdowncss&#x2F;</a>
neckro23大约 10 年前
This is almost perfectly useless.<p>I approve.
phyzome大约 10 年前
Of course, it doesn&#x27;t actually reverse the (lossy) Markdown transformation. For example, the source &quot;9.&quot; turns into an ordered list that looks like &quot;1.&quot; and CSS won&#x27;t reverse that.
captn3m0大约 10 年前
Any usecases for this?<p>I was thinking that this could be useful for giving people markdown to copy directly, but css:before and after doesn&#x27;t get copied.<p>I&#x27;m so gonna use this _somewhere_, just not sure where.
评论 #9355106 未加载
评论 #9356521 未加载
评论 #9357741 未加载
评论 #9356639 未加载
filearts大约 10 年前
Not nearly as impressive, but I did this using Angular directives a while back: <a href="http:&#x2F;&#x2F;embed.plnkr.co&#x2F;zSjqqh&#x2F;preview" rel="nofollow">http:&#x2F;&#x2F;embed.plnkr.co&#x2F;zSjqqh&#x2F;preview</a><p>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.
thomasfoster96大约 10 年前
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.
TazeTSchnitzel大约 10 年前
Lacks handling of &lt;p&gt; and &lt;br&gt;. For &lt;p&gt; prepend (append?) two newlines. For &lt;br&gt;, suffix two spaces.
zamalek大约 10 年前
It goes to show you how well designed markdown is. It&#x27;s humane markup but machines can still do fancy stuff with this.
评论 #9358239 未加载
bevacqua大约 10 年前
Completely useless, you can&#x27;t even copy and paste
评论 #9356074 未加载
评论 #9355571 未加载