#847 closed defect (fixed)
Add 'id' attribute to headings in the wiki
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | normal | Milestone: | 0.9 |
Component: | wiki system | Version: | 0.8 |
Severity: | normal | Keywords: | |
Cc: | manuzhai@…, trac-form@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
By adding the 'id' attribute to the h* elements in the wiki, it would be possible to link to both a page and a specific section of the page.
e.g.
== Versions ==
…would become…
<h2 id="versions">Versions</h2>
… and could be linked to with [wiki:SomePage#versions]
.
It would also need to correct case/replace spaces with underscores in both the tag generation and link parsing.
Attachments (0)
Change History (13)
comment:1 by , 20 years ago
comment:2 by , 20 years ago
You're quite right - this should apply automatically to all hn elements.
comment:3 by , 20 years ago
Keywords: | id tag removed |
---|---|
Summary: | Add 'id' attribute to h2 elements in the wiki → Add 'id' attribute to headings in the wiki |
comment:4 by , 20 years ago
Description: | modified (diff) |
---|
Ticket #992 has been marked as duplicate of this ticket. It contains a couple of patches.
comment:5 by , 20 years ago
Cc: | added |
---|
comment:6 by , 20 years ago
Cc: | added |
---|
comment:8 by , 20 years ago
Milestone: | → 0.9 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Implemented in [1250].
For the TOC macro, note that IDs starting with a digit are prefixed with an underscore. So the macro will probably need to be updated.
comment:9 by , 20 years ago
Resolution: | fixed |
---|---|
Severity: | enhancement → normal |
Status: | closed → reopened |
Version: | 0.7.1 → 0.8 |
To prevent anchor ids incrementing their numerical suffix forever, you should add a line:
class WikiFormatter: def __init__: ... self.anchors = []
Otherwise, every visit (or refresh) of the same wiki page generates different heading ids.
comment:10 by , 20 years ago
Well, I should note that the above id incrementing may not occur under CGI since the CGI will be run as a new process each time. So, I think that the anchor resetting would need tested under mod_python to reproduce the problem.
comment:12 by , 20 years ago
Matthew: Sorry, I forgot to mention this issue occured under mod_python. The proposed patch fixes this problem.
cmlenz: Thanks for your quick reaction, and congratulations for making this outstanding product available to us all.
comment:13 by , 20 years ago
Matthew: Sorry, I forgot to mention this issue occured under mod_python. The proposed patch fixes this problem.
cmlenz: Thanks for your quick reaction, and congratulations for making this outstanding product available to us all.
Why not add an id to any heading level?