Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Hide wikilink markup as part of `markdown-toggle-markup-hiding` [GH-847][]
- Angle URL fontify issue which was introduced by [GH-861][] [GH-895][]
- Fix list item bound calculation when tab indentation is used [GH-904][]
- Fix `markdown-heading-at-point` at the end of line [GH-912][]

* Improvements:
- Support drag and drop features on Windows and multiple files' drag and drop
Expand All @@ -29,6 +30,7 @@
[gh-895]: https://github.com/jrblevin/markdown-mode/issues/895
[gh-904]: https://github.com/jrblevin/markdown-mode/issues/904
[gh-910]: https://github.com/jrblevin/markdown-mode/issues/910
[gh-912]: https://github.com/jrblevin/markdown-mode/issues/912

# Markdown Mode 2.7

Expand Down
3 changes: 2 additions & 1 deletion markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -2904,7 +2904,8 @@ data. See `markdown-inline-code-at-point-p' for inline code."
(defun markdown-heading-at-point (&optional pos)
"Return non-nil if there is a heading at the POS.
Set match data for `markdown-regex-header'."
(let ((match-data (get-text-property (or pos (point)) 'markdown-heading)))
(let* ((p (or pos (if (and (eolp) (>= (point) 2)) (1- (point)) (point))))
(match-data (get-text-property p 'markdown-heading)))
(when match-data
(set-match-data match-data)
t)))
Expand Down
6 changes: 5 additions & 1 deletion tests/markdown-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -4398,7 +4398,11 @@ x: x
(forward-line -1)
(should (markdown-heading-at-point))
(should (equal (match-data t) (get-text-property (point) 'markdown-heading)))
(should (equal (match-data t) (get-text-property (point) 'markdown-heading-1-setext))))))
(should (equal (match-data t) (get-text-property (point) 'markdown-heading-1-setext))))
;; Detail: https://github.com/jrblevin/markdown-mode/issues/912
(markdown-test-string "# header\nsection"
(goto-char (line-end-position))
(should (markdown-heading-at-point)))))

(ert-deftest test-markdown-parsing/inline-link-in-code-block ()
"Test `markdown-match-generic-links'."
Expand Down