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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Using Markdown as HTML

5 点作者 trivialcode大约 4 年前
I had an idea a while ago. Instead of dealing with two sets of files, why not make a file that was Markdown and HTML at the same time?<p>I found this utility, which unfortunately seems to have been abandoned: https:&#x2F;&#x2F;github.com&#x2F;showdownjs&#x2F;showdown<p>All you need to do is add a few lines to the top of your Markdown file. Here&#x27;s an example:<p>https:&#x2F;&#x2F;trivialcode.com&#x2F;mdhtml_demo&#x2F;demo.mdhtml<p>Take a look at the source of the .mdhtml file and you&#x27;ll see what I mean.<p>If you&#x27;re taking notes in Markdown this might make things a bit easier to keep organized. No need to update anything if you&#x27;re exporting to HTML.<p>Thoughts? Is this a good idea? A bad one? I also wondered if generating Markdown via a web server and then converting it on the fly like this would be an interesting exercise. Seems like it&#x27;d be simpler than generating HTML.<p>I use Vim, so I&#x27;ve put this in my vimrc for editing:<p>autocmd BufNewFile,BufRead *.mdhtml set syntax=markdown<p>First time posting here. Let me know what you guys think.

7 条评论

tannhaeuser大约 4 年前
I have taken a look at the .mdhtml file and don&#x27;t know what you mean ;(<p>I you mean having one file that can contain both markdown and HTML, that&#x27;s what markdown is already, since you can fallback to inline or block-level HTML in markdown.<p>If OTOH you want a HTML file that can also contain markdown (or other custom Wiki syntax, and text substitution variables, and a whole lot more), than that&#x27;s available in SGML (on which HTML is based) via short references.
theschmed大约 4 年前
Isn’t texme doing what you suggest here? Or am I missing something?<p><a href="https:&#x2F;&#x2F;github.com&#x2F;susam&#x2F;texme" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;susam&#x2F;texme</a>
评论 #27018981 未加载
approxim8ion大约 4 年前
Not the same thing, but have a look at the Gemini [0] protocol. It uses a markup format called Gemtext which is similar to, although less featureful than Markdown. All pages are written in and served as gemtext. There&#x27;s almost no rendering done, unless your client is configured to use custom stylesheets.<p>[0]: <a href="http:&#x2F;&#x2F;gemini.circumlunar.space&#x2F;" rel="nofollow">http:&#x2F;&#x2F;gemini.circumlunar.space&#x2F;</a>
cpach大约 4 年前
It’s an interesting concept. But for me personally I don’t see any practical benefits of using it.<p>On my web pages I use Hugo. Conversation is done when the CI&#x2F;CD system runs Hugo.[1]<p>[1] I currently use AWS Amplify. But it’s not hard to build a small Bash script to replace it.
detaro大约 4 年前
Sounds like a terrible idea. You loose the fallback, because Markdown treated as HTML instead of text is pretty much unreadable. (block the script to see what I mean: the rules about newlines etc in HTML do work differently)
评论 #27014422 未加载
_448大约 4 年前
Markdeep[0] could be an option for what you are looking for.<p>[0] <a href="https:&#x2F;&#x2F;casual-effects.com&#x2F;markdeep" rel="nofollow">https:&#x2F;&#x2F;casual-effects.com&#x2F;markdeep</a>
评论 #27136478 未加载
jmercouris大约 4 年前
Have you tried using pandoc to convert markdown to HTML?
评论 #27014244 未加载