Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct beginning of inline code position #116

Closed
wants to merge 2 commits into from
Closed
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: 1 addition & 1 deletion markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -2805,7 +2805,7 @@ Return nil otherwise."
(defun markdown-match-inline-generic (regex last)
"Match inline REGEX from the point to LAST."
(when (re-search-forward regex last t)
(let ((bounds (markdown-code-block-at-pos (match-beginning 0))))
(let ((bounds (markdown-code-block-at-pos (match-beginning 1))))
(if (null bounds)
;; Not in a code block: keep match data and return t when in bounds
(<= (match-end 0) last)
Expand Down
10 changes: 10 additions & 0 deletions tests/markdown-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -2860,6 +2860,16 @@ only partially propertized."
(point-min) (point-at-eol)
'face (list markdown-bold-face)))))

(ert-deftest test-markdown-parsing/inline-code ()
"Don't cause infinite loop for inline code just after code block
Detail: https://github.com/jrblevin/markdown-mode/issues/115"
(markdown-test-string "---
x: x
---
`x`
"
(should (= (markdown-match-code (point-max)) (point-max)))))

;;; Reference Checking:

(ert-deftest test-markdown-references/goto-line-button ()
Expand Down