Metadata-Version: 2.5
Name: collective.responsivetables
Version: 1.0.0b1
Summary: An addon to convert tables inserted in TinyMCE responsive!
Project-URL: Homepage, https://github.com/collective/collective.responsivetables
Project-URL: PyPI, https://pypi.org/project/collective.responsivetables
Project-URL: Source, https://github.com/collective/collective.responsivetables
Project-URL: Tracker, https://github.com/collective/collective.responsivetables/issues
Author-email: Mikel Larreategi <mlarreategi@codesyntax.com>
License-Expression: GPL-2.0-only
License-File: LICENSE.GPL
License-File: LICENSE.md
Keywords: CMS,Plone,Python
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Plone
Classifier: Framework :: Plone :: 6.0
Classifier: Framework :: Plone :: 6.1
Classifier: Framework :: Plone :: 6.2
Classifier: Framework :: Plone :: Addon
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Requires-Dist: plone-api
Requires-Dist: products-cmfplone
Requires-Dist: z3c-jbot
Provides-Extra: release
Requires-Dist: zest-pocompile; extra == 'release'
Requires-Dist: zest-releaser[recommended]; extra == 'release'
Requires-Dist: zestreleaser-towncrier; extra == 'release'
Provides-Extra: test
Requires-Dist: horse-with-no-namespace; extra == 'test'
Requires-Dist: plone-app-testing; extra == 'test'
Requires-Dist: plone-classicui; extra == 'test'
Requires-Dist: plone-restapi[test]; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest-plone>=1.0.0a2; extra == 'test'
Description-Content-Type: text/markdown

<div align="center">
    <h1 align="center">collective.responsivetables</h1>
</div>
<div align="center">

[![PyPI](https://img.shields.io/pypi/v/collective.responsivetables)](https://pypi.org/project/collective.responsivetables/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/collective.responsivetables)](https://pypi.org/project/collective.responsivetables/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/collective.responsivetables)](https://pypi.org/project/collective.responsivetables/)
[![PyPI - License](https://img.shields.io/pypi/l/collective.responsivetables)](https://pypi.org/project/collective.responsivetables/)
[![PyPI - Status](https://img.shields.io/pypi/status/collective.responsivetables)](https://pypi.org/project/collective.responsivetables/)


[![PyPI - Plone Versions](https://img.shields.io/pypi/frameworkversions/plone/collective.responsivetables)](https://pypi.org/project/collective.responsivetables/)

[![CI](https://github.com/collective/collective.responsivetables/actions/workflows/main.yml/badge.svg)](https://github.com/collective/collective.responsivetables/actions/workflows/main.yml)
![Code Style](https://img.shields.io/badge/Code%20Style-Black-000000)

[![GitHub contributors](https://img.shields.io/github/contributors/collective/collective.responsivetables)](https://github.com/collective/collective.responsivetables)
[![GitHub Repo stars](https://img.shields.io/github/stars/collective/collective.responsivetables?style=social)](https://github.com/collective/collective.responsivetables)

</div>

An automated Plone output filter that ensures all tables inside rich text fields are mobile-responsive.

## Features

Using `plone.outputfilter` and BeautifulSoup, this addon automatically parses outgoing HTML content, ensures every `<table>` has a `table` class, and wraps them in a scrollable `<div class="table-responsive">` container.

## Features

Whenever a Plone RichText field is rendered, this addon transparently intercepts the HTML and applies the following DOM transformations:

* **Detects** all `<table>` tags.

* **Injects** the `table` CSS class to the table (only if it doesn't already exist, preserving existing classes).

* **Wraps** the table in a `<div class="table-responsive">` element to allow for horizontal scrolling on small screens via CSS.

### Example Transformation

**Original HTML (from TinyMCE):**

```html
<table class="listing">
  <tr><td>Data</td></tr>
</table>
```

**Output (Rendered in browser):**

```html
<div class="table-responsive">
  <table class="listing table">
    <tr><td>Data</td></tr>
  </table>
</div>
```

## How it works

This package registers a custom filter in the `plone.outputfilter` pipeline. When text is transformed from `text/html` to `text/x-html-safe` (or rendered to the browser), the filter intercepts the HTML string, processes it through `beautifulsoup4`, manipulates the tags, and returns the modified HTML.

Because it operates at the output filter level, it never alters the original data saved in your ZODB. Your editors can continue using tables normally in TinyMCE without worrying about layout-breaking containers.


## Installation

Install collective.responsivetables with `pip`:

```shell
pip install collective.responsivetables
```

And to create the Plone site:

```shell
make create-site
```

## Contribute

- [Issue tracker](https://github.com/collective/collective.responsivetables/issues)
- [Source code](https://github.com/collective/collective.responsivetables/)

### Prerequisites ✅

-   An [operating system](https://6.docs.plone.org/install/create-project-cookieplone.html#prerequisites-for-installation) that runs all the requirements mentioned.
-   [uv](https://6.docs.plone.org/install/create-project-cookieplone.html#uv)
-   [Make](https://6.docs.plone.org/install/create-project-cookieplone.html#make)
-   [Git](https://6.docs.plone.org/install/create-project-cookieplone.html#git)
-   [Docker](https://docs.docker.com/get-started/get-docker/) (optional)

### Installation 🔧

1.  Clone this repository, then change your working directory.

    ```shell
    git clone git@github.com:collective/collective.responsivetables.git
    cd collective.responsivetables
    ```

2.  Install this code base.

    ```shell
    make install
    ```


### Add features using `plonecli` or `bobtemplates.plone`

This package provides markers as strings (`<!-- extra stuff goes here -->`) that are compatible with [`plonecli`](https://github.com/plone/plonecli) and [`bobtemplates.plone`](https://github.com/plone/bobtemplates.plone).
These markers act as hooks to add all kinds of subtemplates, including behaviors, control panels, upgrade steps, or other subtemplates from `plonecli`.

To run `plonecli` with configuration to target this package, run the following command.

```shell
make add <template_name>
```

For example, you can add a content type to your package with the following command.

```shell
make add content_type
```

You can add a behavior with the following command.

```shell
make add behavior
```

```{seealso}
You can check the list of available subtemplates in the [`bobtemplates.plone` `README.md` file](https://github.com/plone/bobtemplates.plone/?tab=readme-ov-file#provided-subtemplates).
See also the documentation of [Mockup and Patternslib](https://6.docs.plone.org/classic-ui/mockup.html) for how to build the UI toolkit for Classic UI.
```

## License

The project is licensed under GPLv2.

## Credits and acknowledgements 🙏

Generated using [Cookieplone (2.0.0)](https://github.com/plone/cookieplone) and [cookieplone-templates (db76a81)](https://github.com/plone/cookieplone-templates/commit/db76a81d89db7ed23d6873e5323bdbfc63cd6197) on 2026-09-23 14:47:25.235378. A special thanks to all contributors and supporters!


---

# Changelog

<!--
   You should *NOT* be adding new change log entries to this file.
   You should create a file in the news directory instead.
   For helpful instructions, please see:
   https://github.com/plone/plone.releaser/blob/master/ADD-A-NEWS-ITEM.rst
-->

<!-- towncrier release notes start -->

## 1.0.0b1 (2026-09-23)


### Tests

- Add unit and integration tests for the responsive tables filter and make it idempotent so already-wrapped tables are not wrapped again. [#1](https://github.com/collective/collective.responsivetables/issues/1)
