add readme

This commit is contained in:
Татьяна Фарбер 2025-12-14 23:45:26 +04:00
parent ea73839bc4
commit 3e6ac2a635

View File

@ -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" - dont do link processing, block tags
- "noimages" - dont do image processing, block
- "nopants" - dont run smartypants()
- "nohtml" - dont allow raw html through AT ALL
- "strict" - conform to Markdown standard as implemented in Markdown.pl
- "tagtext" - process text inside an html tag
- "noext" - dont 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" - dont process header blocks
- "tabstop" - expand tabs to 4 spaces
- "nodivquote" - forbid >%class% blocks
- "noalphalist" - forbid alphabetic lists
- "extrafootnote" - enable markdown extra-style footnotes
- "nostyle" - dont 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" - dont 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
------- -------