Function: markdown-add-xhtml-header-and-footer

markdown-add-xhtml-header-and-footer is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown-add-xhtml-header-and-footer TITLE)

Documentation

Wrap XHTML header and footer with given TITLE around current buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-add-xhtml-header-and-footer (title)
  "Wrap XHTML header and footer with given TITLE around current buffer."
  (goto-char (point-min))
  (insert "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
          "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n"
          "\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\n"
          "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\n"
          "<head>\n<title>")
  (insert (markdown-escape-title title))
  (insert "</title>\n")
  (unless (= (length markdown-content-type) 0)
    (insert
     (format
      "<meta http-equiv=\"Content-Type\" content=\"%s;charset=%s\"/>\n"
      markdown-content-type
      (or (and markdown-coding-system
               (coding-system-get markdown-coding-system
                                  'mime-charset))
          (coding-system-get buffer-file-coding-system
                             'mime-charset)
          "utf-8"))))
  (if (> (length markdown-css-paths) 0)
      (insert (mapconcat #'markdown-stylesheet-link-string
                         markdown-css-paths "\n")))
  (when (> (length markdown-xhtml-header-content) 0)
    (insert markdown-xhtml-header-content))
  (insert "\n</head>\n\n"
          "<body>\n\n")
  (when (> (length markdown-xhtml-body-preamble) 0)
    (insert markdown-xhtml-body-preamble "\n"))
  (goto-char (point-max))
  (when (> (length markdown-xhtml-body-epilogue) 0)
    (insert "\n" markdown-xhtml-body-epilogue))
  (insert "\n"
          "</body>\n"
          "</html>\n"))