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

推荐订阅源

雷峰网
雷峰网
IT之家
IT之家
Last Week in AI
Last Week in AI
J
Java Code Geeks
L
LangChain Blog
Recent Announcements
Recent Announcements
Martin Fowler
Martin Fowler
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
博客园 - Franky
博客园 - 司徒正美
月光博客
月光博客
博客园 - 叶小钗
Vercel News
Vercel News
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
B
Blog RSS Feed
人人都是产品经理
人人都是产品经理
H
Help Net Security
G
Google Developers Blog
D
DataBreaches.Net

Emacs

Emacs 内好用漂亮的 YouTube Music 客户端 好用的 Emacs 数据库客户端 给 org-zettel-ref-mode 添加 AI 总结功能 Emacs 30 新特性预览 『Made with Emacs』 博客收集 新手向问下,调试程序 Emacs 在 Windows 下体验如何 GPG in Emacs Emacs 28 新特性介绍 Emacs Golang 开发环境配置 [Emacs Tips] 使用 Dired 快速移动文件 spacemacs 如何让当前 buffer 中的内容水平居中? 公众号里怎么直接实现 Latex 写出来的科学文章 PDF 之类的效果? macOS 10.14.4 状态栏电池百分比选项回归(不好意思 以前一直都有😂) emacs 自动安装 package 包 emacs 怎么控制光标 怎么知道 emacs 启用了那几个安装包? 源更新后不能保存吗? 为什么在 Emacs 下打开 Python 文件就是显示 Tab 时 8 个字符 Compare Doom-emacs, Spacemacs, and vanilla Emacs Emacs 补全头文件的那个 company-c-header 有人用过吗? elpy 把 importmagic 给 remove 了😂 Emacs 在 window 10 下面运行好慢呀,有没有人和我一样? emacs 的 org mode 好强大啊 HHKB Pro2 接上 U 盘后电脑提示“USB 集线器没有足够的电源” 不谈 Spacemacs,只谈 Centaur Emacs 在用 brew 重新安装 Emacs 时遇到的问题,如下图所示。 emacs 的 dired 模式有快速切换目录的方案或插件么? 用 emacs 的,小指伤不起啊 emacs25.1 发布了
求助, org 文件使用 emacs –script 执行 org-publish-all 的...
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 了几个小时完全没有头绪。