镜像自地址
https://github.com/quitesimpleorg/qsmaddy.git
已同步 2025-07-01 15:13:49 +02:00
比较提交
15 次代码提交
作者 | SHA1 | 提交日期 | |
---|---|---|---|
04342d813c | |||
cbd8731795 | |||
e20ac6c514 | |||
9a9774f904 | |||
ba9077a9fa | |||
b467e556e3 | |||
7963d90603 | |||
663acbb0ea | |||
d300d3a92a | |||
fa3fdcb87b | |||
e8f9551b66 | |||
18fdc4c78b | |||
5618c3ff23 | |||
eb1aafc35f | |||
91e62beaec |
18
.travis.yml
普通文件
18
.travis.yml
普通文件
@ -0,0 +1,18 @@
|
|||||||
|
dist: trusty
|
||||||
|
sudo: false
|
||||||
|
language: cpp
|
||||||
|
compiler: g++
|
||||||
|
install: export CXX="g++-6"
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
packages:
|
||||||
|
- g++-6
|
||||||
|
|
||||||
|
script:
|
||||||
|
- mkdir tmp
|
||||||
|
- cd tmp
|
||||||
|
- cmake ..
|
||||||
|
- make
|
||||||
|
- ../build/MaddyTests
|
@ -1,4 +1,4 @@
|
|||||||
# This project is licensed under the MITlicense. For more information see the
|
# This project is licensed under the MIT license. For more information see the
|
||||||
# LICENSE file.
|
# LICENSE file.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
@ -27,7 +27,7 @@ file(GLOB_RECURSE MADDY_TESTS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tests/maddy/*.cp
|
|||||||
|
|
||||||
set(
|
set(
|
||||||
CMAKE_CXX_FLAGS
|
CMAKE_CXX_FLAGS
|
||||||
"${CMAKE_CXX_FLAGS} -g -std=c++${MADDY_CPP_VERSION} -Wall -Wpedantic -Wextra -Wno-ignored-qualifiers -fno-rtti -fno-exceptions"
|
"${CMAKE_CXX_FLAGS} -g -std=c++${MADDY_CPP_VERSION} -Wall -Wpedantic -Wextra -Wno-ignored-qualifiers -fno-rtti -fno-exceptions -fsanitize=address -fno-omit-frame-pointer"
|
||||||
)
|
)
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
24
README.md
24
README.md
@ -1,7 +1,8 @@
|
|||||||
# maddy
|
# maddy
|
||||||
|
|
||||||
[](https://opensource.org/licenses/MIT)
|
[](https://opensource.org/licenses/MIT)
|
||||||
[](https://semver.org/)
|
[](https://semver.org/)
|
||||||
|
[](https://travis-ci.org/progsource/maddy)
|
||||||
|
|
||||||
maddy is a C++ Markdown to HTML **header-only** parser library.
|
maddy is a C++ Markdown to HTML **header-only** parser library.
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ fitting my needs. So I simply wrote my own one.
|
|||||||
|
|
||||||
The supported syntax can be found in the [definitions docs](docs/definitions.md).
|
The supported syntax can be found in the [definitions docs](docs/definitions.md).
|
||||||
|
|
||||||
## HowTo use
|
## How to use
|
||||||
|
|
||||||
To use maddy in your project, simply add the include path of maddy to yours
|
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:
|
and in the code, you can then do the following:
|
||||||
@ -42,6 +43,25 @@ std::shared_ptr<maddy::Parser> parser = std::make_shared<maddy::Parser>();
|
|||||||
std::string htmlOutput = parser->Parse(markdownInput);
|
std::string htmlOutput = parser->Parse(markdownInput);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 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 ..
|
||||||
|
make
|
||||||
|
make test # or run the executable in ../build/MaddyTests
|
||||||
|
```
|
||||||
|
|
||||||
## How to contribute
|
## How to contribute
|
||||||
|
|
||||||
There are different possibilities:
|
There are different possibilities:
|
||||||
|
@ -58,7 +58,7 @@ results in
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* unorederd
|
* unordered
|
||||||
* list
|
* list
|
||||||
* items
|
* items
|
||||||
* in
|
* in
|
||||||
@ -69,14 +69,18 @@ results in
|
|||||||
results in
|
results in
|
||||||
```html
|
```html
|
||||||
<ul>
|
<ul>
|
||||||
<li>list</li>
|
<li>unordered
|
||||||
<li>items
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>in</li>
|
<li>list</li>
|
||||||
<li>an</li>
|
<li>items
|
||||||
|
<ul>
|
||||||
|
<li>in</li>
|
||||||
|
<li>an</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>hierarchy</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>hierarchy</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -89,13 +93,17 @@ results in
|
|||||||
* items
|
* items
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
results in
|
results in
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>ordered</li>
|
<li>ordered</li>
|
||||||
<li>list</li>
|
<li>list</li>
|
||||||
<li>items</li>
|
<li>items</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -108,7 +116,9 @@ results in
|
|||||||
* hierarchy
|
* hierarchy
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
results in
|
results in
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<ol>
|
<ol>
|
||||||
<li>ordered</li>
|
<li>ordered</li>
|
||||||
@ -116,7 +126,9 @@ results in
|
|||||||
<ol>
|
<ol>
|
||||||
<li>items</li>
|
<li>items</li>
|
||||||
<li>in
|
<li>in
|
||||||
<ol>an</ol>
|
<ol>
|
||||||
|
<li>an</li>
|
||||||
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
<li>hierarchy</li>
|
<li>hierarchy</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
@ -93,6 +93,18 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure, that all parsers are finished
|
||||||
|
if (currentBlockParser)
|
||||||
|
{
|
||||||
|
std::string emptyLine = "";
|
||||||
|
currentBlockParser->AddLine(emptyLine);
|
||||||
|
if (currentBlockParser->IsFinished())
|
||||||
|
{
|
||||||
|
result += currentBlockParser->GetResult().str();
|
||||||
|
currentBlockParser = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
int main (int argc, char** argv) {
|
int main (int argc, char** argv) {
|
||||||
::testing::GTEST_FLAG(throw_on_failure) = false;
|
::testing::GTEST_FLAG(throw_on_failure) = true;
|
||||||
::testing::InitGoogleMock(&argc, argv);
|
::testing::InitGoogleMock(&argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
在新工单中引用
屏蔽一个用户