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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: Markdown as web page/site

83 点作者 casualwriter将近 3 年前

21 条评论

atakiel将近 3 年前
There appears to be many comments here, arguing that authoring web content in markdown is nothing new, and correctly so.<p>But this (along with md-page and mdwiki mentioned in other comments) is actually an interesting small twist on it. Regularly the conversion is done on the server side, and everything is published in html.<p>Here, you both author and publish in markdown.<p>What this library does, if I&#x27;m reading it correctly, it acts as polyfill that lets legacy evergreen browsers to consume the markdown files that you serve.<p>You can publish your content in a bit more simpler, yet still declarative format, without any javascript, and still make it accessible, in a properly rendered format, for evergreen browsers.<p>(Yes, you can still add javascript to markdown files, but it is relatively easy for the agent to just discard any javascript or html.)<p>The markdown is the source of truth here. No need for rendering everything twice for serving, once for html and once for markdown, and creating a point where their content might diverge.<p>It&#x27;s straight out of gemini&#x27;s playbook.<p>I think this is a wonderful idea, and if developed a bit further, and adopted more widely, could help push markdown to be a properly supported format in modern browsers.<p>The next question is, how would you get the second layer of github flavored markdown fluff (latex, mermaid, etc), that is generally not standardized, to be supported in browsers as well?
评论 #32440620 未加载
评论 #32437978 未加载
hcarvalhoalves将近 3 年前
This requires JavaScript to dynamically serve HTML. So this wastes everybody’s CPU for a deterministic computation that could be served directly.<p>I’m not sure what’s the use case for this, but for static content seems wasteful and a bad idea in general.
评论 #32436927 未加载
KronisLV将近 3 年前
The Grav CMS also internally uses Markdown for the page contents and generates static files: <a href="https:&#x2F;&#x2F;getgrav.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;getgrav.org&#x2F;</a><p>They do use YAML FrontMatter for attaching metadata so the CMS knows how to process certain pages (e.g. page title, page type etc.), but it isn&#x27;t too complicated in practice: <a href="https:&#x2F;&#x2F;learn.getgrav.org&#x2F;17&#x2F;content&#x2F;content-pages#page-file" rel="nofollow">https:&#x2F;&#x2F;learn.getgrav.org&#x2F;17&#x2F;content&#x2F;content-pages#page-file</a><p>They also have an admin plugin, which you can use if you prefer a more traditional workflow, even if it just generates the same file format under the hood: <a href="https:&#x2F;&#x2F;learn.getgrav.org&#x2F;16&#x2F;admin-panel&#x2F;introduction" rel="nofollow">https:&#x2F;&#x2F;learn.getgrav.org&#x2F;16&#x2F;admin-panel&#x2F;introduction</a><p>I&#x27;m actually using an ancient version of Grav for my own blog, although I had to put the admin path behind additional auth (in addition to the one it already provides), for safety: <a href="https:&#x2F;&#x2F;blog.kronis.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.kronis.dev&#x2F;</a><p>I really like hybrid systems like that: a CMS for blogging or just writing in general that&#x27;s based on Markdown, generates static files for decent performance, but is also extensible with additional functionality, and also has a decent web UI if you want one.<p>(there are probably other CMSes like that out there, or more generic solutions, too)<p>Of course, the actual use case for the linked solution is a bit different, being able to dynamically render Markdown client side is also pretty cool! Feels almost more flexible in a way.
评论 #32440192 未加载
ok_dad将近 3 年前
I use this one which is also nice: <a href="https:&#x2F;&#x2F;github.com&#x2F;oscarmorrison&#x2F;md-page" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;oscarmorrison&#x2F;md-page</a>
indigodaddy将近 3 年前
Don’t forget, Caddy can also serve markdown directly via module: <a href="https:&#x2F;&#x2F;caddyserver.com&#x2F;docs&#x2F;modules&#x2F;http.handlers.templates" rel="nofollow">https:&#x2F;&#x2F;caddyserver.com&#x2F;docs&#x2F;modules&#x2F;http.handlers.templates</a><p>Believe there may also be something similar for Apache?
zzo38computer将近 3 年前
Unfortunately it won&#x27;t display without JavaScripts. You can easily fix this by a &lt;noscript&gt; block with the link to the Markdown file; if it is not possible, instead include a description about how to find the Markdown file.<p>Another alternative that I would suggest is to just serve the files directly (in Markdown or Gemini or PDF or whatever other format they might be). To allow working in a web browser, one idea is to try to implement my idea of a Interpreter response header in web browser, which would be used if the web browser does not understand the file format (if the user has not disabled the use of the Interpreter header). This way, potentially any file format can be implemented.<p>There is also question about different variants of Markdown. Well, the way to indicate that is by parameters in the MIME type, I think; you can specify if it is Commonmark or something else. This way you can tell which variant it is.<p>One problem with MIME is that indicating multiple file formats does not work very well. UTI specifies that it is a specific kind of another file format but it must be specified in another file instead of this one and does not have parameters, and has other problems, so UTI is not good either. That is why I wanted to make the &quot;unordered labels file identification&quot; which you can specify, in the same identification, multiple types&#x2F;parameters, e.g. &quot;text[367]:plaintext:markdown+commonmark&quot;.
engfan将近 3 年前
Great idea. Keep expanding it as you have time.
评论 #32435130 未加载
dxxvi将近 3 年前
I&#x27;m doing something similar for my personal notes but I combine .md and .html into 1 file. My .html file looks like this:<p><pre><code> &lt;html&gt; &lt;body&gt; &lt;div class=&quot;accordion&quot;&gt; &lt;div class=&quot;accordion-item&quot; title=&quot;...&quot;&gt; text with markdown syntax goes here &lt;&#x2F;div&gt; &lt;&#x2F;div&gt; &lt;script&gt; &#x2F;&#x2F; use showdown.js to convert the innerHTMLin .md syntax to html code &#x2F;&#x2F; use bootstrap to make the accordion-item collapsible&#x2F;expandable &#x2F;&#x2F; use js to make a floating TOC &lt;&#x2F;script&gt; &lt;&#x2F;body&gt; &lt;&#x2F;html&gt; </code></pre> If anybody uses both showdown.js and this casual-markdown.js, could you give some comments?
disinterred将近 3 年前
org-mode already has this. Unfortunately, people seem to continue to use the inferior version of org known as Markdown. It is somewhat like how pdf overtook the superior format djvu.
评论 #32435144 未加载
评论 #32434897 未加载
评论 #32434947 未加载
评论 #32435246 未加载
评论 #32434788 未加载
luplex将近 3 年前
I use Markdeep for the same application:<p><a href="https:&#x2F;&#x2F;casual-effects.com&#x2F;markdeep&#x2F;" rel="nofollow">https:&#x2F;&#x2F;casual-effects.com&#x2F;markdeep&#x2F;</a>
XCSme将近 3 年前
I did something similar, but for adding a blog system to a server running PHP: <a href="https:&#x2F;&#x2F;github.com&#x2F;Cristy94&#x2F;markdown-blog" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Cristy94&#x2F;markdown-blog</a><p>The idea is that having it server-side allows for the page to be cached by a CDN (e.g. CloudFlare), so you end up serving static HTML, with better performance and SEO than JS-compiled markdown.
Jaruzel将近 3 年前
The heavy lifting seems to be actually done via:<p><a href="https:&#x2F;&#x2F;cdn.jsdelivr.net&#x2F;gh&#x2F;casualwriter&#x2F;casual-markdown&#x2F;dist&#x2F;casual-markdown.js" rel="nofollow">https:&#x2F;&#x2F;cdn.jsdelivr.net&#x2F;gh&#x2F;casualwriter&#x2F;casual-markdown&#x2F;dis...</a><p>Which isn&#x27;t in the github repo.
评论 #32436727 未加载
评论 #32436012 未加载
SpacemannSpiff将近 3 年前
What about Markdeep? Astonished that none of the commenters here seem to know of its existence. See <a href="https:&#x2F;&#x2F;casual-effects.com&#x2F;markdeep&#x2F;" rel="nofollow">https:&#x2F;&#x2F;casual-effects.com&#x2F;markdeep&#x2F;</a>.
quintussss将近 3 年前
I visited the documentation site on a slow mobile connection and it took a long time and even a refresh to load. This seems to be a bad way of doing something that has been solved by static site generators for a long time.
评论 #32439178 未加载
agileAlligator将近 3 年前
Do you have any examples of what a web site would look like with this?
reactspa将近 3 年前
I was under the impression that using markdown to create html webpages was a common use case, and had been solved. Was I wrong?<p>(I&#x27;ve used markdown for note taking, not for web pages, hence am asking.)
评论 #32436023 未加载
评论 #32434778 未加载
评论 #32435412 未加载
评论 #32435538 未加载
评论 #32434880 未加载
sscarduzio将近 3 年前
Why not rendering a whole site from markdown to HTML in a Cloudflare worker (with cache) instead of on the browser? SEO would benefit too.
i_hate_pigeons将近 3 年前
I&#x27;ve been using docsify in this manner for a while and it&#x27;s worked well for me
phantomathkg将近 3 年前
What&#x27;s the reason for supporting IE9?
评论 #32435254 未加载
nprateem将近 3 年前
Hugo
kseistrup将近 3 年前
This reminds me of MDWiki: <a href="https:&#x2F;&#x2F;dynalon.github.io&#x2F;mdwiki&#x2F;" rel="nofollow">https:&#x2F;&#x2F;dynalon.github.io&#x2F;mdwiki&#x2F;</a>
评论 #32435327 未加载
评论 #32435069 未加载