PHPackages                             emandiev/autop-twig-filter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. emandiev/autop-twig-filter

ActiveCraft-plugin[Templating &amp; Views](/categories/templating)

emandiev/autop-twig-filter
==========================

Craft CMS plugin. Adds a Twig filter that strips html and generates paragraphs from new lines.

1.0.0(6y ago)226MITPHPCI failing

Since Jan 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/emandiev/autop-twig-filter)[ Packagist](https://packagist.org/packages/emandiev/autop-twig-filter)[ RSS](/packages/emandiev-autop-twig-filter/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

autop Twig Filter plugin for Craft CMS 3
========================================

[](#autop-twig-filter-plugin-for-craft-cms-3)

A Twig filter that strips html and generates paragraphs from newlines.

Useful when you want to use the Plain Text field to generate `` and `` tags.

[![Example Usage](images/example.png)](images/example.png)

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.0.0 or later.

Installation
------------

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

`cd /path/to/project`

2. Then tell Composer to load the plugin:

`composer require emandiev/autop-twig-filter`

3. In the Control Panel, go to Settings → Plugins and click the “Install” button for autop Twig Filter.

Using autop Twig Filter
-----------------------

[](#using-autop-twig-filter)

You can use the `autop` filter without parameters like this:

`{{ entry.plainText|autop }}`

The filter will create `` tags from consecutive newlines and (by default) `` tags from single newlines.

The optional parameter `$br` allows you to disable the `` tag creation.

`{{ entry.plainText|autop(false) }}`

The plugin will also register a Twig function that you can use if needed.

`{% set formattedText = autop(entry.plainText) %}`

Configuring autop Twig Filter
-----------------------------

[](#configuring-autop-twig-filter)

You can create a file named `autop-twig-filter.php` in Craft's `config` folder to change the default parameter values.

For example, you can disable the default `` tag creation globally like this:

```
