惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CERT Recently Published Vulnerability Notes
S
Security @ Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Help Net Security
Help Net Security
Spread Privacy
Spread Privacy
WordPress大学
WordPress大学
S
Schneier on Security
博客园 - 聂微东
C
Cybersecurity and Infrastructure Security Agency CISA
F
Full Disclosure
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
D
Docker
aimingoo的专栏
aimingoo的专栏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
N
News and Events Feed by Topic
小众软件
小众软件
A
About on SuperTechFans
Scott Helme
Scott Helme
Cloudbric
Cloudbric
T
Threatpost
雷峰网
雷峰网
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Microsoft Azure Blog
Microsoft Azure Blog
T
Tailwind CSS Blog
T
Tor Project blog
T
The Blog of Author Tim Ferriss
The Hacker News
The Hacker News
C
Cyber Attacks, Cyber Crime and Cyber Security
量子位
Latest news
Latest news
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
Intezer
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Privacy International News Feed
TaoSecurity Blog
TaoSecurity Blog
N
News and Events Feed by Topic
IT之家
IT之家
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
P
Privacy & Cybersecurity Law Blog

Emacs

Emacs 内好用漂亮的 YouTube Music 客户端 - V2EX 好用的 Emacs 数据库客户端 给 org-zettel-ref-mode 添加 AI 总结功能 - V2EX Emacs 30 新特性预览 - V2EX 『Made with Emacs』 博客收集 - V2EX 新手向问下,调试程序 - V2EX Emacs 在 Windows 下体验如何 - V2EX GPG in Emacs - V2EX Emacs 28 新特性介绍 - V2EX Emacs Golang 开发环境配置 - V2EX [Emacs Tips] 使用 Dired 快速移动文件 - V2EX spacemacs 如何让当前 buffer 中的内容水平居中? - V2EX 公众号里怎么直接实现 Latex 写出来的科学文章 PDF 之类的效果? - V2EX macOS 10.14.4 状态栏电池百分比选项回归(不好意思 以前一直都有😂) - V2EX emacs 自动安装 package 包 - V2EX emacs 怎么控制光标 - V2EX 怎么知道 emacs 启用了那几个安装包? - V2EX 源更新后不能保存吗? - V2EX 为什么在 Emacs 下打开 Python 文件就是显示 Tab 时 8 个字符 - V2EX Compare Doom-emacs, Spacemacs, and vanilla Emacs - V2EX Emacs 补全头文件的那个 company-c-header 有人用过吗? - V2EX elpy 把 importmagic 给 remove 了😂 - V2EX Emacs 在 window 10 下面运行好慢呀,有没有人和我一样? - V2EX emacs 的 org mode 好强大啊 - V2EX HHKB Pro2 接上 U 盘后电脑提示“USB 集线器没有足够的电源” - V2EX 不谈 Spacemacs,只谈 Centaur Emacs - V2EX 在用 brew 重新安装 Emacs 时遇到的问题,如下图所示。 - V2EX emacs 的 dired 模式有快速切换目录的方案或插件么? - V2EX 用 emacs 的,小指伤不起啊 - V2EX emacs25.1 发布了 - V2EX 用 Emacs 做 PostgreSQL 解释器一事不明 - V2EX 有没有办法在用 Emacs 的时候自动切换成英文输入法? - V2EX melpa down - V2EX v2ex-mode,在 emacs 下访问 V 站 - V2EX 在 emacs 中有没有能直接使用 imap 协议的同时下载邮件到本地或者使用 pop3 但是不删除服务器邮件的邮件客户端? - V2EX GNU Emacs 的新网站 - V2EX Emacs 配合使用 ibus 输入法的一个问题 - V2EX Ubuntu 下使用了 GNU 的 nnimap 设置了邮箱服务器,我想知道的是接收到邮件的默认保存位置在何处,尝试寻找了一下表示根本找不到,在 home 目录下的 Mail 和 News 目录下均未找到 - V2EX 关于 org-mode 8 导出 html 的一个问题 - V2EX 在 emacsclient 中应用中文字体设置 - V2EX emacs 显示出 tab 键 - V2EX Emacs 25.1 即将支持内嵌 webkit 浏览器 - V2EX Emacs 分别设置中英文字体及 org-mode 表格对齐 - V2EX 终于搞定了新帆新闻组 - V2EX 遇到 symbol's value as variable is void - V2EX 将 Emacs 打造成阅读源代码的神器 - V2EX Spacemacs Rocks 视频系列 - V2EX Emacs 自己已经包括了那么多按键组合,新写的函数只能绑定到 C-x 上了吗? - V2EX 在 Mac 上使用 Emacs 的 Prelude 配置,启动报错,求教 - V2EX Emacs 24.5 不兼容任何中文输入法 - V2EX Emacs 注释的时候代码着色有明显卡顿
求助, org 文件使用 emacs –script 执行 org-publish-all 的时候代码块没有高亮? - V2EX
gridsah · 2022-04-29 · via Emacs

一个有点奇怪的问题。我在 emacs 里用 M-x lsz/org-export-publish Ret 执行导出的时候,代码块是可以正常高亮的。但我一旦使用 emacs --script ~/.emacs.d/lisp/script-org-export-publish.el 来导出,代码块的高亮就没了

(use-package htmlize)

(use-package org
  :hook
  ('before-save . 'lsz/org-mode-hook-func-before-save)
  :config
  (setq org-startup-truncated nil)
  (setq org-support-shift-select t)

  (setq org-use-sub-superscripts '{})

  (setq org-use-fast-todo-selection t)
  (setq org-todo-keywords '((sequence "TODO(t)" "DOING(i)"
                                      "|"
                                      "DONE(d)" "ABORT(a)")))
  )

(use-package ox-html
  :ensure org
  :config
  (setq org-html-htmlize-output-type 'inline-css)
  (setq org-src-fontify-natively t)
  )

(defun lsz/org-export-publish()
  "Publish org site by publish script."
  (interactive)
  (load "~/.emacs.d/lisp/script-org-export-publish.el"))

(use-package ox-publish
  :ensure org
  :config

  ;; (setq org-html-postamble t)
  ;; (setq org-html-postamble-format '(("en" "")))

  (setq org-export-with-sub-superscripts '{})

  (setq
   org-publish-project-alist
   (let* ((lsz/site-path "~/Documents/LSZOrgArticle/")
          (lsz/site-pub-path "~/Documents/LSZOrgArticlePublish/")
          (get-content (lambda (x)
                         (with-temp-buffer
                           (insert-file-contents (concat lsz/site-path x))
                           (buffer-string))))
          (lsz/site-postamble (funcall get-content "template/postamble.html"))
          (lsz/site-preamble (funcall get-content "template/preamble.html"))
          (lsz/site-head (funcall get-content "template/head.html")))
     `(
       ("blog"
        :base-directory ,(concat lsz/site-path "article/blog/")
        :base-extension "org"
        :publishing-directory ,(concat lsz/site-pub-path "article/blog/")
        :publishing-function org-html-publish-to-html
        :recursive t
        :headline-levels 4

        :auto-sitemap t
        :sitemap-filename "sitemap-index.org"
        :sitemap-title "blog"

        :html-doctype "html5"
        :html-head ,lsz/site-head
        :html-preamble ,lsz/site-preamble
        :html-postamble ,lsz/site-postamble
        :htmlized-source t

        :with-toc t
        )
       ("reading"
        :base-directory ,(concat lsz/site-path "article/reading/")
        :base-extension "org"
        :publishing-directory ,(concat lsz/site-pub-path "article/reading/")
        :publishing-function org-html-publish-to-html
        :recursive t
        :headline-levels 4

        :auto-sitemap t
        :sitemap-filename "sitemap-index.org"
        :sitemap-title "reading"

        :html-doctype "html5"
        :html-head ,lsz/site-head
        :html-preamble ,lsz/site-preamble
        :html-postamble ,lsz/site-postamble
        :htmlized-source t

        :with-toc t
        )
       ("wiki"
        :base-directory ,(concat lsz/site-path "article/wiki/")
        :base-extension "org"
        :publishing-directory ,(concat lsz/site-pub-path "article/wiki/")
        ;; :publishing-function org-html-publish-to-html
        :recursive t
        :headline-levels 4

        :auto-sitemap t
        :sitemap-filename "sitemap-index.org"
        :sitemap-title "wiki"

        ;; :html-doctype "html5"
        :html-head ,lsz/site-head
        :html-preamble ,lsz/site-preamble
        :html-postamble ,lsz/site-postamble
        ;; :htmlized-source t

        :with-toc t
        )
       ("site"
        :base-directory ,(concat lsz/site-path "article/site/")
        :base-extension "org"
        :publishing-directory ,(concat lsz/site-pub-path "article/site/")
        :publishing-function org-html-publish-to-html
        :recursive t
        :headline-levels 4

        :html-doctype "html5"
        :html-head ,lsz/site-head
        :html-preamble ,lsz/site-preamble
        :html-postamble ,lsz/site-postamble
        :htmlized-source t

        :with-toc nil
        )
       ("static"
        :base-directory ,(concat lsz/site-path "article_static/")
        :base-extension "css\\|js\\|png\\|jpg\\|gif\\|zip\\|7z\\|rar\\|pdf"
        :publishing-directory ,(concat lsz/site-pub-path "/article_static")
        :publishing-function org-publish-attachment
        :recursive t
        )
       ("all" :components ("blog" "reading" "wiki" "site" "static"))
       ))))

这是 ~/.emacs.d/lisp/script-org-export-publish.el

;;; need environment
(package-initialize)
(load "~/.emacs.d/init.el")

;;; publish file
(org-publish-all)

这是正常渲染出来的,有代码高亮的 html

<pre class="src src-python"><span style="color: #a020f0;">import</span> csv

<span style="color: #a020f0;">with</span> <span style="color: #483d8b;">open</span>(<span style="color: #8b2252;">'stock.csv'</span>,<span style="color: #8b2252;">'r'</span>) <span style="color: #a020f0;">as</span> fp:
    <span style="color: #a0522d;">reader</span> = csv.reader(fp)
    <span style="color: #a0522d;">titles</span> = <span style="color: #483d8b;">next</span>(reader)
    <span style="color: #a020f0;">for</span> x <span style="color: #a020f0;">in</span> reader:
        <span style="color: #a020f0;">print</span>(x)
</pre>

这是 emacs --script 渲染出来的 html:

<pre class="src src-python"><span style="font-weight: bold;">import</span> csv

<span style="font-weight: bold;">with</span> <span style="font-weight: bold;">open</span>(<span style="font-style: italic;">'stock.csv'</span>,<span style="font-style: italic;">'r'</span>) <span style="font-weight: bold;">as</span> fp:
    <span style="font-weight: bold; font-style: italic;">reader</span> = csv.reader(fp)
    <span style="font-weight: bold; font-style: italic;">titles</span> = <span style="font-weight: bold;">next</span>(reader)
    <span style="font-weight: bold;">for</span> x <span style="font-weight: bold;">in</span> reader:
        <span style="font-weight: bold;">print</span>(x)
</pre>

效果图在 https://emacs-china.org/t/org-emacs-script-org-publish-all/20782

老哥们啊,这是咋回事,该从哪下手排查问题,我 google 了几个小时完全没有头绪。