|
From: | Diego Zamboni |
Subject: | Re: Differentiate source blocks in export? |
Date: | Tue, 24 Nov 2020 17:22:53 +0100 |
Nice! Here is a little more compact way to do that I think:@@html:<div class="myclass">@@
#+BEGIN_SRC python
print(5)
#+END_SRC
@@html:</div>@@John
-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803On Tue, Nov 24, 2020 at 11:08 AM Marvin ‘quintus’ Gülker <post+orgmodeml@guelker.eu> wrote:Hi!
Am Dienstag, dem 24. November 2020 schrieb Joost Kremers:
> I was wondering if there's a way to distinguish between different kind of source
> code blocks when exporting to HTML.
>
> Specifically, I would like a way to mark certain code blocks in my Org file so
> that those code blocks get a specific class in the HTML export.
You can use the BEGIN_EXPORT/END_EXPORT pair to include a literal HTML
DIV tag around your target code block. Try this:
Wrapped code block in a div with a custom class:
#+BEGIN_EXPORT html
<div class="myclass">
#+END_EXPORT
#+BEGIN_SRC c
#include <stdio.h>
int main(int argc, char* argv[])
{
printf("This is wrapped in the div\n");
return 0;
}
#+END_SRC
#+BEGIN_EXPORT html
</div>
#+END_EXPORT
Normal codeblock without:
#+BEGIN_SRC c
#include <stdio.h>
int main(int argc, char* argv[])
{
printf("This is not wrapped in anything unusual\n");
return 0;
}
#+END_SRC
Note how one of the EXPORT blocks wraps the opening tag of the DIV and
the other one wraps the closing tag.
-quintus
--
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | For security:
Passau, Germany | kontakt@guelker.eu | () Avoid HTML e-mail
European Union | PGP: see homepage | /\ http://asciiribbon.org
[Prev in Thread] | Current Thread | [Next in Thread] |