[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/markdown-mode 1c459f7 7/8: Merge pull request #667 from jr
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/markdown-mode 1c459f7 7/8: Merge pull request #667 from jrblevin/markdown-do-follow-links |
Date: |
Thu, 21 Oct 2021 20:57:51 -0400 (EDT) |
branch: elpa/markdown-mode
commit 1c459f7494c5f15c5b4ce110375bc4fbef21e144
Merge: 7360efc bf7c4d8
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #667 from jrblevin/markdown-do-follow-links
markdown-do follows link
---
.gitignore | 1 +
CHANGES.md | 3 +++
markdown-mode.el | 3 +++
tests/markdown-test.el | 32 ++++++++++++++++++++++++++++++++
tests/wiki/pr666/Foo.md | 0
tests/wiki/pr666/jump_wiki_link.md | 1 +
tests/wiki/pr666/wiki_link_in_table.md | 1 +
7 files changed, 41 insertions(+)
diff --git a/.gitignore b/.gitignore
index d24783d..3db2449 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*.elc
index.text
+*~
diff --git a/CHANGES.md b/CHANGES.md
index 427aef5..ab19557 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -3,6 +3,8 @@
*Under development*
* **Breaking changes:**
+ - `markdown-do` supports following link [GH-666][]
+ This changes behavior of `markdown-do` at table
* New features:
- Introduce `markdown-mouse-follow-link` variable [GH-290][]
@@ -117,6 +119,7 @@
[gh-649]: https://github.com/jrblevin/markdown-mode/issues/649
[gh-652]: https://github.com/jrblevin/markdown-mode/issues/652
[gh-663]: https://github.com/jrblevin/markdown-mode/issues/663
+ [gh-666]: https://github.com/jrblevin/markdown-mode/issues/666
# Markdown Mode 2.4
diff --git a/markdown-mode.el b/markdown-mode.el
index 2b0794c..2dc3a97 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -8234,6 +8234,9 @@ markers and footnote text."
;; Reference definition
((thing-at-point-looking-at markdown-regex-reference-definition)
(markdown-reference-goto-link (match-string-no-properties 2)))
+ ;; Link
+ ((or (markdown-link-p) (markdown-wiki-link-p))
+ (markdown-follow-thing-at-point nil))
;; GFM task list item
((markdown-gfm-task-list-item-at-point)
(markdown-toggle-gfm-checkbox))
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index 67cf3a1..4c7d92a 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -1558,6 +1558,38 @@ the opening bracket of [^2], and then subsequent
functions would kill [^2])."
(markdown-footnote-kill)
(should (string-equal (current-kill 0) "foo\n")))))
+(ert-deftest test-markdown-do/jump-wiki-link ()
+ "Test `markdown-do' jumps to wiki links"
+ (with-current-buffer (find-file-noselect "wiki/pr666/jump_wiki_link.md")
+ (let ((markdown-enable-wiki-links t))
+ (goto-char 3)
+ (markdown-do)
+ (should (string= (buffer-name) "Foo.md")))))
+
+(ert-deftest test-markdown-do/jump-link ()
+ "Test `markdown-do' jumps to markdown links"
+ (markdown-test-string "[bar](https://duckduckgo.com)"
+ (let* ((opened-url nil)
+ (browse-url-browser-function
+ (lambda (url &rest _args) (setq opened-url url))))
+ (goto-char 3)
+ (markdown-do)
+ (should (string= opened-url "https://duckduckgo.com")))))
+
+(ert-deftest test-markdown-do/wiki-link-in-table ()
+ "Test `markdown-do' jumps to markdown links"
+ (with-current-buffer (find-file-noselect "wiki/pr666/wiki_link_in_table.md")
+ (let ((markdown-enable-wiki-links t))
+ ;; alignment
+ (markdown-do)
+ (should (string= (buffer-string) "| [[Foo]] |\n"))
+
+ (forward-char 4)
+
+ ;; wiki link
+ (markdown-do)
+ (should (string= (buffer-name) "Foo.md")))))
+
(ert-deftest test-markdown-footnote-reference/jump ()
"Test `markdown-do' for footnotes and reference links."
(markdown-test-string
diff --git a/tests/wiki/pr666/Foo.md b/tests/wiki/pr666/Foo.md
new file mode 100644
index 0000000..e69de29
diff --git a/tests/wiki/pr666/jump_wiki_link.md
b/tests/wiki/pr666/jump_wiki_link.md
new file mode 100644
index 0000000..ea8532e
--- /dev/null
+++ b/tests/wiki/pr666/jump_wiki_link.md
@@ -0,0 +1 @@
+[[Foo]]
diff --git a/tests/wiki/pr666/wiki_link_in_table.md
b/tests/wiki/pr666/wiki_link_in_table.md
new file mode 100644
index 0000000..df6742f
--- /dev/null
+++ b/tests/wiki/pr666/wiki_link_in_table.md
@@ -0,0 +1 @@
+| [[Foo]] |
- [nongnu] elpa/markdown-mode updated (7360efc -> c3c2f0d), ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode d917e71 1/8: extend markdown-do to follow links, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode fc729ea 2/8: WIP: fix+add tests for markdown-do link jump, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode 799a8e9 3/8: Fix tests, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode 0a9ee2b 4/8: Update Changes, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode 1c459f7 7/8: Merge pull request #667 from jrblevin/markdown-do-follow-links,
ELPA Syncer <=
- [nongnu] elpa/markdown-mode 981e48c 5/8: Test following wiki link to nonexistent file works, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode bf7c4d8 6/8: Update CHANGES.md, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode c3c2f0d 8/8: Merge pull request #668 from edrex/test-wiki-link-follow-new-file, ELPA Syncer, 2021/10/21