The Emacs Lisp functions for Asciidoctor may help to speed up the markup activities.
Asciidoctor, insert rouge attributes
The function will guide the user to interactively insert rouge attributes:
(defvar rcd-asciidoctor-rouge-style-history nil
"Remembers history for styles in `rcd-asciidoctor-rouge'
function.")
(defun rcd-asciidoctor-rouge ()
"Interactively enter Asciidoctor syntax highlighting for `rouge'
syntax highlighter."
(interactive)
(insert (format ":source-highlighter: rouge\n"))
(let* ((colors '("base16" "bw" "colorful" "github" "gruvbox" "igor_pro" "magritte" "molokai" "monokai" "monokai_sublime" "pastie" "thankful_eyes" "tulip"))
(style (completing-read "Choose rouge style: " colors nil t nil rcd-asciidoctor-rouge-style-history)))
(insert (format ":rouge-style: %s\n\n" style))))
And the outcome will be something like following:
:source-hihglighter: rouge
:rouge-style: monokai_sublime
Easier enter admonitions
(defvar rcd-asciidoctor-admonition-history nil)
(defun rcd-asciidoctor-admonition ()
"Interactively enter Asciidoctor admonition.
Use prefix key to enter admonition block."
(interactive)
(let* ((admonitions '("NOTE" "TIP" "IMPORTANT" "CAUTION" "WARNING"))
(completion-ignore-case t)
(admonition (completing-read "Choose admonition: " admonitions nil t nil 'rcd-asciidoctor-admonition-historyy)))
(if current-prefix-arg
(progn
(insert (format "[%s]\n.%s\n====\n\n====\n\n" admonition
(read-from-minibuffer "Title: ")))
(previous-line 3))
(insert (format "%s: " admonition)))))
Recommended alias functions
(defalias 'asciidoctor-rouge 'rcd-asciidoctor-rouge)
(defalias 'asciidoctor-admonition 'rcd-asciidoctor-admonition)
Recommended key bindings
(define-prefix-command 'rcd-asciidoctor-map)
(global-set-key (kbd "C-c a") 'rcd-asciidoctor-map)
(define-key rcd-asciidoctor-map "r" 'asciidoctor-rouge)
(define-key rcd-asciidoctor-map "A" 'asciidoctor-admonition)
Related hyperdocuments
Related hyperdocument tags
GNU Free Documentation License
Copyright © 2021-05-04 08:35:55.513756+02 by Jean Marc Louis. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License"