Files
Cash Prokop-Weaver ed860b2b06 feat(eww): Add jump-to-heading in EWW
1. Add jump-to-heading functionality for EWW buffers
2. Bind within imenu (replaces +eww/jump-to-url-on-page; bound to
`:localleader l`)

The new functions are based on existing `eww--capture-url-on-page` and
`+eww/jump-to-url-on-page`. However, I took a different approach and
used alists to hide the position/coordinates from the `completing-read`.
Also, unlike `+eww/jump-to-url-on-page`, we don't give the user an
option of limiting the scope to a region or visible portion of the
buffer. `+eww/jump-to-heading-on-page` always prompts based on the
entire buffer.

Examples:

1. `<h1>H1</h1>`
    - "H1"
2. `<h1>H1</h1><h2>H2</h2>`
    - "H1"
    - "H1/h2"
3. `<h1>H1</h1><h2>H2</h2><h3>H3</h3>`
    - "H1"
    - "H1/H2"
    - "H1/H2/H3"
4. `<h1>H1-1</h1><h2>H2</h2><h1>H1-2</h1>`
    - "H1-1"
    - "H1-1/H2"
    - "H1-2"

![screenshot on the Emacs Wikipedia entry](https://github.com/user-attachments/assets/c2210f0f-c026-4325-9b1b-c2427ec13cd5)

Gaps in the hierarchy (for example a `<h2>` followed by an `<h5>`) are not
represented in the labels presented to the user. Take the Wikipedia
entry for Emacs (above) as an example. The `<h2>` "Content" is the first
heading on the page, there's no preceeding `<h1>`, so it's shown to the
user as "Content" without any prefix. Examples:

1. `<h2>H2</h2>`
    - "H2"
2. `<h2>H2</h2><h4>H4</h4>`
    - "H2"
    - "H2/H4"
3. `<h2>H2</h2><h4>H4</h4><h5>H5</h5>`
    - "H2"
    - "H2/H4"
    - "H2/H4/H5"
4. `<h2>H2</h2><h1>H1</h1><h5>H5</h5>`
    - "H2"
    - "H1"
    - "H1/H5"

- modules/emacs/eww/autoload.el
  - (eww--capture-url-on-page): Rename to `eww--capture-urls-on-page`
  - (eww--capture-headings-on-page): Add; based on existing `eww--capture-urls-on-page`
  - (+eww/jump-to-heading-on-page): Add; based on existing `+eww/jump-to-url-on-page`
- modules/emacs/eww/config.el
  - (keybind) Bind `+eww/jump-to-heading-on-page` to `<:localleader.>`;
    based on existing org-mode jump-to-heading keybind (`consult-org-heading`)
2025-06-10 21:23:31 +02:00
..
2025-05-10 13:33:08 -04:00
2024-09-14 20:47:39 -04:00
2025-06-10 21:23:31 +02:00
2025-01-12 19:55:19 -05:00
2024-09-14 20:47:39 -04:00
2024-09-14 20:47:39 -04:00

:emacs

Description

Modules in this category augment and extend the built-in features of Emacs.

Frequently asked questions

This category has no FAQs yet. Ask one?