https://github.com/rla/prolog-markdown
Markdown parser for SWI-Prolog.
https://github.com/rla/prolog-markdown
markdown markdown-parser swi-prolog
Last synced: 5 months ago
JSON representation
Markdown parser for SWI-Prolog.
- Host: GitHub
- URL: https://github.com/rla/prolog-markdown
- Owner: rla
- License: mit
- Created: 2013-08-06T17:00:41.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2020-10-22T17:43:37.000Z (over 5 years ago)
- Last Synced: 2024-04-11T20:56:28.015Z (almost 2 years ago)
- Topics: markdown, markdown-parser, swi-prolog
- Language: Prolog
- Size: 71.3 KB
- Stars: 20
- Watchers: 3
- Forks: 5
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-prolog - markdown - Markdown parser. (Parsing)
README
# Prolog-markdown
Markdown parser implemented in Prolog. Compatible with [SWI-Prolog](http://www.swi-prolog.org/) as the
output tree is for direct use by [html//1](https://www.swi-prolog.org/pldoc/man?predicate=html//1).
The specification for the parser was taken from
(Gruber's Markdown).
[](https://travis-ci.org/rla/prolog-markdown)
## Example usage
Parse into a structure usable by
[html//1](https://www.swi-prolog.org/pldoc/man?predicate=html//1).
:- use_module(library(md/md_parse)).
?- md_parse_string("# Hello #", Blocks).
Blocks = [h1("Hello")].
Convert into an HTML string:
:- use_module(library(md/md_parse)).
?- md_html_string("# Hello #", Html).
Html = "
Hello
".
## Deviations from the Gruber's Markdown
* Some cases for tight markup (no separate lines between blocks).
* No clever encoding for mail addresses.
* Line break rule creates `
` not `
`.
* No in-word emphasis with underscores.
* Strikethrough as `~~text~~`.
* Added escape sequences `\~` and `` \` ``.
* Github-styled fenced code blocks ().
No syntax highlighting is provided but the `data-language` attribute is set.
* Plain link recognizion.
## Performance
Example [document](http://daringfireball.net/projects/markdown/syntax.text) (about 800 lines) is parsed
in 80ms on 2.4GHz Q6600.
## Installation
Requires SWI-Prolog 7.x.
pack_install('http://packs.rlaanemets.com/markdown/markdown-*.tgz')
## API documentation
See for the top-level module documentation.
## Changelog
* 2020-01-02 version 0.0.3. Fixed mode declaration in documentation.
* 2014-02-26 version 0.0.2. Fixed HTTPS link in angled brackets. Trimmed bottom of code block.
* 2014-01-14 version 0.0.1
## Bug reports/feature requests
Please send bug reports/feature request through the GitHub
project [page](https://github.com/rla/prolog-markdown).
## License
The MIT License. See the LICENSE file.