Skip to main content

Ralsina.Me — Roberto Alsina's website

New rst2pdf feature: --strip-elements-with-class

First new fea­ture in rst2pdf in a long long time, but it was easy to do, and there was an ac­tu­al us­er need­ing it.

This ex­pos­es func­tion­al­i­ty rst2html al­ready had, so that's prob­a­bly why it was easy to do ;-)

In any case, what is it and what is it good for?

If you mark some­thing with a class, you can now omit it from the out­put:

.. class:: ignored

This will not be in the output if you use --strip-elements-with-class=ignored

And it's use­ful, for ex­am­ple, so you can keep slides and pre­sen­ta­tion notes in the same file. You just put your notes in a class you strip when pro­duc­ing the slides.

Since some class­es are au­to­mat­i­cal­ly as­signed for ad­mo­ni­tion­s, this is ex­tra sim­ple:

.. note:: This is a note admonition.

   Note admonitions always have the note class. So you can strip them easily.

And if you don't strip them, they will look pret­ty.


Contents © 2000-2020 Roberto Alsina