DeactivateParagraphTag

Summary: Prevent the automatic insertion of a <p> tag by the markup engine
Version: 20220423
Prerequisites:
Status: Beta
Maintainer: Petko
License: Public domain
Categories: Markup, Layout
Users: (view? / edit)

Is there a way to prevent the insertion of HTML <p> tags, if possible at selected places on page?

Description

Prevent the automatic insertion of a <p> tag by the markup engine, at selected places in a page.

Installation

Add to config.php:

  Markup('nop', 'directives', '/^\(:nop:\)/m', '<:block>');

This enables a directive (:nop:) at the beginning of a line, which causes the following text on that line, to not be wrapped in <p>...</p> tags.

If you're writing a custom markup and do not want the output to be wrapped in <p> tags, you can simply include '<:block>' before it.

Usage

Place (:nop:) at the beginning of a line that you don't want wrapped in <p> tags. A previously open paragraph will be closed.

If the current line doesn't end with a backslash, and the following line doesn't start with (:nop:) the latter will be wrapped in <p> tags.

The HTML <p> paragraphs below have a red dotted border:

This is a paragraph

(:nop:) This is not

Another paragraph
(:nop:) Outside of paragraph \\
New line, outside or paragraph

(:nop:) Not a paragraph
A paragraph

This is a paragraph

This is not

Another paragraph

Outside of paragraph
New line, outside or paragraph
Not a paragraph

A paragraph

Change log / Release notes

  • 20220423 Initial release, ready to be tested.

See also

Contributors

Written and maintained by Petko.

Comments

See discussion at DeactivateParagraphTag-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.