Skip to content

Commit

Permalink
Merge pull request #304 from epage/fix/table
Browse files Browse the repository at this point in the history
fix(md): Add table/ref support
  • Loading branch information
epage authored Oct 21, 2017
2 parents 692ff3b + 1aa53d2 commit 9f91700
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ impl Document {
frontmatter::SourceFormat::Raw => html,
frontmatter::SourceFormat::Markdown => {
let mut buf = String::new();
let parser = cmark::Parser::new(&html);
let options = cmark::OPTION_ENABLE_FOOTNOTES | cmark::OPTION_ENABLE_TABLES;
let parser = cmark::Parser::new_ext(&html, options);
cmark::html::push_html(&mut buf, decorate_markdown(parser, syntax_theme));
buf
}
Expand Down
12 changes: 12 additions & 0 deletions tests/fixtures/markdown_table/_layouts/default.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<h1>{{ path }}</h1>

{{ content }}
</body>
</html>

10 changes: 10 additions & 0 deletions tests/fixtures/markdown_table/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends: default.liquid
---

test | test
--|--
12| 123

Header 1 | Header 2
---------|---------
data 1 | data 2
5 changes: 5 additions & 0 deletions tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ pub fn querystrings() {
run_test("querystrings").expect("Build error");
}

#[test]
pub fn markdown_table() {
run_test("markdown_table").expect("Build error");
}

#[cfg(feature = "sass")]
#[test]
pub fn sass() {
Expand Down
18 changes: 18 additions & 0 deletions tests/target/markdown_table/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>test</title>
</head>
<body>
<h1>index.html</h1>

<table><thead><tr><th>test </th><th> test</th></tr></thead><tbody>
<tr><td>12</td><td> 123</td></tr>
</tbody></table>
<table><thead><tr><th>Header 1 </th><th> Header 2</th></tr></thead><tbody>
<tr><td>data 1 </td><td> data 2</td></tr>
</tbody></table>

</body>
</html>

0 comments on commit 9f91700

Please sign in to comment.