diff --git a/data/templates/default.html4 b/data/templates/default.html4
index 6534a590bbf8..00f0bacbc192 100644
--- a/data/templates/default.html4
+++ b/data/templates/default.html4
@@ -48,6 +48,7 @@ $if(date)$
$endif$
$if(abstract)$
+
$abstract-title$
$abstract$
$endif$
diff --git a/data/templates/default.html5 b/data/templates/default.html5
index cb2aa7a096b8..5242f797f331 100644
--- a/data/templates/default.html5
+++ b/data/templates/default.html5
@@ -51,6 +51,7 @@ $if(date)$
$endif$
$if(abstract)$
+
$abstract-title$
$abstract$
$endif$
diff --git a/data/templates/styles.html b/data/templates/styles.html
index 7df3c3dab42f..970adf2b8921 100644
--- a/data/templates/styles.html
+++ b/data/templates/styles.html
@@ -73,6 +73,19 @@
border-left: 2px solid #e6e6e6;
color: #606060;
}
+$if(abstract)$
+div.abstract {
+ margin: 2em 2em 2em 2em;
+ text-align: left;
+ font-size: 85%;
+}
+div.abstract-title {
+ font-weight: bold;
+ text-align: center;
+ padding: 0;
+ margin-bottom: 0.5em;
+}
+$endif$
code {
font-family: $if(monofont)$$monofont$$else$Menlo, Monaco, 'Lucida Console', Consolas, monospace$endif$;
$if(monobackgroundcolor)$
@@ -161,12 +174,6 @@
$if(csl-entry-spacing)$
margin-bottom: $csl-entry-spacing$;
$endif$
-$if(abstract)$
-div.abstract{
- margin: auto;
- width: 90%;
-}
-$endif$
}
.hanging div.csl-entry {
margin-left:2em;
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 988fc26bdefb..79846736acf5 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -43,6 +43,7 @@ import Text.DocLayout (render, literal, Doc)
import Text.Blaze.Internal (MarkupM (Empty), customLeaf, customParent)
import Text.DocTemplates (FromContext (lookupContext), Context (..))
import Text.Blaze.Html hiding (contents)
+import Text.Pandoc.Translations (Term(Abstract))
import Text.Pandoc.Definition
import Text.Pandoc.Highlighting (formatHtmlBlock, formatHtmlInline, highlight,
styleToCss)
@@ -65,7 +66,8 @@ import System.FilePath (takeBaseName)
import Text.Blaze.Html.Renderer.Text (renderHtml)
import qualified Text.Blaze.XHtml1.Transitional as H
import qualified Text.Blaze.XHtml1.Transitional.Attributes as A
-import Text.Pandoc.Class.PandocMonad (PandocMonad, report)
+import Text.Pandoc.Class.PandocMonad (PandocMonad, report,
+ translateTerm)
import Text.Pandoc.Class.PandocPure (runPure)
import Text.Pandoc.Error
import Text.Pandoc.Logging
@@ -267,6 +269,7 @@ pandocToHtml opts (Pandoc meta blocks) = do
let descriptionMeta = literal $ escapeStringForXML $
lookupMetaString "description" meta
slideVariant <- gets stSlideVariant
+ abstractTitle <- translateTerm Abstract
let sects = adjustNumbers opts $
makeSections (writerNumberSections opts) Nothing $
if slideVariant == NoSlides
@@ -355,6 +358,7 @@ pandocToHtml opts (Pandoc meta blocks) = do
(if stMath st
then defField "math" math
else id) .
+ defField "abstract-title" abstractTitle .
(case writerHTMLMathMethod opts of
MathJax u -> defField "mathjax" True .
defField "mathjaxurl"