mirror of https://github.com/mpastell/Weave.jl
commit
ed41be610a
|
@ -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<!-- $(comment.text) -->\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
|
||||
|
|
|
@ -39,6 +39,10 @@ x = 3
|
|||
|
||||
> Some important quote
|
||||
|
||||
head 1 | head 2
|
||||
-------|--------
|
||||
`code` | no code
|
||||
|
||||
""", flavor = WeaveMarkdown.weavemd))
|
||||
|
||||
ref_html = """<h1>H1</h1>
|
||||
|
@ -70,6 +74,7 @@ more math
|
|||
<blockquote>
|
||||
<p>Some important quote</p>
|
||||
</blockquote>
|
||||
<table><tr><th>head 1</th><th>head 2</th></tr><tr><td><code>code</code></td><td>no code</td></tr></table>
|
||||
"""
|
||||
|
||||
@test html == ref_html
|
||||
|
|
Loading…
Reference in New Issue