MYMARKDOWN.PHP

NAME

mymarkdown.php

SYNOPSIS

mymarkdown.php - an "almost" markdown parser to be used from the command line

mymarkdown.php < input.md > output.html

mymarkdown.inc.php - an "almost" markdown parser to be used as a website include file

include mymarkdown.inc.php

DESCRIPTION

An entire markdown parser in less than 150 lines of PHP

Uses regexs for syntax transformations

"Almost" markdown means all of core markdown but with a few minor syntax changes to make formatting more intuitive for a casual user

APPLICATION

This markdown input syntax:

INLINE/SPAN formats, can be anywhere on a line 

# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6

**bold**
//italics//
--strikethru--
__underline__

Some `inline code` statements, use this technique for literals

Some inline **bolding** of text

Put html where you like `<br>` <br> on a line, passed untouched for display

A link is [Google link](http:///google.com)

An image is ![Alt text](/path/to/image.jpg)

NEWLINE/BLOCK formats, must start at line start

block

of preformatted

code



* List item 1
* List item 2
** Sub list item
*** Sub sub list item
* List item 3


1. List item 1
2. List item 2
2.1. Sub list item
2.2. Sub list item
2.2.1. Sub sub list item
3. List item 3


> Level 1 blockquote
>
>
>> Level 2 blockquote
>>
>>


horizontal rule is 3 or more dashes
---


PARAGRAPHS

Paragraphs are text with a blank line above and below, no indenting of text

   Indeed space before an indented paragraph gets removed

Some paragraphs can be very long - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

To force a line break in text add 2 spaces at a line ending  
this breaks the line  
into bits




Two or more new lines before this paragraph have created a paragraph break to here

Creates this HTML output:

INLINE/SPAN formats, can be anywhere on a line

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

bold

italics

strikethru

underline

Some inline code statements, use this technique for literals

Some inline bolding of text

Put html where you like <br>
on a line, passed untouched for display

A link is Google link

An image is \"Alt


NEWLINE/BLOCK formats, must start at line start

    block

of preformatted

code


  1. List item 1
  2. List item 2
    1. Sub list item
    2. Sub list item
      1. Sub sub list item
  3. List item 3


Level 1 blockquote


Level 2 blockquote



horizontal rule is 3 or more dashes



PARAGRAPHS

Paragraphs are text with a blank line above and below, no indenting of text

Indeed space before an indented paragraph gets removed

Some paragraphs can be very long - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

To force a line break in text add 2 spaces at a line ending
this breaks the line
into bits


Two or more new lines before this paragraph have created a paragraph break to here

```

BUGS

None known

AUTHOR

John Bartlett
johnb@thesolution.com.au

SEE ALSO

Standalone