aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANUAL.txt41
-rw-r--r--changelog16
-rw-r--r--src/Text/Pandoc/ImageSize.hs7
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs2
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs14
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs4
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs18
-rw-r--r--test/command/3596.md6
-rw-r--r--test/command/4012.md8
-rw-r--r--test/command/4016.md47
-rw-r--r--test/command/latex-command-comment.md7
11 files changed, 138 insertions, 32 deletions
diff --git a/MANUAL.txt b/MANUAL.txt
index fc33b3433..50977ca3b 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -206,7 +206,7 @@ the LaTeX engine requires [`fontspec`]. `xelatex` uses
`dir` variable set). If the `mathspec` variable is set,
`xelatex` will use [`mathspec`] instead of [`unicode-math`].
The [`upquote`] and [`microtype`] packages are used if
-available, and [`csquotes`] will be used for [smart punctuation]
+available, and [`csquotes`] will be used for [typography]
if added to the template or included in any header file. The
[`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can
optionally be used for [citation rendering]. These are included
@@ -2888,16 +2888,20 @@ Attributes can be attached to verbatim text, just as with
### Small caps ###
-To write small caps, you can use an HTML span tag:
+To write small caps, use the `smallcaps` class:
- <span style="font-variant:small-caps;">Small caps</span>
+ [Small caps]{.smallcaps}
+
+Or, without the `bracketed_spans` extension:
-(The semicolon is optional and there may be space after the
-colon.) This will work in all output formats that support small caps.
+ <span class="smallcaps">Small caps</span>
+
+For compatibility with other Markdown flavors, CSS is also supported:
+
+ <span style="font-variant:small-caps;">Small caps</span>
-Alternatively, you can also use the new `bracketed_spans` syntax:
+This will work in all output formats that support small caps.
- [Small caps]{style="font-variant:small-caps;"}
Math
----
@@ -3082,7 +3086,7 @@ starts with a fence containing at least three consecutive
colons plus some attributes. The attributes may optionally
be followed by another string of consecutive colons.
The attribute syntax is exactly as in fenced code blocks (see
-[Extension-fenced_code_attributes], above). As with fenced
+[Extension: `fenced_code_attributes`]). As with fenced
code blocks, one can use either attributes in curly braces
or a single unbraced word, which will be treated as a class
name. The Div ends with another line containing a string of at
@@ -4042,18 +4046,35 @@ Speaker notes
reveal.js has good support for speaker notes. You can add notes to your
Markdown document thus:
- <div class="notes">
+ ::: notes
+
This is my note.
- It can contain Markdown
- like this list
- </div>
+ :::
To show the notes window, press `s` while viewing the presentation.
Notes are not yet supported for other slide formats, but the notes
will not appear on the slides themselves.
+Columns
+-------
+
+To put material in side by side columns, you can use a native
+div container with class `columns`, containing two or more div
+containers with class `column` and a `width` attribute:
+
+ :::::::::::::: {.columns}
+ ::: {.column width="40%"}
+ contents...
+ :::
+ ::: {.column width="60%"}
+ contents...
+ :::
+ ::::::::::::::
+
Frame attributes in beamer
--------------------------
diff --git a/changelog b/changelog
index 9716e062f..f95f809d1 100644
--- a/changelog
+++ b/changelog
@@ -75,14 +75,14 @@ pandoc (2.0)
* Implement multicolumn support for slide formats (#1710).
The structure expected is:
- <div class="columns">
- <div class="column" width="40%">
- contents...
- </div>
- <div class="column" width="60%">
- contents...
- </div>
- </div>
+ :::::::::::::: {.columns}
+ ::: {.column width="40%"}
+ contents...
+ :::
+ ::: {.column width="60%"}
+ contents...
+ :::
+ ::::::::::::::
Support has been added for beamer and all HTML slide formats.
diff --git a/src/Text/Pandoc/ImageSize.hs b/src/Text/Pandoc/ImageSize.hs
index 27d5c6a9c..5f491e08b 100644
--- a/src/Text/Pandoc/ImageSize.hs
+++ b/src/Text/Pandoc/ImageSize.hs
@@ -79,6 +79,7 @@ instance Show Direction where
data Dimension = Pixel Integer
| Centimeter Double
+ | Millimeter Double
| Inch Double
| Percent Double
| Em Double
@@ -86,6 +87,7 @@ data Dimension = Pixel Integer
instance Show Dimension where
show (Pixel a) = show a ++ "px"
show (Centimeter a) = showFl a ++ "cm"
+ show (Millimeter a) = showFl a ++ "mm"
show (Inch a) = showFl a ++ "in"
show (Percent a) = show a ++ "%"
show (Em a) = showFl a ++ "em"
@@ -184,6 +186,7 @@ inInch opts dim =
case dim of
(Pixel a) -> fromIntegral a / fromIntegral (writerDpi opts)
(Centimeter a) -> a * 0.3937007874
+ (Millimeter a) -> a * 0.03937007874
(Inch a) -> a
(Percent _) -> 0
(Em a) -> a * (11/64)
@@ -193,6 +196,7 @@ inPixel opts dim =
case dim of
(Pixel a) -> a
(Centimeter a) -> floor $ dpi * a * 0.3937007874 :: Integer
+ (Millimeter a) -> floor $ dpi * a * 0.03937007874 :: Integer
(Inch a) -> floor $ dpi * a :: Integer
(Percent _) -> 0
(Em a) -> floor $ dpi * a * (11/64) :: Integer
@@ -225,6 +229,7 @@ scaleDimension factor dim =
case dim of
Pixel x -> Pixel (round $ factor * fromIntegral x)
Centimeter x -> Centimeter (factor * x)
+ Millimeter x -> Millimeter (factor * x)
Inch x -> Inch (factor * x)
Percent x -> Percent (factor * x)
Em x -> Em (factor * x)
@@ -243,7 +248,7 @@ lengthToDim :: String -> Maybe Dimension
lengthToDim s = numUnit s >>= uncurry toDim
where
toDim a "cm" = Just $ Centimeter a
- toDim a "mm" = Just $ Centimeter (a / 10)
+ toDim a "mm" = Just $ Millimeter a
toDim a "in" = Just $ Inch a
toDim a "inch" = Just $ Inch a
toDim a "%" = Just $ Percent a
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index a982029af..9bac3d3a7 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -1132,7 +1132,7 @@ inlineCommand' = try $ do
lookupListDefault raw names inlineCommands
tok :: PandocMonad m => LP m Inlines
-tok = grouped inline <|> inlineCommand' <|> singleChar'
+tok = try $ spaces >> grouped inline <|> inlineCommand' <|> singleChar'
where singleChar' = do
Tok _ _ t <- singleChar
return (str (T.unpack t))
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 2a88b39ec..98552e65d 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -846,6 +846,7 @@ listLine continuationIndent = try $ do
skipMany spaceChar
listStart)
notFollowedByHtmlCloser
+ notFollowedByDivCloser
optional (() <$ gobbleSpaces continuationIndent)
listLineCommon
@@ -883,16 +884,24 @@ listContinuation continuationIndent = try $ do
x <- try $ do
notFollowedBy blankline
notFollowedByHtmlCloser
+ notFollowedByDivCloser
gobbleSpaces continuationIndent
anyLineNewline
xs <- many $ try $ do
notFollowedBy blankline
notFollowedByHtmlCloser
+ notFollowedByDivCloser
gobbleSpaces continuationIndent <|> notFollowedBy' listStart
anyLineNewline
blanks <- many blankline
return $ concat (x:xs) ++ blanks
+notFollowedByDivCloser :: PandocMonad m => MarkdownParser m ()
+notFollowedByDivCloser = do
+ guardDisabled Ext_fenced_divs <|>
+ do divLevel <- stateFencedDivLevel <$> getState
+ guard (divLevel < 1) <|> notFollowedBy divFenceEnd
+
notFollowedByHtmlCloser :: PandocMonad m => MarkdownParser m ()
notFollowedByHtmlCloser = do
inHtmlBlock <- stateInHtmlBlock <$> getState
@@ -965,6 +974,7 @@ defRawBlock compact = try $ do
let dline = try
( do notFollowedBy blankline
notFollowedByHtmlCloser
+ notFollowedByDivCloser
if compact -- laziness not compatible with compact
then () <$ indentSpaces
else (() <$ indentSpaces)
@@ -1688,10 +1698,8 @@ endline = try $ do
guardEnabled Ext_blank_before_header <|> (notFollowedBy . char =<< atxChar) -- atx header
guardDisabled Ext_backtick_code_blocks <|>
notFollowedBy (() <$ (lookAhead (char '`') >> codeBlockFenced))
- guardDisabled Ext_fenced_divs <|>
- do divLevel <- stateFencedDivLevel <$> getState
- guard (divLevel < 1) <|> notFollowedBy divFenceEnd
notFollowedByHtmlCloser
+ notFollowedByDivCloser
(eof >> return mempty)
<|> (guardEnabled Ext_hard_line_breaks >> return (return B.linebreak))
<|> (guardEnabled Ext_ignore_line_breaks >> return mempty)
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index ab1e90b3b..976450dcd 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -371,6 +371,10 @@ toSlides bs = do
concat `fmap` mapM (elementToBeamer slideLevel) (hierarchicalize bs')
elementToBeamer :: PandocMonad m => Int -> Element -> LW m [Block]
+elementToBeamer _slideLevel (Blk (Div attr bs)) = do
+ -- make sure we support "blocks" inside divs
+ bs' <- concat `fmap` mapM (elementToBeamer 0) (hierarchicalize bs)
+ return [Div attr bs']
elementToBeamer _slideLevel (Blk b) = return [b]
elementToBeamer slideLevel (Sec lvl _num (ident,classes,kvs) tit elts)
| lvl > slideLevel = do
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 5d812b169..a1f30cb0e 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -397,11 +397,19 @@ blockToMarkdown' :: PandocMonad m
blockToMarkdown' _ Null = return empty
blockToMarkdown' opts (Div attrs ils) = do
contents <- blockListToMarkdown opts ils
- return $ if isEnabled Ext_raw_html opts &&
- isEnabled Ext_markdown_in_html_blocks opts
- then tagWithAttrs "div" attrs <> blankline <>
- contents <> blankline <> "</div>" <> blankline
- else contents <> blankline
+ return $
+ case () of
+ _ | isEnabled Ext_fenced_divs opts &&
+ attrs /= nullAttr ->
+ nowrap (text ":::" <+> attrsToMarkdown attrs) $$
+ chomp contents $$
+ text ":::" <> blankline
+ | isEnabled Ext_native_divs opts ||
+ (isEnabled Ext_raw_html opts &&
+ isEnabled Ext_markdown_in_html_blocks opts) ->
+ tagWithAttrs "div" attrs <> blankline <>
+ contents <> blankline <> "</div>" <> blankline
+ | otherwise -> contents <> blankline
blockToMarkdown' opts (Plain inlines) = do
contents <- inlineListToMarkdown opts inlines
-- escape if para starts with ordered list marker
diff --git a/test/command/3596.md b/test/command/3596.md
index a064ca632..01a871e1b 100644
--- a/test/command/3596.md
+++ b/test/command/3596.md
@@ -50,11 +50,9 @@
^D
- foo
-- <div id="id">
-
+- ::: {#id}
bar
-
- </div>
+ :::
- baz
diff --git a/test/command/4012.md b/test/command/4012.md
new file mode 100644
index 000000000..579ee2459
--- /dev/null
+++ b/test/command/4012.md
@@ -0,0 +1,8 @@
+```
+pandoc -f markdown-implicit_figures
+![image]
+
+[image]: http://example.com/image.jpg {height=35mm}
+^D
+<p><img src="http://example.com/image.jpg" alt="image" style="height:35mm" /></p>
+```
diff --git a/test/command/4016.md b/test/command/4016.md
new file mode 100644
index 000000000..69ad1c911
--- /dev/null
+++ b/test/command/4016.md
@@ -0,0 +1,47 @@
+```
+pandoc -t beamer
+# Level 2 blocks
+
+<div class="columns">
+<div class="column" width="40%">
+## Block one
+- Item
+</div>
+<div class="column" width="60%">
+## Block two
+- Item
+</div>
+</div>
+^D
+\begin{frame}{%
+\protect\hypertarget{level-2-blocks}{%
+Level 2 blocks}}
+
+\begin{columns}[T]
+\begin{column}{0.40\textwidth}
+\begin{block}{Block one}
+
+\begin{itemize}
+\tightlist
+\item
+ Item
+\end{itemize}
+
+\end{block}
+\end{column}
+
+\begin{column}{0.60\textwidth}
+\begin{block}{Block two}
+
+\begin{itemize}
+\tightlist
+\item
+ Item
+\end{itemize}
+
+\end{block}
+\end{column}
+\end{columns}
+
+\end{frame}
+```
diff --git a/test/command/latex-command-comment.md b/test/command/latex-command-comment.md
new file mode 100644
index 000000000..640277f15
--- /dev/null
+++ b/test/command/latex-command-comment.md
@@ -0,0 +1,7 @@
+```
+pandoc -f latex -t native
+\emph%
+{hi}
+^D
+[Para [Emph [Str "hi"]]]
+```