Tuesday, March 22, 2011, 5:21:52 PM, Martin Kerz wrote:

> is it possible to ad an id-tag to a 2nd level heading?

> I need html that looks like this:

> <h2 id="heading">Heading</h2>

This may work for you:
add to config:

## headings with id
Markup('^!id!', '<^!',
  '/^(!{1,6})([A-Za-z][-.:\\w]*)!\\s?(.*)$/e',
  "'<:block,1><h'.strlen('$1').' id=\"$2\"'.PSS('>$3</h').strlen('$1').'>'");

and in a page use like this:

!!idname! Heading text heading two

!!!anotherid! Heading three

Basically exclamation marks like in standard heading markup, followed
by id-name, followed by another ! followed by the usual heading text.
Ids start with  a letter, same as for anchors.
No spaces between initial !! and id and following !.

The markup rule is set to come before the standard headings markup,
otherwise it would not be caught.

cheers,
  ~Hans


_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users

Reply via email to