Skip to content

Commit ba8de41

Browse files
authored
Merge pull request #675 from jrblevin/pr-674
Add unit test of #674
2 parents 4469553 + cba711a commit ba8de41

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
- Fix fill paragraph issue with setext heading [GH-638][]
8282
- Fix line break highlighting issue at end of buffer [GH-621][]
8383
- Fix URL highlighting which contains comma or parentheis [GH-649][]
84+
- Fix eldoc function issue with `markdown-toggle-url-hiding [GH-674][]
85+
Thanks to Ta Quang Trung for a patch
8486

8587
[gh-290]: https://github.com/jrblevin/markdown-mode/issues/290
8688
[gh-311]: https://github.com/jrblevin/markdown-mode/issues/311
@@ -121,6 +123,7 @@
121123
[gh-652]: https://github.com/jrblevin/markdown-mode/issues/652
122124
[gh-663]: https://github.com/jrblevin/markdown-mode/issues/663
123125
[gh-666]: https://github.com/jrblevin/markdown-mode/issues/666
126+
[gh-674]: https://github.com/jrblevin/markdown-mode/pull/674
124127

125128
# Markdown Mode 2.4
126129

markdown-mode.el

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9645,22 +9645,21 @@ rows and columns and the column alignment."
96459645
(thing-at-point-looking-at markdown-regex-link-reference))
96469646
(or markdown-hide-urls markdown-hide-markup))
96479647
(let* ((imagep (string-equal (match-string 1) "!"))
9648+
(referencep (string-equal (match-string 5) "["))
9649+
(link (match-string-no-properties 6))
96489650
(edit-keys (markdown--substitute-command-keys
96499651
(if imagep
96509652
"\\[markdown-insert-image]"
96519653
"\\[markdown-insert-link]")))
96529654
(edit-str (propertize edit-keys 'face 'font-lock-constant-face))
9653-
(referencep (string-equal (match-string 5) "["))
96549655
(object (if referencep "reference" "URL")))
96559656
(format "Hidden %s (%s to edit): %s" object edit-str
96569657
(if referencep
96579658
(concat
96589659
(propertize "[" 'face 'markdown-markup-face)
9659-
(propertize (match-string-no-properties 6)
9660-
'face 'markdown-reference-face)
9660+
(propertize link 'face 'markdown-reference-face)
96619661
(propertize "]" 'face 'markdown-markup-face))
9662-
(propertize (match-string-no-properties 6)
9663-
'face 'markdown-url-face)))))
9662+
(propertize link 'face 'markdown-url-face)))))
96649663
;; Hidden language name for fenced code blocks
96659664
((and (markdown-code-block-at-point-p)
96669665
(not (get-text-property (point) 'markdown-pre))

tests/markdown-test.el

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,6 +2224,18 @@ See GH-245."
22242224
(should (invisible-p 154))
22252225
(should (invisible-p 156)))))
22262226

2227+
;;; Markup hiding url tests:
2228+
2229+
(ert-deftest test-markdown-url-hiding/eldoc ()
2230+
"Test hiding URL and eldoc.
2231+
Detail: https://github.com/jrblevin/markdown-mode/pull/674"
2232+
(markdown-test-string "[This is a hidden link](http://hidden.link)"
2233+
(markdown-toggle-url-hiding +1)
2234+
(search-forward "(")
2235+
(markdown-eldoc-function)
2236+
;; markdown-eldoc-function doesn't raise an exception
2237+
(should t)))
2238+
22272239
;;; Font lock tests:
22282240

22292241
(ert-deftest test-markdown-font-lock/italics-1 ()

0 commit comments

Comments
 (0)