1. What is Simple?

Simple is a plugin for IncPlugins. It allows you to write HTML texts in a text-like form without tags. In additional you can mix it with HTML code.

Simple is very optimized for execute speed and usage, but we do not recommend you to write texts with a summary size >50 KBytes to prevent overloading your web server.

Simple generates a valid XHTML code. Our web site and this documentation are fully written using Simple.

2. Simple installation

2.1. Installation steps

Download the latest Simple release. It comes with IncPlugins Pro. Unzip it to any temporary directory. Copy simple.php to your IncPlugins directory. Add the plugin include line to the IncPlugins settings file settings.php.

For best results you can download and install Highlight plugin. When this plugin is installed, Simple will highlight <pre> areas and highlighted blocks [~ ~] for you.

2.2. Testing

Create any page with a code:

<?php include_once 'inc/inc.php';
inc();?>

@ Header example

* First line
* Second line
* Third line

If all are correct you will see HTML code as the result:

Header example

  • First line
  • Second line
  • Third line

3. Blocks

3.1. Paragraphs <p>

To write paragraphs separate them by single or multiply empty lines.

Example:

Paragraph one. Paragraph one.
Paragraph one. Paragraph one.

Paragraph two. Paragraph two.


Paragraph three. Paragraph three.
Paragraph three. Paragraph three.

This code will produce this HTML output:

Paragraph one. Paragraph one. Paragraph one. Paragraph one.

Paragraph two. Paragraph two.

Paragraph three. Paragraph three. Paragraph three. Paragraph three.

<p>Paragraph one. Paragraph one.
Paragraph one. Paragraph one.</p>

<p>Paragraph two. Paragraph two.</p>


<p>Paragraph three. Paragraph three.
Paragraph three. Paragraph three.</p>

Note: if you place paragraphs into <div> do not forget to separate them by single or multiply empty lines. If you will not do it, you will get a <div> content, not a paragraph.

3.2. Headers <h1>,<h2>,...,<h6>

To write headers, place character @ in the begin of a line beginning from the first position. Count of @ characters will correspond to the header level.

Example:

@ H1
@@ H2
@@@ H3
@@@@ H4
@@@@@ H5
@@@@@@ H6

This code will produce this HTML output:

H1

H2

H3

H4

H5
H6
<h1>H1</h1>
<h2>H2</h2>
<h3>H3</h3>
<h4>H4</h4>
<h5>H5</h5>
<h6>H6</h6>

Note: a header will close the previous paragraph. To use @ in the begin of a line enter a space in the first position of a line before @.

3.3. Lists <ul>

To write lists, place * character in the begin of a line. To repeat a list line place a space or a tab character at the begin of a next line.

Example:

* One
* Two
  two
  two
* Three

This code will produce this HTML output:

  • One
  • Two two two
  • Three
<ul><li>One</li>
<li>Two
  two
  two</li>
<li>Three</li></ul>

Note: To use * in the begin of a line enter a space in the first position of a line before *.

Nested lists are not supported. Use a HTML code.

3.4. Lists <ol>

To write numeric lists, place # character in the begin of a line, and a number (optional). To repeat a list line place a space or a tab character at the begin of a next line.

Example:

#1 One
#2 Two
   two
   two
#3 Three

This code will produce this HTML output:

  1. One
  2. Two two two
  3. Three
<ol><li>One</li>
<li>Two
   two
   two</li>
<li>Three</li></ol>

Note: To use # in the begin of a line enter a space in the first position of a line before #.

Nested lists are not supported. Use a HTML code.

3.5. Preformatted text <pre>

To write a preformatted text, place ~ character in the begin of a line, the text programming language code and one or more ~ characters. Then write your text and close it by two or more ~ characters in a new line. If you have Highlight plugin installed, your preformatted text will be highlighted.

Example:

 ~html~
 <b>Some text</b>
 ~~

 ~html~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 <b>Some text</b>
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This code will produce this HTML output:

<b>Some text</b>
<b>Some text</b>
<pre>
{Highlighted HTML code}
</pre>

<pre>
{Highlighted HTML code}
</pre>

You can place even PHP code. But to disable PHP executing, replace the PHP code signatures <?php, <? and ?> by the following: <[php, <[ and ]>.

Example:

 ~php~
 <[php echo "Some php code"; ]>
 ~~

This code will produce this HTML output:

<?php echo "Some php code"; ?>
<pre>
{Highlighted PHP code}
</pre>

Additional <div> blocks over <pre> and CSS style are supported too. Insert them into header string, using * as dividers. Examples:

 ~php*pre_style~
 ...
 ~~
 ~php*div_style*div_style*pre_style~
 ...
 ~~

Note: To use ~ in the begin of a line enter a space in the first position of a line before ~.

3.6. Block <div>

To write a block, place - character in the begin of a line, a CSS class name and one or more - characters. Then write your text and close it by two or more - characters in a new line. Blocks can be placed into another blocks.

Example:

-example_yellow-
 <h1>Some text</h1>
--
-example_lime----------------------------------
<h1>Some text</h1>
-----------------------------------------------

This code will produce this HTML output:

Some text

Some text

<div class="example_yellow">
<h1>Some text</h1>
</div>
<div class="example_lime">
<h1>Some text</h1>
</div>

To place paragraphs into <div> do not forget to separate it by single or multiply empty lines. If you will not do it, you will get a <div> content, not a paragraph.

Example:

-example_yellow-
Div text
--
-example_lime-

Paragraph text
--

This code will produce this HTML output:

Div text

Paragraph text

<div class="example_yellow">
Div text
</div>
<div class="example_lime">

<p>Paragraph text
</p></div>

Additional <div> blocks are supported too. Insert them into header string, using * as dividers. Example:

-div_style1*div_style2*div_style3-
Div text
--

Note: To use - in the begin of a line enter a space in the first position of a line before -.

3.7. Line breaks <br />

To add <br /> tag into your texts simply insert \ character at the end of a line.

Example:

Line 1\
Line 2

This code will produce this HTML output:

Line 1
Line 2
Line 1<br />
Line 2

Note: To use \ in the end of a line enter a space after \ in the last position of a line.

4. Text transformations

4.1. Mixing with HTML code

You can use any HTML code directly. Example:

Line 1\
<div class="example_lime">Line 2</div>

This code will produce this HTML output:

Line 1
Line 2
Line 1<br />
<div class="example_lime">Line 2</div>

4.2. Insertion of HTML code as text

To insert characters <, >, & and HTML code as text, place them between [: and :]. Example:

Text [:<h1>:]Header[:</h1>:] Text

This code will produce this HTML output:

Text <h1>Header</h1> Text
Text &lt;h1&gt;Header&lt;/h1&gt; Text

4.3. Text formatting

To format text use special constructions used in the example:

[*bold text*]
[@bold text@]
[/italic text/]
[#teletype text#]
[_underline text_]
[-strikeout text-]
[^super line text^]
[`subline text`]

This code will produce this HTML output:

bold text bold text italic text teletype text underline text strikeout text super line text subline text
<b>bold text</b>
<b>bold text</b>
<i>italic text</i>
<tt>teletype text</tt>
<u>underline text</u>
<s>strikeout text</s>
<sup>super line text</sup>
<sub>subline text</sub>

4.4. Highlighted text

You can highlight text if a highlighting plugin is installed. To highlight use commands: [~ (for HTML/PHP/JavaScript) or [~~language~ to specify a begin of the text to highlight and ~] to end of it.

Example:

Link: [~<a href="/">root</a>~] is a good link;
Function: [~~php~function a($name = '');~]

This code will produce this HTML output:

Link: <a href="/">root</a> is a good link;
Function: function a($name = '');
Link: {Highlighted text} is a good link;
Function: {Highlighted text}

You can place even PHP code. But to disable PHP executing, replace the PHP code signatures <?php, <? and ?> by the following: <[php, <[ and ]>.

4.5. Anchors <a>

To insert anchors and links to anchors use special constructions used in the example. Here are * separate anchor links from URL.

[[#anchor]]
[[Link to anchor*#anchor]]

This code will produce this HTML output:

<a name="anchor" />
<a href="#anchor">Link to anchor</a>

4.6. Links <a>

To insert links use special constructions used in the example. Here are * separate link names from URL.

[[index.php]]
[[Link*index.php]]
[[Link with border*index.php*example_border]]
[[Link with title*index.php*_title]]
[[Link with no follow*index.php*_nofollow]]
[[Link in a blank window*index.php*_blank]]
[[Link with custom tags*index.php**style="background-color: red;"]]

This code will produce this HTML output:

<a href="index.php">index.html</a>
<a href="index.php">Link</a>
<a href="index.php" class="example_border">Link with border</a>
<a href="index.php" title="Link with title">Link with title</a>
<a href="index.php" rel="nofollow">Link with no follow</a>
<a href="index.php" target="_blank">Link in a blank window</a>
<a href="index.php" style="background-color: red;">Link with custom tags</a>

4.7. Images <img />

To insert images use special constructions used in the example. Here are * separate image names from URL.

[[image.jpg]]
[[Image name*image.jpg]]
[[*image.jpg*example_border]]
[[Image name*image.jpg*example_border]]
[[Image with title*image.jpg*_title]]
[[Image with custom tags*image.jpg**width="64" height="64"]]

This code will produce this HTML output:

Image name Image name Image with title Image with custom tags
<img src="image.jpg" alt="" />
<img src="image.jpg" alt="Image name" />
<img src="image.jpg" alt="" class="example_border" />
<img src="image.jpg" alt="Image name" class="example_border" />
<img src="image.jpg" alt="Image with title" title="Image with title" />
<img src="image.jpg" alt="Image with custom tags" width="64" height="64" />

4.8. Typographic replacements: a dash and quotes

Simple automatically replaces  -  (space indented), ' and " to the typographic equivalents: em dash symbol and typographic quotes.

Example:

Knowledge - Power! Don't "speak"!

This code will produce this HTML output:

Knowledge — Power! Don’t “speak”!
Knowledge &mdash; Power!
Don&rsquo;t &ldquo;speak&rdquo;!

You can change the generated entities for your language. See the simple source for details. Odd and even quotes are different.

4.9. Non-break space (&nbsp;)

To insert Non-break space use command [].

Example:

Windows[]XP

This code will produce this HTML output:

Windows XP
Windows&nbsp;XP

5. Special Cases

5.1. Using special symbols

Simple is only an extension over HTML, so you should use HTML rules to write your texts. I.e. to write & you must use &amp; or [:&:].

In some cases when you insert a text to your page you should check it for special symbols: &, <, >, [, ]. We recommend hide these symbols using [:your_symbol_here:].

New lines should not begin with: @, -, ~, *, #. Also your lines should not end with \. To prevent special commands just insert a space symbol in a begin or end of line. You can also reformat your text.

Simple also replaces  -  to em dash, and keyboard quotes to the typographic quotes; so if you want use - and keyboard quotes just enter [:-:], [:':] or [:":].

5.2. Using JavaScript and CSS

Simple understands these cases. But in a some cases it may work not as fine, as you want. In these cases do not use Simple for such pages or reformat your scripts. If you cannot anyway get a valid code, please contact us, because your situation may be a bug.

5.3. Paragraphs after block-level HTML tags

If you mix HTML with Simple to enter a paragraph please use an empty line after block-level HTML tags like <div>, </div>, <h1>, </h1>.

5.4. User-defined functions

Simple supports user defined functions for these elements:

To replace default functions create new versions and set new function names to settings variables:

$simple_hig_function  = 'simple_hig';
$simple_html_function = 'simple_html';
$simple_pre_function  = 'simple_pre';
$simple_div_function  = 'simple_div';
$simple_obj_function  = 'simple_obj';

See source code for details.

5.5. User-defined formatting functions

You can add or change the generated code of formatting functions using settings arrays modifications. See the source code for details.