Add creating md backend spec to docs

This commit is contained in:
TEC 2023-01-18 23:45:30 +08:00
parent ff10653b8b
commit 8ac176c068
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
2 changed files with 55 additions and 0 deletions

View File

@ -576,3 +576,29 @@ to avoid the =\ifnum%n>0= LaTeX switch.
This allows for any change in other backends or the defaults you're not
particularly attached to from freely updating.
** Adding a new export backend
Adding a new export spec is as easy as pushing a spec list to
~org-glossary-export-specs~, for example should we want to add an =ox-md= backend we
could do this:
#+begin_example
(push '(md (t :use "[%t](#gls-%K)"
:definition "%t {#gls-%K}"
:definition-structure "%d\n\\colon{} %v [%n uses]\n"))
org-glossary-export-specs)
#+end_example
We need to remember to use =\colon{}= instead of =:= to avoid it being interpreted
as Org fixed-width syntax.
Alternatively, we could use ~org-glossary-set-export-spec~, which has the
advantage of being idempotent, and I would argue a little clearer.
#+begin_example
(org-glossary-set-export-spec 'md t
:use "[%t](#gls-%K)"
:definition "%t {#gls-%K}"
:definition-structure "%d\n\\colon{} %v [%n uses]\n")
#+end_example

View File

@ -60,6 +60,7 @@ Export configuration
* Structure of an export template set::
* Creating a new glossary type::
* Tweaking specific exports::
* Adding a new export backend::
@end detailmenu
@end menu
@ -526,6 +527,7 @@ the use, when @code{org-glossary-display-substitute-value} is non-nil.
* Structure of an export template set::
* Creating a new glossary type::
* Tweaking specific exports::
* Adding a new export backend::
@end menu
@node Setting export parameters
@ -765,4 +767,31 @@ to avoid the @samp{\ifnum%n>0} @LaTeX{} switch.
This allows for any change in other backends or the defaults you're not
particularly attached to from freely updating.
@node Adding a new export backend
@section Adding a new export backend
Adding a new export spec is as easy as pushing a spec list to
@code{org-glossary-export-specs}, for example should we want to add an @samp{ox-md} backend we
could do this:
@example
(push '(md (t :use "[%t](#gls-%K)"
:definition "%t @{#gls-%K@}"
:definition-structure "%d\n\\colon@{@} %v [%n uses]\n"))
org-glossary-export-specs)
@end example
We need to remember to use @samp{\colon@{@}} instead of @samp{:} to avoid it being interpreted
as Org fixed-width syntax.
Alternatively, we could use @code{org-glossary-set-export-spec}, which has the
advantage of being idempotent, and I would argue a little clearer.
@example
(org-glossary-set-export-spec 'md t
:use "[%t](#gls-%K)"
:definition "%t @{#gls-%K@}"
:definition-structure "%d\n\\colon@{@} %v [%n uses]\n")
@end example
@bye