diff --git a/src/WeaveMarkdown/html.jl b/src/WeaveMarkdown/html.jl index 470ff7f..16a3011 100644 --- a/src/WeaveMarkdown/html.jl +++ b/src/WeaveMarkdown/html.jl @@ -1,6 +1,6 @@ #module Markdown2HTML # Markdown to HTML writer, Modified from Julia Base.Markdown html writer -using Markdown: MD, Header, Code, Paragraph, BlockQuote, Footnote, +using Markdown: MD, Header, Code, Paragraph, BlockQuote, Footnote, Table, Admonition, List, HorizontalRule, Bold, Italic, Image, Link, LineBreak, LaTeX, isordered @@ -167,6 +167,20 @@ function html(io::IO, comment::Comment) write(io, "\n\n") end +function html(io::IO, md::Table) + withtag(io, :table) do + for (i, row) in enumerate(md.rows) + withtag(io, :tr) do + for c in md.rows[i] + withtag(io, i == 1 ? :th : :td) do + htmlinline(io, c) + end + end + end + end + end +end + html(io::IO, x) = tohtml(io, x) # Inline elements diff --git a/test/markdown_test.jl b/test/markdown_test.jl index 5a05112..ce54618 100644 --- a/test/markdown_test.jl +++ b/test/markdown_test.jl @@ -39,6 +39,10 @@ x = 3 > Some important quote +head 1 | head 2 +-------|-------- +`code` | no code + """, flavor = WeaveMarkdown.weavemd)) ref_html = """

H1

@@ -70,6 +74,7 @@ more math

Some important quote

+
head 1head 2
codeno code
""" @test html == ref_html