jrblevin / markdown-mode

Emacs Markdown Mode
http://jblevins.org/projects/markdown-mode/
GNU General Public License v3.0
875 stars 160 forks source link

Add extensible link-opening system #808

Closed alphapapa closed 8 months ago

alphapapa commented 8 months ago

Description

Similar to Org mode's org-open-at-point-functions, this provides a new hook, markdown-follow-link-functions, which may be a list of functions which are called with a link's URL and offered the chance to handle the link-following action.

This allows other libraries to affect how markdown-mode follows links. For example, this allows hyperdrive.el to follow relative links between files in a hyperdrive (i.e. links that are not full URLs but just paths, like ../sibling-directory/file.md).

Among the changes in this PR are an improvement to one of the test macros, and a fix in one of the link-following functions. All the tests still pass as expected.

Related Issue

This implements the feature mentioned in https://github.com/jrblevin/markdown-mode/issues/780.

Type of Change

Checklist

Thanks for your work on markdown-mode.

josephmturner commented 8 months ago

Thank you!!