From ac6c3a5972fd37806aa73f5ee988f7f13915c103 Mon Sep 17 00:00:00 2001 From: mpeterv Date: Thu, 10 Sep 2015 22:57:19 +0300 Subject: [PATCH] Move description from markdown.lua into README --- README.md | 42 +++++++++++++++++-- markdown.lua | 116 --------------------------------------------------- 2 files changed, 39 insertions(+), 119 deletions(-) diff --git a/README.md b/README.md index b5a74c1..20958be 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,41 @@ -# markdown +# markdown.lua -A pure-lua implementation of the Markdown text-to-html markup system, written by Niklas Frykholm. +This is an implementation of the popular text markup language Markdown in pure Lua. +Markdown can convert documents written in a simple and easy to read text format +to well-formatted HTML. For a more thourough description of Markdown and the Markdown +syntax, see http://daringfireball.net/projects/markdown/. -Original: http://frykholm.se/files/markdown.lua +The original Markdown source is written in Perl and makes heavy use of advanced +regular expression techniques (such as negative look-ahead, etc) which are not available +in Lua's simple regex engine. Therefore this Lua port has been rewritten from the ground +up. It is probably not completely bug free. If you notice any bugs, please report them using +GitHub issues. A unit test that exposes the error is helpful. + +`markdown.lua` has been written by Niklas Frykholm ([original](http://www.frykholm.se/files/markdown.lua)). +This version has been updated to run under Lua 5.2 and Lua 5.3 in addition to Lua 5.1. + +## Usage + +```lua +local markdown = require "markdown" +markdown(source) +``` + +`markdown` module returns a single function which applies the Markdown transformation to the +specified string. For compatibility it is also set as a global. + +`markdown.lua` can also be used directly from the command line: + +``` +lua markdown.lua test.md +``` + +Creates a file `test.html` with the converted content of `test.md`. Run: + +``` +lua markdown.lua -h +``` + +For a description of the command-line options. + +`markdown.lua` uses the same license as Lua, the MIT license. diff --git a/markdown.lua b/markdown.lua index 443e6d1..68127d0 100644 --- a/markdown.lua +++ b/markdown.lua @@ -1,121 +1,5 @@ #!/usr/bin/env lua ---[[ -# markdown.lua -- version 0.32 - - - -**Author:** Niklas Frykholm, -**Date:** 31 May 2008 - -This is an implementation of the popular text markup language Markdown in pure Lua. -Markdown can convert documents written in a simple and easy to read text format -to well-formatted HTML. For a more thourough description of Markdown and the Markdown -syntax, see . - -The original Markdown source is written in Perl and makes heavy use of advanced -regular expression techniques (such as negative look-ahead, etc) which are not available -in Lua's simple regex engine. Therefore this Lua port has been rewritten from the ground -up. It is probably not completely bug free. If you notice any bugs, please report them to -me. A unit test that exposes the error is helpful. - -## Usage - - require "markdown" - markdown(source) - -``markdown.lua`` exposes a single global function named ``markdown(s)`` which applies the -Markdown transformation to the specified string. - -``markdown.lua`` can also be used directly from the command line: - - lua markdown.lua test.md - -Creates a file ``test.html`` with the converted content of ``test.md``. Run: - - lua markdown.lua -h - -For a description of the command-line options. - -``markdown.lua`` uses the same license as Lua, the MIT license. - -## License - -Copyright © 2008 Niklas Frykholm. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this -software and associated documentation files (the "Software"), to deal in the Software -without restriction, including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies -or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -## Version history - -- **0.32** -- 31 May 2008 - - Fix for links containing brackets -- **0.31** -- 1 Mar 2008 - - Fix for link definitions followed by spaces -- **0.30** -- 25 Feb 2008 - - Consistent behavior with Markdown when the same link reference is reused -- **0.29** -- 24 Feb 2008 - - Fix for
 blocks with spaces in them
--  **0.28** -- 18 Feb 2008
-   -  Fix for link encoding
--  **0.27** -- 14 Feb 2008
-   -  Fix for link database links with ()
--  **0.26** -- 06 Feb 2008
-   -  Fix for nested italic and bold markers
--  **0.25** -- 24 Jan 2008
-   -  Fix for encoding of naked <
--  **0.24** -- 21 Jan 2008
-   -  Fix for link behavior.
--  **0.23** -- 10 Jan 2008
-   -  Fix for a regression bug in longer expressions in italic or bold.
--  **0.22** -- 27 Dec 2007
-   -  Fix for crash when processing blocks with a percent sign in them.
--  **0.21** -- 27 Dec 2007
-   -  Fix for combined strong and emphasis tags
--  **0.20** -- 13 Oct 2007
-   -  Fix for < as well in image titles, now matches Dingus behavior
--  **0.19** -- 28 Sep 2007
-   -  Fix for quotation marks " and ampersands & in link and image titles.
--  **0.18** -- 28 Jul 2007
-   -  Does not crash on unmatched tags (behaves like standard markdown)
--  **0.17** -- 12 Apr 2007
-   -  Fix for links with %20 in them.
--  **0.16** -- 12 Apr 2007
-   -  Do not require arg global to exist.
--  **0.15** -- 28 Aug 2006
-   -  Better handling of links with underscores in them.
--  **0.14** -- 22 Aug 2006
-   -  Bug for *`foo()`*
--  **0.13** -- 12 Aug 2006
-   -  Added -l option for including stylesheet inline in document.
-   -  Fixed bug in -s flag.
-   -  Fixed emphasis bug.
--  **0.12** -- 15 May 2006
-   -  Fixed several bugs to comply with MarkdownTest 1.0 
--  **0.11** -- 12 May 2006
-   -  Fixed bug for escaping `*` and `_` inside code spans.
-   -  Added license terms.
-   -  Changed join() to table.concat().
--  **0.10** -- 3 May 2006
-   -  Initial public release.
-
-// Niklas
-]]
-
 ----------------------------------------------------------------------
 -- Utility functions
 ----------------------------------------------------------------------