Skip to content

Instantly share code, notes, and snippets.

@fasheng
Last active April 18, 2023 09:27
Show Gist options
  • Save fasheng/6696398 to your computer and use it in GitHub Desktop.
Save fasheng/6696398 to your computer and use it in GitHub Desktop.
Join consecutive Chinese lines into a single long line without unwanted space when exporting org-mode to html. Works on org-mode 8.x.
(defadvice org-html-paragraph (before fsh-org-html-paragraph-advice
(paragraph contents info) activate)
"Join consecutive Chinese lines into a single long line without
unwanted space when exporting org-mode to html."
(let ((fixed-contents)
(orig-contents (ad-get-arg 1))
(reg-han "[[:multibyte:]]"))
(setq fixed-contents (replace-regexp-in-string
(concat "\\(" reg-han "\\) *\n *\\(" reg-han "\\)")
"\\1\\2" orig-contents))
(ad-set-arg 1 fixed-contents)
))

this is a sentence

你好, 我是 某某

Hello, I’m, 某某

他说: “很高兴见到你”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment