Components
Most of m.css CSS components are exposed to
Pelican via custom reST directives. Unlike with pure
CSS, the directives are not prefixed with m-
to save some typing —
which is the most important thing when authoring content.
How to use
Pelican
Download the m/components.py file, put it
including the m/
directory into one of your PLUGIN_PATHS
and add
m.components
package to your PLUGINS
in pelicanconf.py
. This
plugin assumes presence of m.htmlsanity.
PLUGINS += ['m.htmlsanity', 'm.components']
Python doc theme
Simply list the plugin in your PLUGINS
. The m.htmlsanity plugin is
available always, no need to mention it explicitly:
PLUGINS += ['m.components']
Doxygen theme
Unfortunately, due to a lack of extensibility of the Doxygen markup language,
it’s not possible to provide the components through easy-to-use commands. All
you have is the ability to apply CSS classes using @m_class
, @m_span
and @m_div
. See the
Doxygen theme-specific commands
for more information.
Transitions
Use .. transition::
directive to create a transition:
Blocks, notes, frame
Use .. block-default::
, .. block-primary::
etc. directives to create
blocks; use .. note-default::
,
.. note-primary::
etc. or .. frame::
directives to create
notes and frames. Blocks require
title to be present, notes and frames have it optional. Internally, these
elements are represented as a
topic directive.
Use the :class:
option to specify additional CSS classes.
Code, math and graph figure
Use .. code-figure::
to denote a code figure.
Then put a literal code block denoted by ::
or a .. code::
directive as the first element inside. Use the :class:
option to specify
additional CSS classes. The optional directive parameter can be used for a
figure caption.
Use .. console-figure::
to denote code figure styled for a
console listing.
Similarly, .. math-figure::
denotes a math figure
and .. graph-figure::
denotes a graph figure.
Text
Use .. text-default::
, .. text-primary::
etc. directives to
color a block of text. Internally,
these elements are represented as a container directive.
Use the :class:
option to specify additional CSS classes.
.. text-info:: :class: m-text-center Info text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ultrices a erat eu suscipit. Aliquam pharetra imperdiet tortor sed vehicula. `Link. <#>`_
There are no interpreted text roles provided for inline colored text, but you
can define a custom one and add the CSS classes to it, potentially deriving it
from either the :emphasis:
or :strong:
role to combine color with
emphasis or strong text:
.. role:: text-dim :class: m-text m-dim .. role:: text-warning-strong(strong) :class: m-text m-warning Aenean id elit posuere, consectetur magna congue, sagittis est. :text-dim:`Dim inline text.` Pellentesque est neque, aliquet nec consectetur in, mattis ac diam. :text-warning-strong:`Warning strong text.`
Aenean id elit posuere, consectetur magna congue, sagittis est. Dim inline text. Pellentesque est neque, aliquet nec consectetur in, mattis ac diam. Warning strong text.
Tables
Mark your reST table with ..class:: m-table
to give it styling.
.. class:: m-table = ============= ================ # Heading Second heading = ============= ================ 1 Cell Second cell 2 2nd row cell 2nd row 2nd cell = ============= ================
# | Heading | Second heading |
---|---|---|
1 | Cell | Second cell |
2 | 2nd row cell | 2nd row 2nd cell |
Labels
Use :label-default:
etc. or :label-flat-default:
etc. to create
inline text labels.
- Design direction and project goals :label-success:`done` - Automated testing :label-danger:`missing` :label-flat-warning:`in progress`
- Design direction and project goals done
- Automated testing missing in progress
Other m.css features
You can use .. container::
directive to add a wrapping <div>
around most elements. Parameters of the directive are CSS classes. For example,
arranging content in three-column grid can be done like this:
.. container:: m-row .. container:: m-col-m-4 Left column content. .. container:: m-col-m-4 Middle column content. .. container:: m-col-m-4 Right column content.
For inline components not mentioned above, derive a custom role with additional CSS classes. For example:
.. role:: text-em-strong :class: m-text m-em m-strong You *should* be **very** aware of the :text-em-strong:`potential danger`.
You should be very aware of the potential danger.