Function: markdown-export-file-name

markdown-export-file-name is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown-export-file-name &optional EXTENSION)

Documentation

Attempt to generate a filename for Markdown output.

The file extension will be EXTENSION if given, or .html by default. If the current buffer is visiting a file, we construct a new output filename based on that filename. Otherwise, return nil.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-export-file-name (&optional extension)
  "Attempt to generate a filename for Markdown output.
The file extension will be EXTENSION if given, or .html by default.
If the current buffer is visiting a file, we construct a new
output filename based on that filename.  Otherwise, return nil."
  (when (buffer-file-name)
    (unless extension
      (setq extension ".html"))
    (let ((candidate
           (concat
            (cond
             ((buffer-file-name)
              (file-name-sans-extension (buffer-file-name)))
             (t (buffer-name)))
            extension)))
      (cond
       ((equal candidate (buffer-file-name))
        (concat candidate extension))
       (t
        candidate)))))