diff --git a/README.md b/README.md
index 4f3be4bf..10dd8acc 100644
--- a/README.md
+++ b/README.md
@@ -742,6 +742,14 @@ provides an interface to all of the possible customizations:
* `markdown-xhtml-header-content` - additional content to include
in the XHTML `
` block (default: `""`).
+ * `markdown-xhtml-body-preamble` - additional content to include in the
+ XHTML block, before the output. This is useful if you'd like to
+ wrap the Markdown output around extra elements (default: `""``)."
+
+ * `markdown-xhtml-body-epilogue` - additional content to include in the
+ XHTML block, after the output. This is useful if you'd like to
+ wrap the Markdown output around extra elements (default: `""``).
+
* `markdown-xhtml-standalone-regexp` - a regular expression which
`markdown-mode` uses to determine whether the output of
`markdown-command` is a standalone XHTML document or an XHTML
diff --git a/markdown-mode.el b/markdown-mode.el
index ec442686..c39bbd54 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -7,6 +7,7 @@
;; Maintainer: Jason R. Blevins
;; Created: May 24, 2007
;; Version: 2.4-dev
+;; Package-Version: 20171031.1725
;; Package-Requires: ((emacs "24") (cl-lib "0.5"))
;; Keywords: Markdown, GitHub Flavored Markdown, itex
;; URL: https://jblevins.org/projects/markdown-mode/
@@ -758,6 +759,14 @@
;; * `markdown-xhtml-header-content' - additional content to include
;; in the XHTML `` block (default: `""`).
;;
+;; * `markdown-xhtml-body-preamble' - additional content to include in the
+;; XHTML block, before the output. This is useful if you'd like to
+;; wrap the Markdown output around extra elements (default: `""`')."
+;;
+;; * `markdown-xhtml-body-epilogue' - additional content to include in the
+;; XHTML block, after the output. This is useful if you'd like to
+;; wrap the Markdown output around extra elements (default: `""`').
+;;
;; * `markdown-xhtml-standalone-regexp' - a regular expression which
;; `markdown-mode' uses to determine whether the output of
;; `markdown-command' is a standalone XHTML document or an XHTML
@@ -1360,6 +1369,18 @@ and `iso-latin-1'. Use `list-coding-systems' for more choices."
:group 'markdown
:type 'string)
+(defcustom markdown-xhtml-body-preamble ""
+ "Additional content to include in the XHTML block, before the output.
+This is useful if you'd like to wrap the Markdown output around extra elements."
+ :group 'markdown
+ :type 'string)
+
+(defcustom markdown-xhtml-body-epilogue ""
+ "Additional content to include in the XHTML block, after the output.
+This is useful if you'd like to wrap the Markdown output around extra elements."
+ :group 'markdown
+ :type 'string)
+
(defcustom markdown-xhtml-standalone-regexp
"^\\(<\\?xml\\|\n\n"
"\n\n")
+ (when (> (length markdown-xhtml-body-preamble) 0)
+ (insert markdown-xhtml-body-preamble))
+ (insert "\n")
(goto-char (point-max))
+ (insert "\n")
+ (when (> (length markdown-xhtml-body-epilogue) 0)
+ (insert markdown-xhtml-body-epilogue))
(insert "\n"
"\n"
"\n"))