在Emacs缓冲区中渲染Markdown [英] Render Markdown in Emacs buffer

查看:122
本文介绍了在Emacs缓冲区中渲染Markdown的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Emacs自己的缓冲区文本格式化功能可以呈现在Emacs缓冲区中渲染的Markdown吗?图形环境中的Emacs具有丰富的文本显示功能(字体样式,颜色,链接甚至图像),因此应该是非常有可能的。有没有现有的实现?



请注意,这个想法是将渲染的Markdown作为本地Emacs格式的文本,可以作为Emacs中的任何其他文本进行导航和操作。因此,渲染到嵌入在Emacs缓冲区中的图像的解决方案在这里是不可取的。



还要注意,这不是关于编辑模式的 Markdown,但用于在Emacs缓冲区中呈现渲染的Markdown。对于可移植性,它应该是一个纯粹的Emacs Lisp解决方案。

解决方案

Personnaly,我使​​用以下工作流:

$在$ code> Cc Cc m 上运行在当前缓冲区上运行Markdown,并在另一个缓冲区中预览输出b
$ b

    < 。
  • 移至 html-mode 在另一个缓冲区( Mx html-mode

  • 隐藏html标签以显示接近输出的内容( Mx sgml-tags-invisible



然后,每次要刷新渲染时,只需再次运行 Cc Cc m 缓冲区。



然而,我承认直到现在为Markdown编辑/预览,没有什么比我的Textmate及其降价预览面板。实际上,从个人角度来说,我喜欢运行Textmate而不是Emacs的唯一情况是当我想编辑markdown文件时。然而,在emacs上具有相同质量的预览的路径并不是那么困难,我可能应该调查它。就像我看到的那样,只是简单地:




  • 获取Textmate用于呈现预览的内部css

  • 使用w3或w3m来预览使用此CSS的降价输出


Is it possible to present Markdown rendered in an Emacs buffer using Emacs' own buffer text formatting capabilities? Emacs in graphical environments has rich text presentation capabilities (font styles, colors, links and even images) so it should be quite possible. Are there any existing implementations?

Note that the idea is to have the rendered Markdown be native Emacs formatted text that can be navigated and operated on as any other text in Emacs. Therefore solutions that render to an image that is embedded in an Emacs buffer are not desirable here.

Also note that this is not about a mode for editing Markdown, but for presenting rendered Markdown in an Emacs buffer. It should preferably be a pure Emacs Lisp solution for portability.

解决方案

Personnaly, I use the following workflow:

  • run on a C-c C-c m to run Mark­down on the cur­rent buffer and pre­view the out­put in an­other buffer.
  • move to html-mode on this other buffer (M-x html-mode)
  • hide the html tags to display something close to the output (M-x sgml-tags-invisible)

Then every time you want to refresh the rendering, simply run again C-c C-c m on the markdown buffer.

Yet I confess until now for Markdown editing/previewing, nothing beats for me Textmate and its markdown preview panel. Actually, at a personal perspective, the only case where I prefer to run Textmate rather than Emacs is when I want to edit markdown files. Yet the path to have the same quality of preview on emacs is not so difficult and probably I should investigate it. As I see it, it's simply:

  • get the internal css used by Textmate for rendering the preview
  • use w3 or w3m to preview the markdown output using this css

这篇关于在Emacs缓冲区中渲染Markdown的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆