2017-12-25 12:22:35 +01:00
|
|
|
# maddy
|
|
|
|
|
|
|
|
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
|
2020-10-04 19:03:44 +02:00
|
|
|
[![Version: 1.1.2](https://img.shields.io/badge/Version-1.1.2-brightgreen.svg)](https://semver.org/)
|
2019-02-19 03:06:12 +01:00
|
|
|
[![Travis Build Status](https://travis-ci.org/progsource/maddy.svg?branch=master)](https://travis-ci.org/progsource/maddy)
|
|
|
|
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/04m0lg27kigv1pg8/branch/master?svg=true)](https://ci.appveyor.com/project/progsource/maddy/branch/master)
|
2017-12-25 12:22:35 +01:00
|
|
|
|
|
|
|
maddy is a C++ Markdown to HTML **header-only** parser library.
|
|
|
|
|
2017-12-25 14:50:26 +01:00
|
|
|
## Supported OS
|
2017-12-25 12:22:35 +01:00
|
|
|
|
|
|
|
It actually should work on any OS, that supports the C++14 standard library.
|
|
|
|
|
|
|
|
It is tested to work on:
|
|
|
|
|
2019-02-19 03:20:04 +01:00
|
|
|
* Linux (gcc)
|
2019-02-19 03:50:46 +01:00
|
|
|
* OSX (clang)
|
|
|
|
* Windows (Visual Studio 2017)
|
2017-12-25 12:22:35 +01:00
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
* C++14
|
|
|
|
|
|
|
|
## Why maddy?
|
|
|
|
|
|
|
|
When I was needing a Markdown parser in C++ I couldn't find any, that was
|
|
|
|
fitting my needs. So I simply wrote my own one.
|
|
|
|
|
|
|
|
## Markdown syntax
|
|
|
|
|
|
|
|
The supported syntax can be found in the [definitions docs](docs/definitions.md).
|
|
|
|
|
2017-12-30 03:37:18 +01:00
|
|
|
## How to use
|
2017-12-25 12:22:35 +01:00
|
|
|
|
|
|
|
To use maddy in your project, simply add the include path of maddy to yours
|
|
|
|
and in the code, you can then do the following:
|
|
|
|
|
|
|
|
```c++
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "maddy/parser.h"
|
|
|
|
|
|
|
|
std::stringstream markdownInput("");
|
2019-12-27 19:48:29 +01:00
|
|
|
|
|
|
|
// config is optional
|
|
|
|
std::shared_ptr<maddy::ParserConfig> config = std::make_shared<maddy::ParserConfig>();
|
|
|
|
config->isEmphasizedParserEnabled = true; // default
|
|
|
|
config->isHTMLWrappedInParagraph = true; // default
|
|
|
|
|
|
|
|
std::shared_ptr<maddy::Parser> parser = std::make_shared<maddy::Parser>(config);
|
2017-12-25 12:22:35 +01:00
|
|
|
std::string htmlOutput = parser->Parse(markdownInput);
|
|
|
|
```
|
|
|
|
|
2017-12-30 03:37:18 +01:00
|
|
|
## How to run the tests
|
|
|
|
|
|
|
|
*(tested on Linux with
|
|
|
|
[git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and
|
|
|
|
[cmake](https://cmake.org/install/) installed)*
|
|
|
|
|
|
|
|
Open your preferred terminal and type:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
git clone https://github.com/progsource/maddy.git
|
|
|
|
cd maddy
|
|
|
|
git submodule update --init --recursive
|
|
|
|
mkdir tmp
|
|
|
|
cd tmp
|
|
|
|
cmake ..
|
2017-12-30 14:09:42 +01:00
|
|
|
make
|
2017-12-30 03:37:18 +01:00
|
|
|
make test # or run the executable in ../build/MaddyTests
|
|
|
|
```
|
|
|
|
|
2017-12-25 12:22:35 +01:00
|
|
|
## How to contribute
|
|
|
|
|
|
|
|
There are different possibilities:
|
|
|
|
|
2018-10-25 17:26:25 +02:00
|
|
|
* [Create a GitHub issue](https://github.com/progsource/maddy/issues/new)
|
2017-12-25 12:22:35 +01:00
|
|
|
* Create a pull request with an own branch (don't forget to put yourself in the
|
|
|
|
AUTHORS file)
|
2020-10-10 08:03:21 +02:00
|
|
|
|
|
|
|
Please also read [CONTIBUTING.md](CONTIBUTING.md).
|