From 6e72a4c7f0b67737766fb2f090c7a83aae840342 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Fri, 15 Dec 2023 15:00:36 +0100 Subject: [PATCH] lisp/ox-md.el (org-md--footnote-section): Honor `org-md-toplevel-hlevel' * testing/lisp/test-ox-md.el (ox-md/footnotes-level): New test file and new test for the bug. Reported-by: Pablo Padilla Link: https://orgmode.org/list/AC5BC3B4-33F9-487E-877E-EA9A829608A5@gmail.com --- lisp/ox-md.el | 2 +- testing/lisp/test-ox-md.el | 43 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 testing/lisp/test-ox-md.el diff --git a/lisp/ox-md.el b/lisp/ox-md.el index 5be0ca22e..ec8e3c53e 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -305,7 +305,7 @@ INFO is a plist used as a communication channel." (section-title (org-html--translate "Footnotes" info))) (when fn-alist (format (plist-get info :md-footnotes-section) - (org-md--headline-title headline-style 1 section-title) + (org-md--headline-title headline-style (plist-get info :md-toplevel-hlevel) section-title) (mapconcat (lambda (fn) (org-md--footnote-formatted fn info)) fn-alist "\n"))))) diff --git a/testing/lisp/test-ox-md.el b/testing/lisp/test-ox-md.el new file mode 100644 index 000000000..bf3dced1b --- /dev/null +++ b/testing/lisp/test-ox-md.el @@ -0,0 +1,43 @@ +;;; test-ox-md.el --- Tests from ox-md.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Ihor Radchenko + +;; Author: Ihor Radchenko + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Code: + +(require 'ox-md) + +(ert-deftest ox-md/footnotes-level () + "Test `org-md-toplevel-hlevel' being honored by footnote section." + (org-test-with-temp-text " +** level 1 + Post starts here. [fn:1] +*** level2 + lorem ipsum +** Footnotes +[fn:1] a footnote +" + (let ((org-md-toplevel-hlevel 4) + (export-buffer "*Test MD Export*") + (org-export-show-temporary-export-buffer nil)) + (org-export-to-buffer 'md export-buffer) + (with-current-buffer export-buffer + (goto-char (point-min)) + (should (search-forward "#### Footnotes")))))) + +(provide 'test-ox-md) +;;; test-ox-md.el ends here