diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 50fba2dbaf84..ade350565d6d 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -467,6 +467,7 @@ blockToMarkdown' opts b@(RawBlock f str) = do let renderEmpty = mempty <$ report (BlockNotRendered b) case () of _ | plain -> renderEmpty + | isEnabled Ext_raw_attribute opts -> rawAttribBlock | f `elem` ["markdown", "markdown_github", "markdown_phpextra", "markdown_mmd", "markdown_strict"] -> return $ text str <> text "\n" @@ -484,7 +485,6 @@ blockToMarkdown' opts b@(RawBlock f str) = do text str <> text "\n" | isEnabled Ext_raw_attribute opts -> rawAttribBlock | otherwise -> renderEmpty - | isEnabled Ext_raw_attribute opts -> rawAttribBlock | otherwise -> renderEmpty blockToMarkdown' opts HorizontalRule = do return $ blankline <> text (replicate (writerColumns opts) '-') <> blankline @@ -1152,6 +1152,7 @@ inlineToMarkdown opts il@(RawInline f str) = do | f `elem` ["markdown", "markdown_github", "markdown_phpextra", "markdown_mmd", "markdown_strict"] -> return $ text str + | isEnabled Ext_raw_attribute opts -> rawAttribInline | f `elem` ["html", "html5", "html4"] -> case () of _ | isEnabled Ext_raw_html opts -> return $ text str @@ -1162,7 +1163,6 @@ inlineToMarkdown opts il@(RawInline f str) = do _ | isEnabled Ext_raw_tex opts -> return $ text str | isEnabled Ext_raw_attribute opts -> rawAttribInline | otherwise -> renderEmpty - | isEnabled Ext_raw_attribute opts -> rawAttribInline | otherwise -> renderEmpty inlineToMarkdown opts (LineBreak) = do plain <- asks envPlain diff --git a/test/Tests/Writers/Markdown.hs b/test/Tests/Writers/Markdown.hs index 533be268a368..aae4d082cc51 100644 --- a/test/Tests/Writers/Markdown.hs +++ b/test/Tests/Writers/Markdown.hs @@ -40,7 +40,7 @@ infix 4 =: tests :: [TestTree] tests = [ "indented code after list" =: (orderedList [ para "one" <> para "two" ] <> codeBlock "test") - =?> "1. one\n\n two\n\n\n\n test" + =?> "1. one\n\n two\n\n```{=html}\n\n```\n test" , "list with tight sublist" =: bulletList [ plain "foo" <> bulletList [ plain "bar" ], plain "baz" ] diff --git a/test/command/4164.md b/test/command/4164.md index 8cfc960a005f..50c3117ecbbe 100644 --- a/test/command/4164.md +++ b/test/command/4164.md @@ -12,7 +12,7 @@ Here is inline html:
- bla bla +``{=html} bla bla
diff --git a/test/command/macros.md b/test/command/macros.md index 0c91944a1ec8..e3c07e661209 100644 --- a/test/command/macros.md +++ b/test/command/macros.md @@ -1,5 +1,5 @@ ``` -% pandoc -f markdown+latex_macros -t markdown +% pandoc -f markdown+latex_macros -t markdown+raw_tex-raw_attribute \newcommand{\my}{\phi} $\my+\my$ ^D @@ -9,7 +9,7 @@ $\phi+\phi$ ``` ``` -% pandoc -f markdown-latex_macros -t markdown +% pandoc -f markdown-latex_macros -t markdown+raw_tex-raw_attribute \newcommand{\my}{\phi} $\my+\my$ ^D @@ -70,7 +70,7 @@ x &= y\\\end{aligned}\] ``` ``` -% pandoc -f markdown+latex_macros -t markdown +% pandoc -f markdown+latex_macros -t markdown+raw_tex-raw_attribute \newcommand{\my}{\phi} \begin{equation} \my+\my @@ -84,7 +84,7 @@ x &= y\\\end{aligned}\] ``` ``` -% pandoc -f markdown-latex_macros -t markdown +% pandoc -f markdown-latex_macros -t markdown+raw_tex-raw_attribute \newcommand{\my}{\phi} \begin{equation} \my+\my @@ -98,7 +98,7 @@ x &= y\\\end{aligned}\] ``` ``` -% pandoc -f markdown+latex_macros -t markdown +% pandoc -f markdown+latex_macros -t markdown+raw_tex-raw_attribute \newcommand{\my}{\emph{a}} \my ^D diff --git a/test/command/parse-raw.md b/test/command/parse-raw.md index f4e493c69a32..a1a41b551524 100644 --- a/test/command/parse-raw.md +++ b/test/command/parse-raw.md @@ -2,7 +2,7 @@ % pandoc -f latex+raw_tex -t markdown \emph{Hi \foo{there}} ^D -*Hi \foo{there}* +*Hi `\foo{there}`{=latex}* ``` ``` @@ -16,7 +16,7 @@ % pandoc -f html+raw_html -t markdown Hi there ^D -*Hi there* +*Hi ``{=html}there``{=html}* ``` ``` diff --git a/test/writer.markdown b/test/writer.markdown index 6aab1e59769e..7393ee18e903 100644 --- a/test/writer.markdown +++ b/test/writer.markdown @@ -399,18 +399,35 @@ bar Interpreted markdown in a table: +```{=html} +``` +```{=html} +``` +```{=html} +``` +```{=html} +``` +```{=html} +``` +```{=html}
+``` This is *emphasized* +```{=html} +``` And this is **strong** +```{=html}
+``` +```{=html} - +``` Here's a simple block:
@@ -447,41 +464,64 @@ foo This should just be an HTML comment: +```{=html} - +``` Multiline: +```{=html} +``` +```{=html} - +``` Code block: Just plain comment, with trailing spaces on the line: +```{=html} - +``` Code:
Hr's: +```{=html}
+``` +```{=html}
+``` +```{=html}
+``` +```{=html}
+``` +```{=html}
+``` +```{=html}
+``` +```{=html}
+``` +```{=html}
+``` +```{=html}
+``` ------------------------------------------------------------------------------ @@ -540,7 +580,7 @@ Ellipses...and...and.... LaTeX ===== -- \cite[22-23]{smith.1899} +- `\cite[22-23]{smith.1899}`{=tex} - $2+2=4$ - $x \in y$ - $\alpha \wedge \omega$ @@ -560,11 +600,13 @@ These shouldn't be math: Here's a LaTeX table: +```{=tex} \begin{tabular}{|l|l|}\hline Animal & Number \\ \hline Dog & 2 \\ Cat & 1 \\ \hline \end{tabular} +``` ------------------------------------------------------------------------------