gpt4 book ai didi

html - 在 Emacs 中将语法突出显示的代码转换为 HTML

转载 作者:太空狗 更新时间:2023-10-29 13:20:57 26 4
gpt4 key购买 nike

在 TextMate 中有一个名为“从文档创建 HTML”的功能,它将显示的代码(包括语法着色)转换为 HTML/CSS,以便于在线发布。我想知道 Emacs 中是否隐藏了这样的功能,或者我可以安装一个扩展来实现这一点。

最佳答案

Htmlize .

在这里,我使用 htmlize-region 将 GNU Emacs 欢迎屏幕的一部分 Htmlize:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><!-- Created by htmlize-1.34 in css mode. --><html>  <head>    <title>*GNU Emacs*</title>    <style type="text/css">    <!--      body {        color: #000000;        background-color: #ffffff;      }      .ATTRLIST {      }      .ATTRLIST-1 {        /* (:foreground "darkblue") */        color: #00008b;      }      .ATTRLIST-2 {        /* (:slant oblique) */        font-style: italic;      }      .ATTRLIST-3 {        /* (:foreground "red") */        color: #ff0000;      }      .default {        /* default */        color: #000000;        background-color: #ffffff;      }      .link {        /* link */        color: #0000ff;        text-decoration: underline;      }      .variable-pitch {      }      a {        color: inherit;        background-color: inherit;        font: inherit;        text-decoration: inherit;      }      a:hover {        text-decoration: underline;      }    -->    </style>  </head>  <body>    <pre><span class="ATTRLIST-3"><span class="variable-pitch">Welcome to </span></span><span class="ATTRLIST"><span class="link">GNU Emacs</span></span><span class="ATTRLIST-3"><span class="variable-pitch">, one component of the </span></span><span class="ATTRLIST"><span class="link">GNU/Linux</span></span><span class="ATTRLIST-3"><span class="variable-pitch"> operating system.</span></span><span class="variable-pitch">To quit a partially entered command, type </span><span class="default">Control-g</span><span class="variable-pitch">.</span><span class="variable-pitch"><span class="link">Emacs Tutorial</span></span><span class="variable-pitch">        Learn basic keystroke commands</span><span class="variable-pitch"><span class="link">Emacs Guided Tour</span></span><span class="variable-pitch">     Overview of Emacs features</span><span class="variable-pitch"><span class="link">View Emacs Manual</span></span><span class="variable-pitch">     View the Emacs manual using Info</span><span class="variable-pitch"><span class="link">Absence of Warranty</span></span><span class="variable-pitch">   GNU Emacs comes with </span><span class="ATTRLIST-2"><span class="variable-pitch">ABSOLUTELY NO WARRANTY</span></span><span class="variable-pitch"><span class="link">Copying Conditions</span></span><span class="variable-pitch">    Conditions for redistributing and changing Emacs</span><span class="variable-pitch"><span class="link">Ordering Manuals</span></span><span class="variable-pitch">      Purchasing printed copies of manuals</span><span class="variable-pitch">To start...     </span><span class="variable-pitch"><span class="link">Open a File</span></span><span class="variable-pitch">     </span><span class="variable-pitch"><span class="link">Open Home Directory</span></span><span class="variable-pitch">     </span><span class="variable-pitch"><span class="link">Customize Startup</span></span><span class="variable-pitch"></span><span class="ATTRLIST-1"><span class="variable-pitch">This is GNU Emacs 22.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.14.7) of 2009-03-31 on nautilus, modified by Debian</span></span></pre>  </body></html>

关于html - 在 Emacs 中将语法突出显示的代码转换为 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/946858/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com