In this repo i store all my websites, each in a different branch
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

384 Zeilen
15 KiB

  1. PHP Markdown
  2. ============
  3. PHP Markdown Lib 1.7.0 - 29 Oct 2016
  4. by Michel Fortin
  5. <https://michelf.ca/>
  6. based on Markdown by John Gruber
  7. <https://daringfireball.net/>
  8. Introduction
  9. ------------
  10. This is a library package that includes the PHP Markdown parser and its
  11. sibling PHP Markdown Extra with additional features.
  12. Markdown is a text-to-HTML conversion tool for web writers. Markdown
  13. allows you to write using an easy-to-read, easy-to-write plain text
  14. format, then convert it to structurally valid XHTML (or HTML).
  15. "Markdown" is actually two things: a plain text markup syntax, and a
  16. software tool, originally written in Perl, that converts the plain text
  17. markup to HTML. PHP Markdown is a port to PHP of the original Markdown
  18. program by John Gruber.
  19. * [Full documentation of the Markdown syntax](<https://daringfireball.net/projects/markdown/>)
  20. — Daring Fireball (John Gruber)
  21. * [Markdown Extra syntax additions](<https://michelf.ca/projects/php-markdown/extra/>)
  22. — Michel Fortin
  23. Requirement
  24. -----------
  25. This library package requires PHP 5.3 or later.
  26. Note: The older plugin/library hybrid package for PHP Markdown and
  27. PHP Markdown Extra is still maintained and will work with PHP 4.0.5 and later.
  28. Before PHP 5.3.7, pcre.backtrack_limit defaults to 100 000, which is too small
  29. in many situations. You might need to set it to higher values. Later PHP
  30. releases defaults to 1 000 000, which is usually fine.
  31. Usage
  32. -----
  33. This library package is meant to be used with class autoloading. For autoloading
  34. to work, your project needs have setup a PSR-0-compatible autoloader. See the
  35. included Readme.php file for a minimal autoloader setup. (If you cannot use
  36. autoloading, see below.)
  37. With class autoloading in place, putting the 'Michelf' folder in your
  38. include path should be enough for this to work:
  39. use \Michelf\Markdown;
  40. $my_html = Markdown::defaultTransform($my_text);
  41. Markdown Extra syntax is also available the same way:
  42. use \Michelf\MarkdownExtra;
  43. $my_html = MarkdownExtra::defaultTransform($my_text);
  44. If you wish to use PHP Markdown with another text filter function
  45. built to parse HTML, you should filter the text *after* the `transform`
  46. function call. This is an example with [PHP SmartyPants][psp]:
  47. use \Michelf\Markdown, \Michelf\SmartyPants;
  48. $my_html = Markdown::defaultTransform($my_text);
  49. $my_html = SmartyPants::defaultTransform($my_html);
  50. All these examples are using the static `defaultTransform` static function
  51. found inside the parser class. If you want to customize the parser
  52. configuration, you can also instantiate it directly and change some
  53. configuration variables:
  54. use \Michelf\MarkdownExtra;
  55. $parser = new MarkdownExtra;
  56. $parser->fn_id_prefix = "post22-";
  57. $my_html = $parser->transform($my_text);
  58. To learn more, see the full list of [configuration variables].
  59. [configuration variables]: https://michelf.ca/projects/php-markdown/configuration/
  60. ### Usage without an autoloader
  61. If you cannot use class autoloading, you can still use `include` or `require`
  62. to access the parser. To load the `\Michelf\Markdown` parser, do it this way:
  63. require_once 'Michelf/Markdown.inc.php';
  64. Or, if you need the `\Michelf\MarkdownExtra` parser:
  65. require_once 'Michelf/MarkdownExtra.inc.php';
  66. While the plain `.php` files depend on autoloading to work correctly, using the
  67. `.inc.php` files instead will eagerly load the dependencies that would be
  68. loaded on demand if you were using autoloading.
  69. Public API and Versioning Policy
  70. ---------------------------------
  71. Version numbers are of the form *major*.*minor*.*patch*.
  72. The public API of PHP Markdown consist of the two parser classes `Markdown`
  73. and `MarkdownExtra`, their constructors, the `transform` and `defaultTransform`
  74. functions and their configuration variables. The public API is stable for
  75. a given major version number. It might get additions when the minor version
  76. number increments.
  77. **Protected members are not considered public API.** This is unconventional
  78. and deserves an explanation. Incrementing the major version number every time
  79. the underlying implementation of something changes is going to give
  80. nonessential version numbers for the vast majority of people who just use the
  81. parser. Protected members are meant to create parser subclasses that behave in
  82. different ways. Very few people create parser subclasses. I don't want to
  83. discourage it by making everything private, but at the same time I can't
  84. guarantee any stable hook between versions if you use protected members.
  85. **Syntax changes** will increment the minor number for new features, and the
  86. patch number for small corrections. A *new feature* is something that needs a
  87. change in the syntax documentation. Note that since PHP Markdown Lib includes
  88. two parsers, a syntax change for either of them will increment the minor
  89. number. Also note that there is nothing perfectly backward-compatible with the
  90. Markdown syntax: all inputs are always valid, so new features always replace
  91. something that was previously legal, although generally nonsensical to do.
  92. Bugs
  93. ----
  94. To file bug reports please send email to:
  95. <michel.fortin@michelf.ca>
  96. Please include with your report: (1) the example input; (2) the output you
  97. expected; (3) the output PHP Markdown actually produced.
  98. If you have a problem where Markdown gives you an empty result, first check
  99. that the backtrack limit is not too low by running `php --info | grep pcre`.
  100. See Installation and Requirement above for details.
  101. Development and Testing
  102. -----------------------
  103. Pull requests for fixing bugs are welcome. Proposed new features are
  104. going to be meticulously reviewed -- taking into account backward compatibility,
  105. potential side effects, and future extensibility -- before deciding on
  106. acceptance or rejection.
  107. If you make a pull request that includes changes to the parser please add
  108. tests for what is being changed to [MDTest][] and make a pull request there
  109. too.
  110. [MDTest]: https://github.com/michelf/mdtest/
  111. Donations
  112. ---------
  113. If you wish to make a donation that will help me devote more time to
  114. PHP Markdown, please visit [michelf.ca/donate] or send Bitcoin to
  115. [1HiuX34czvVPPdhXbUAsAu7pZcesniDCGH].
  116. [michelf.ca/donate]: https://michelf.ca/donate/#!Thanks%20for%20PHP%20Markdown
  117. [1HiuX34czvVPPdhXbUAsAu7pZcesniDCGH]: bitcoin:1HiuX34czvVPPdhXbUAsAu7pZcesniDCGH
  118. Version History
  119. ---------------
  120. PHP Markdown Lib 1.7.0 (29 Oct 2016)
  121. * Added a `hard_wrap` configuration variable to make all newline characters
  122. in the text become `<br>` tags in the HTML output. By default, according
  123. to the standard Markdown syntax these newlines are ignored unless they a
  124. preceded by two spaces. Thanks to Jonathan Cohlmeyer for the implementation.
  125. * Improved the parsing of list items to fix problematic cases that came to
  126. light with the addition of `hard_wrap`. This should have no effect on the
  127. output except span-level list items that ended with two spaces (and thus
  128. ended with a line break).
  129. * Added a `code_span_content_func` configuration variable which takes a
  130. function that will convert the content of the code span to HTML. This can
  131. be useful to implement syntax highlighting. Although contrary to its
  132. code block equivalent, there is no syntax for specifying a language.
  133. Credits to styxit for the implementation.
  134. * Fixed a Markdwon Extra issue where two-space-at-end-of-line hard breaks
  135. wouldn't work inside of HTML block elements such as `<p markdown="1">`
  136. where the element expects only span-level content.
  137. * In the parser code, switched to PHPDoc comment format. Thanks to
  138. Robbie Averill for the help.
  139. PHP Markdown Lib 1.6.0 (23 Dec 2015)
  140. Note: this version was incorrectly released as 1.5.1 on Dec 22, a number
  141. that contradicted the versioning policy.
  142. * For fenced code blocks in Markdown Extra, can now set a class name for the
  143. code block's language before the special attribute block. Previously, this
  144. class name was only allowed in the absence of the special attribute block.
  145. * Added a `code_block_content_func` configuration variable which takes a
  146. function that will convert the content of the code block to HTML. This is
  147. most useful for syntax highlighting. For fenced code blocks in Markdown
  148. Extra, the function has access to the language class name (the one outside
  149. of the special attribute block). Credits to Mario Konrad for providing the
  150. implementation.
  151. * The curled arrow character for the backlink in footnotes is now followed
  152. by a Unicode variant selector to prevent it from being displayed in emoji
  153. form on iOS.
  154. Note that in older browsers the variant selector is often interpreted as a
  155. separate character, making it visible after the arrow. So there is now a
  156. also a `fn_backlink_html` configuration variable that can be used to set
  157. the link text to something else. Credits to Dana for providing the
  158. implementation.
  159. * Fixed an issue in MarkdownExtra where long header lines followed by a
  160. special attribute block would hit the backtrack limit an cause an empty
  161. string to be returned.
  162. PHP Markdown Lib 1.5.0 (1 Mar 2015)
  163. * Added the ability start ordered lists with a number different from 1 and
  164. and have that reflected in the HTML output. This can be enabled with
  165. the `enhanced_ordered_lists` configuration variable for the Markdown
  166. parser; it is enabled by default for Markdown Extra.
  167. Credits to Matt Gorle for providing the implementation.
  168. * Added the ability to insert custom HTML attributes with simple values
  169. everywhere an extra attribute block is allowed (links, images, headers).
  170. The value must be unquoted, cannot contains spaces and is limited to
  171. alphanumeric ASCII characters.
  172. Credits to Peter Droogmans for providing the implementation.
  173. * Added a `header_id_func` configuration variable which takes a function
  174. that can generate an `id` attribute value from the header text.
  175. Credits to Evert Pot for providing the implementation.
  176. * Added a `url_filter_func` configuration variable which takes a function
  177. that can rewrite any link or image URL to something different.
  178. PHP Markdown Lib 1.4.1 (4 May 2014)
  179. * The HTML block parser will now treat `<figure>` as a block-level element
  180. (as it should) and no longer wrap it in `<p>` or parse it's content with
  181. the as Markdown syntax (although with Extra you can use `markdown="1"`
  182. if you wish to use the Markdown syntax inside it).
  183. * The content of `<style>` elements will now be left alone, its content
  184. won't be interpreted as Markdown.
  185. * Corrected an bug where some inline links with spaces in them would not
  186. work even when surounded with angle brackets:
  187. [link](<s p a c e s>)
  188. * Fixed an issue where email addresses with quotes in them would not always
  189. have the quotes escaped in the link attribute, causing broken links (and
  190. invalid HTML).
  191. * Fixed the case were a link definition following a footnote definition would
  192. be swallowed by the footnote unless it was separated by a blank line.
  193. PHP Markdown Lib 1.4.0 (29 Nov 2013)
  194. * Added support for the `tel:` URL scheme in automatic links.
  195. <tel:+1-111-111-1111>
  196. It gets converted to this (note the `tel:` prefix becomes invisible):
  197. <a href="tel:+1-111-111-1111">+1-111-111-1111</a>
  198. * Added backtick fenced code blocks to MarkdownExtra, originally from
  199. Github-Flavored Markdown.
  200. * Added an interface called MarkdownInterface implemented by both
  201. the Markdown and MarkdownExtra parsers. You can use the interface if
  202. you want to create a mockup parser object for unit testing.
  203. * For those of you who cannot use class autoloading, you can now
  204. include `Michelf/Markdown.inc.php` or `Michelf/MarkdownExtra.inc.php` (note
  205. the `.inc.php` extension) to automatically include other files required
  206. by the parser.
  207. PHP Markdown Lib 1.3 (11 Apr 2013)
  208. This is the first release of PHP Markdown Lib. This package requires PHP
  209. version 5.3 or later and is designed to work with PSR-0 autoloading and,
  210. optionally with Composer. Here is a list of the changes since
  211. PHP Markdown Extra 1.2.6:
  212. * Plugin interface for WordPress and other systems is no longer present in
  213. the Lib package. The classic package is still available if you need it:
  214. <https://michelf.ca/projects/php-markdown/classic/>
  215. * Added `public` and `protected` protection attributes, plus a section about
  216. what is "public API" and what isn't in the Readme file.
  217. * Changed HTML output for footnotes: now instead of adding `rel` and `rev`
  218. attributes, footnotes links have the class name `footnote-ref` and
  219. backlinks `footnote-backref`.
  220. * Fixed some regular expressions to make PCRE not shout warnings about POSIX
  221. collation classes (dependent on your version of PCRE).
  222. * Added optional class and id attributes to images and links using the same
  223. syntax as for headers:
  224. [link](url){#id .class}
  225. ![img](url){#id .class}
  226. It work too for reference-style links and images. In this case you need
  227. to put those attributes at the reference definition:
  228. [link][linkref] or [linkref]
  229. ![img][linkref]
  230. [linkref]: url "optional title" {#id .class}
  231. * Fixed a PHP notice message triggered when some table column separator
  232. markers are missing on the separator line below column headers.
  233. * Fixed a small mistake that could cause the parser to retain an invalid
  234. state related to parsing links across multiple runs. This was never
  235. observed (that I know of), but it's still worth fixing.
  236. Copyright and License
  237. ---------------------
  238. PHP Markdown Lib
  239. Copyright (c) 2004-2016 Michel Fortin
  240. <https://michelf.ca/>
  241. All rights reserved.
  242. Based on Markdown
  243. Copyright (c) 2003-2005 John Gruber
  244. <https://daringfireball.net/>
  245. All rights reserved.
  246. Redistribution and use in source and binary forms, with or without
  247. modification, are permitted provided that the following conditions are
  248. met:
  249. * Redistributions of source code must retain the above copyright
  250. notice, this list of conditions and the following disclaimer.
  251. * Redistributions in binary form must reproduce the above copyright
  252. notice, this list of conditions and the following disclaimer in the
  253. documentation and/or other materials provided with the
  254. distribution.
  255. * Neither the name "Markdown" nor the names of its contributors may
  256. be used to endorse or promote products derived from this software
  257. without specific prior written permission.
  258. This software is provided by the copyright holders and contributors "as
  259. is" and any express or implied warranties, including, but not limited
  260. to, the implied warranties of merchantability and fitness for a
  261. particular purpose are disclaimed. In no event shall the copyright owner
  262. or contributors be liable for any direct, indirect, incidental, special,
  263. exemplary, or consequential damages (including, but not limited to,
  264. procurement of substitute goods or services; loss of use, data, or
  265. profits; or business interruption) however caused and on any theory of
  266. liability, whether in contract, strict liability, or tort (including
  267. negligence or otherwise) arising in any way out of the use of this
  268. software, even if advised of the possibility of such damage.