Relocate Org zero-width space stripping code
This commit is contained in:
parent
99155e6c85
commit
9830d78e28
27
config.org
27
config.org
|
@ -8243,22 +8243,13 @@ or put a currency symbol immediately before an inline source block.
|
|||
There is a solution to this, it just sounds slightly hacky --- zero width spaces.
|
||||
Because this is Emacs, we can make this feel much less hacky by making a minor
|
||||
addition to the Org key map 🙂.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(map! :map org-mode-map
|
||||
:nie "M-SPC M-SPC" (cmd! (insert "\u200B")))
|
||||
#+end_src
|
||||
|
||||
We then want to stop the space from being included in exports, which can be done
|
||||
with a little filter.
|
||||
#+begin_src emacs-lisp
|
||||
(defun +org-export-remove-zero-width-space (text _backend _info)
|
||||
"Remove zero width spaces from TEXT."
|
||||
(unless (org-export-derived-backend-p 'org)
|
||||
(replace-regexp-in-string "\u200B" "" text)))
|
||||
|
||||
(after! ox
|
||||
(add-to-list 'org-export-filter-final-output-functions #'+org-export-remove-zero-width-space t))
|
||||
#+end_src
|
||||
We then want to stop the space from being included in exports, which is done [[*Strip zero width spaces][here]].
|
||||
|
||||
***** List bullet sequence
|
||||
|
||||
|
@ -10122,6 +10113,20 @@ TODO abstract backend implementations."
|
|||
(setq org-latex-format-headline-function #'org-latex-format-headline-acronymised)
|
||||
#+end_src
|
||||
|
||||
**** Strip zero width spaces
|
||||
|
||||
Zero width spaces are handy as a semantic separator, but not something we want
|
||||
passed through to the exports.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun +org-export-remove-zero-width-space (text _backend _info)
|
||||
"Remove zero width spaces from TEXT."
|
||||
(unless (org-export-derived-backend-p 'org)
|
||||
(replace-regexp-in-string "\u200B" "" text)))
|
||||
|
||||
(add-to-list 'org-export-filter-final-output-functions #'+org-export-remove-zero-width-space t)
|
||||
#+end_src
|
||||
|
||||
**** Exporting Org code
|
||||
|
||||
With all our Org config and hooks, exporting an Org code block when using
|
||||
|
|
Loading…
Reference in a new issue