add readme
This commit is contained in:
parent
ea73839bc4
commit
3e6ac2a635
76
README.md
76
README.md
@ -32,6 +32,82 @@ luarocks install discount3
|
|||||||
If you get a compilation error during installation, it's because discount isn't installed as a shared library. See the solution here: https://gitlabor.ru/Datenlabor/discount
|
If you get a compilation error during installation, it's because discount isn't installed as a shared library. See the solution here: https://gitlabor.ru/Datenlabor/discount
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
local markdown = require('discount3')
|
||||||
|
|
||||||
|
local html = markdown.compile(markdown_text)
|
||||||
|
|
||||||
|
print(html.body)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
table:
|
||||||
|
|
||||||
|
- body - html body
|
||||||
|
- title - doc's title (if header exists)
|
||||||
|
- author - doc's autor (if header exists)
|
||||||
|
- date - docs's date (if header exists)
|
||||||
|
- css - docs's CSS (if <style> exists)
|
||||||
|
- index - table of content (if flag = 'toc')
|
||||||
|
|
||||||
|
|
||||||
|
## Flags
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
markdown.compile(markdown_text,flag,flag,flag)
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### List of flags:
|
||||||
|
|
||||||
|
- "nolinks" - don’t do link processing, block tags
|
||||||
|
- "noimages" - don’t do image processing, block
|
||||||
|
- "nopants" - don’t run smartypants()
|
||||||
|
- "nohtml" - don’t allow raw html through AT ALL
|
||||||
|
- "strict" - conform to Markdown standard as implemented in Markdown.pl
|
||||||
|
- "tagtext" - process text inside an html tag
|
||||||
|
- "noext" - don’t allow pseudo-protocols
|
||||||
|
- "cdata" - generate code for xml ![CDATA[…]]
|
||||||
|
- "nosuperscript" - no A^B
|
||||||
|
- "notables" - disallow tables
|
||||||
|
- "nostrikethrough" - forbid strikethrough
|
||||||
|
- "toc" - do table-of-contents processing (index)
|
||||||
|
- "compat" - compatibility with MarkdownTest_1.0
|
||||||
|
- "autolink" - make http://foo.com link even without <>s
|
||||||
|
- "safelink" - paranoid check for link protocol
|
||||||
|
- "noheader" - don’t process header blocks
|
||||||
|
- "tabstop" - expand tabs to 4 spaces
|
||||||
|
- "nodivquote" - forbid >%class% blocks
|
||||||
|
- "noalphalist" - forbid alphabetic lists
|
||||||
|
- "extrafootnote" - enable markdown extra-style footnotes
|
||||||
|
- "nostyle" - don’t extract <style> blocks
|
||||||
|
- "dlextra" - enable extra-style definition lists
|
||||||
|
- "fencedcode" - enabled fenced code blocks
|
||||||
|
- "idanchor" - use id= anchors for TOC links
|
||||||
|
- "githubtags" - allow dash and underscore in element names
|
||||||
|
- "urlencodedanchor" - urlencode non-identifier chars instead of replacing with dots
|
||||||
|
- "latex" - handle embedded LaTeX escapes
|
||||||
|
- "html5" - handle html5 elements (maybe obsolete?)
|
||||||
|
- "normallist" - disable github-style checkbox lists
|
||||||
|
- "explicitlist" - don’t combine numbered/bulletted lists
|
||||||
|
- "dldiscount" - enable discount-style definition lists
|
||||||
|
- "altastitle" - use alt text as the title if no title is listed
|
||||||
|
- "extendedattr" - allow extended attribute suffixes
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
markdown.compile(markdown_text,"extrafootnote","toc","notables")
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user