Closed holtzermann17 closed 3 years ago
Note, as a further special request:
For my use case, I'd actually want to export the blocks to span
rather than div
, although the standard Org Mode exporter, ox-html.el, would always export to div
. I wonder what how this extra level of customization might be arranged?
Gotcha, thanks for the update. I think handling for special-blocks should be simple. It will be like the example ox-hugo, but will render the blocktype as a class rather than an id. (although, it seems like there is an opportunity for a fair bit of "expansability" with allowing people to determine how different blocks be parsed at runtime; I will have to think about it for a future release).
Do you mind sharing why it should be a span
? Could you not use a div and style the class of it to resemble a span?
Ah, you're right, it can all be changed with CSS!
As you already know [but I didn't! -JC] the difference between a
<div>
and a<span>
is just that one defaults todisplay:block;
and the other todisplay:inline;
. To make one act as the other, just set the display style to the other type. (source)
This brief update is beyond the scope of Firn but in my attempt to mock up a preliminary solution by hand, I couldn't get the special block to display properly with display:inline;
https://gist.github.com/holtzermann17/c907d070cff649e7c9c5665aa7cf325e
OK, I figured out why it isn't working:
'display', 'position', and 'float' — interact as follows: ... if 'float' has a value other than 'none', the box is floated and 'display' is set according to the table below: Specified value Computed value inline, table-row-group, table-column, table-column-group, table-header-group, table-footer-group, table-row, table-cell, table-caption, inline-block block
With the upshot that my naive suggestion to use span
may be the only way to go in this case!
Just to mention:
#+BEGIN_LATEX
\begin{align} \mathcal{F}(a) &=
\frac{1}{2\pi i}\oint_\gamma \frac{f(z)}{z - a}\,dz\\
\int_D (\nabla\cdot \mathcal{F})\,dV &=\int_{\partial D}\mathcal{F}\cdot n\, dS \end{align}
#+END_LATEX
and such-like represent a special case of the above. This doesn't fully solve the "LaTeX environment" part of #56 (because it doesn't say what to do with the align
environment) but maybe it can be useful for something. E.g., with a translation rule that could become:
$$\begin{align} \mathcal{F}(a) &=
\frac{1}{2\pi i}\oint_\gamma \frac{f(z)}{z - a}\,dz\\
\int_D (\nabla\cdot \mathcal{F})\,dV &=\int_{\partial D}\mathcal{F}\cdot n\, dS \end{align}$$
at which point MathJaX would know what to do with it. (The author could have just written the latter expression directly, but maybe there are reasons to mark things up differently at times.)
In regular Org mode, it’s possible to define your own blocks which are then exported to a
div
with the given block name, e.g.,turns into
The relevant code is in
org-html-special-block
in ox-html.el. With Firn, it seems these blocks aren’t currently exported, but they're confirmed to be recognized in the Orgize JSON export. Could they be enabled here?