User:Sean/autop

From Habari Project

Jump to: navigation, search

Contents

AutoP

In Habari, AutoP is the functionality that automatically turns multiple line breaks into paragraph elements in the rendered HTML, easing the markup burden on authors.

This page serves as a forum to document the expected behavior of AutoP in Habari, especially the cases where the expected behavior is non-obvious.

Declarations

  • two or more line breaks turn into a single HTML paragraph separator in most cases
  • a single line break turns into a single HTML line break in most cases
  • Unless the input text is the start tag of a block element (see bellow), the entry is automatically started with a <p> tag
  • empty paragraphs are stripped (<p></p>)
  • certain elements are exempt from AutoP (see below)
  • TODO: more...

Questions

  • how should we handle completely invalid markup from the author? (e.g.: <b>foo<i>bar</b></i>)
  • certain non-block elements imply autop and others do not. Which? (e.g.: <b>foo\n\nbar</b> should become what? <p><b>foo</b></p><p><b>bar</b></p> ? If so, this really messes up with <li>foo\n\nbar</li>)

Elements

Block Elements

'address','blockquote','center','dir','div','dl','fieldset','form','h1','h2','h3','h4','h5','h6','hr','isindex','menu','noframes','noscript','ol','p','pre','table','ul'

AutoP Exempt Elements

'pre','blockquote','code','ul','h1','h2','h3','h4','h5','h6'

Personal tools