Skip to content

Use hpath:find header link logic for HyWiki links#865

Merged
rswgnu merged 2 commits intomasterfrom
wip-hywiki-publish-dash-space-sections
Feb 16, 2026
Merged

Use hpath:find header link logic for HyWiki links#865
rswgnu merged 2 commits intomasterfrom
wip-hywiki-publish-dash-space-sections

Conversation

@matsl
Copy link
Collaborator

@matsl matsl commented Feb 15, 2026

What

Use hpath:find header link logic for HyWiki links.

  • hywiki.el (hywiki--org-link-html-format): Use
    `hpath:dashes-to-spaces-markup-anchor' to make header match target.
  • test/hywiki-tests.el (hywiki-tests--action-key-moves-to-word-and-section-using-dash-to-space-conversion):
    Add test for headers with dashes.
    (hywiki-tests--published-html-links-to-word-and-section): Update test to
    the dash to space conversion in headers.

Why

hpath:find is a central part of both pathname headers (links) and
hywiki headers. Using a common scheme for both makes both usage and
implementation simpler.

In the published html links should go to the same header as within
HyWiki-mode.

Note

The dash to space conversion scheme means this types of links.

Space conversion scheme

"File#word-word-word" -> # word word word
"File#word word word" -> # word word word
"File#word word-word" -> # word word-word (Verbatim if both space and dash)

If File's mode is derived from prog-mode the header will be used
verbatim.

Headers that contains no space but a dash will not be possible to link
to.

HyWiki

For HyWiki this means, and copied from the new test:

WikiWord#first"                -> "* first"
WikiWord#header-one"           -> "* header one"
WikiWord#first one"            -> "* first"
(WikiWord#header one)"         -> "* header one"
WikiWord#header--two"          -> "* header  two"
(WikiWord#header--three)"      -> "* header  three"
WikiWord#header---four"        -> "* header   four"

Publishing

The generated pages will keep how they look, no dash substitution, but
the link will link to the header (target) as within hywiki-mode.

* hywiki.el (hywiki--org-link-html-format): Use
    `hpath:dashes-to-spaces-markup-anchor' to make header match target.
* test/hywiki-tests.el (hywiki-tests--action-key-moves-to-word-and-section-using-dash-to-space-conversion):
    Add test for headers with dashes.
    (hywiki-tests--published-html-links-to-word-and-section): Update test to
    the dash to space conversion in headers.
@matsl matsl force-pushed the wip-hywiki-publish-dash-space-sections branch from 29c6a84 to d25087f Compare February 15, 2026 21:21
@matsl matsl requested a review from rswgnu February 15, 2026 21:26
@rswgnu rswgnu merged commit 09dfbc4 into master Feb 16, 2026
4 checks passed
@matsl matsl deleted the wip-hywiki-publish-dash-space-sections branch February 16, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments