ox-md: Fix exporting numbered items >=100

* lisp/ox-md.el (org-md-item): Always put at least one space after
item number.
* testing/lisp/test-ox-md.el (ox-md/item): New test.

Reported-by: Bastien <bzg@gnu.org>
Link: https://orgmode.org/list/87wmo8qll7.fsf@gnu.org
This commit is contained in:
Ihor Radchenko 2024-05-05 20:20:54 +03:00
parent 105dedd0d9
commit 24feef95e4
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 20 additions and 1 deletions

View File

@ -452,7 +452,7 @@ a communication channel."
(org-list-parents-alist struct)))))
"."))))
(concat bullet
(make-string (- 4 (length bullet)) ? )
(make-string (max 1 (- 4 (length bullet))) ? )
(pcase (org-element-property :checkbox item)
(`on "[X] ")
(`trans "[-] ")

View File

@ -39,5 +39,24 @@
(goto-char (point-min))
(should (search-forward "#### Footnotes"))))))
(ert-deftest ox-md/item ()
"Test `org-md-item'."
;; Align items at column 4.
;; Columns >=100 not aligned.
(org-test-with-temp-text
(mapconcat
#'identity
(cl-loop for n from 1 to 105
collect (format "%d. item" n))
"\n")
(let ((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 "1. item"))
(should (search-forward "10. item"))
(should (search-forward "101. item"))))))
(provide 'test-ox-md)
;;; test-ox-md.el ends here