Download the PHP package ckunkle/markdownwriter without Composer
On this page you can find all versions of the php package ckunkle/markdownwriter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ckunkle/markdownwriter
More information about ckunkle/markdownwriter
Files in ckunkle/markdownwriter
Package markdownwriter
Short Description Library for generating markdown files
License MIT
Informations about the package markdownwriter
Markdown Writer
Description
A library for generating markdown using PHP. This library provides a class for building markdown following the CommonMark specification. It also provides support for some common extensions including:
- Superscripts
- Subscripts
- Tables
- Strikethrough (Using
~~syntax~~
)
Intallation
Example Usage
For a more elaborate example, view the script that generated this README file.
API
Inline Methods
Methods that transform input to return a formatted markdown string
italic
Format italic string
bold
Format bold string
superscript
Format superscript
subscript
Format subscript
code
Format inline code
strikethrough
Format strikethrough
link
Format an inline link
image
Format an inline image
Block Methods
Methods that write to the markdown result
write
Append string to the markdown result
block
Write an EOL string if the markdown result is not empty, write the provided string, then write another EOL string. This keeps blank lines between consecutive block elements.
p
Writes a paragraph to the markdown result making sure that there are blank lines before and after.
nl
Appends an EOL string to the markdown result
h1
Write a header 1
h2
Write a header 2
h3
Write a header 3
h4
Write a header 4
h5
Write a header 5
h6
Write a header 6
hr
Write a horizontal rule
ulItem
Write an unordered list item. Optionally provide the number of tabs to prepend to it
olItem
Write an ordered list item. Optionally provide the number of tabs to prepend to it and the string to prepend it with (defaults to 1)
ul
Write an unordered list. Use nested arrays to indicate nesting sublists.
ol
Write an ordered list. Use nested arrays to indicate nesting sublists.
blockQuote
Write a blockquote. This supports a few different syntaxes:
codeBlock
Write a "fenced" code block. Accepts a string or array of lines. Optionally pass a language for syntax highlighting as the second parameter.
table
Write a table. This expects an array of arrays where the first array is the header row, and the following arrays represent table rows.
Configuration/Misc
All other methods
setEOL
Set the EOL string. By default this is set to PHP_EOL
eol
Get the EOL string
__toString
Returns the markdown result string