Package: emacs-goodies-el
Version: 29.3-2
Tags: patch
Severity: wishlist

In markdown mode, the (markdown) and (markdown-preview) functions
calls /usr/bin/markdown to create HTML. This only creates tags for the
content, but not <html> and <body> tags that should surround the
content for proper XHTML.

I was able to help myself by using defadvice...

  (defadvice markdown
    (after decorate-xhtml activate)
    "Add proper XHTML headers and footers to markdown output"

    (save-excursion
      (set-buffer "*markdown-output*")
      (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>\n</title>\n</head>\n\n"
              "<body>\n\n")
      (goto-char (point-max))
      (insert "\n"
              "</body>\n"
              "</html>\n")))

... but the proper solution would probably involve redefining the
markdown function:

  (defun markdown ()
    "Run markdown on the current buffer and preview the output in another 
buffer."
    (interactive)
    (if (and (boundp 'transient-mark-mode) transient-mark-mode mark-active)
        (shell-command-on-region region-beginning region-end markdown-command
                                 "*markdown-output*" nil)
      (shell-command-on-region (point-min) (point-max) markdown-command
                               "*markdown-output*" nil))
    (save-excursion
      (set-buffer "*markdown-output*")
      (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>\n</title>\n</head>\n\n"
              "<body>\n\n")
      (goto-char (point-max))
      (insert "\n"
              "</body>\n"
              "</html>\n")))

Please consider adding this code.

Cheers,
-Hilko

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.25-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages emacs-goodies-el depends on:
ii  bash                         3.2-4       The GNU Bourne Again SHell
ii  emacs21 [emacsen]            21.4a+1-5.4 The GNU Emacs editor
ii  emacs22-gtk [emacsen]        22.2+2-2    The GNU Emacs editor (with GTK use

Versions of packages emacs-goodies-el recommends:
ii  dict                      1.10.11.dfsg-2 Dictionary Client
ii  perl-doc                  5.10.0-11      Perl documentation
ii  wget                      1.11.4-1       retrieves files from the web

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to