This pelican plugin modifies article and page html to use bootstrap's default classes. This is especially handy if you want to write tables in markdown, since the attr_list
extension does not play nice with tables
.
- Beautifulsoup4 - install via
pip install beautifulsoup4
- Adds
table table-striped
to all<table>
elements. - Adds
img-fluid
to all<img>
elements. - Use
BOOTSTRAPIFY
in your Pelican configuration file to pass a{'css-selector': ['list-of-classes']}
dictionary to the plugin. Bootstrapify will appendlist-of-classes
to all tags that matchcss-selector
. The selector can be as simple as a tag name (table
orp
) or as complicated asa.menu:nth-of-type(3)
(see the Beautifulsoup4 documentation).
- Write your table in markdown
| Protocol | Contact Information
|:-------------- |:-----------------------------------------------------|
| jabber/xmpp | [[email protected]]([email protected]) |
| email | [[email protected]](mailto:[email protected]) |
| IRC - freenode | winlu |
- there is no step 2, the plugin adds the needed classes to the
<table>
node, resulting in the following output:
<table class="table table-striped table-hover">
<thead>
<tr>
<th align="left">Protocol</th>
<th align="left">Contact Information</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">jabber/xmpp</td>
<td align="left"><a href="[email protected]">[email protected]</a></td>
</tr>
<tr>
<td align="left">email</td>
<td align="left"><a href="mailto:[email protected]">[email protected]</a></td>
</tr>
<tr>
<td align="left"><span class="caps">IRC</span> - freenode</td>
<td align="left">winlu</td>
</tr>
</tbody>
</table>
- plugin seems not to fire for drafts
- not enough customization possible, maybe read article,page metadata for more options