[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

customized link pointing at a src block

From: Łukasz Stelmach
Subject: customized link pointing at a src block
Date: Sat, 02 Nov 2019 20:34:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)


I'd like to have collapsible source code blocks in my org document
exported to HTML. To collapse and restore I have used[1]. The library
requires a link (or a button) with appropirate properties. A link needs
to point (href) to a block and have additional custom data-toggle
property. On Debian9/Emacs 24/org-mode 8.x I was able to craft such
links by hand

    #+HTML: <a class="btn" data-toggle="collapse" href="#code1">Show</a>

    #+NAME: code1
    #+BEGIN_SRC python
    return 42

On Debian10/Emacs26/org-mode 9.1.9 src blocks with a NAME get
automatically generated id-s (org-export-get-reference) and I can see no
way to determine href in my HTML snippet. (ATTR_HTML before org-mode
link does not work as advertised in the manual either).

Is there any way to generate a link (or a button) for every code block
with matching href/id you can recommend?

[1] https://getbootstrap.com/docs/4.2/components/collapse/

Kind regards,
Było mi bardzo miło.                                  --- Rurku. --- ...
>Łukasz<                                --- To dobrze, że mnie słuchasz.

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]