[Pmwiki-users] Idea for syntax of linking to an anchor within a page

Christian Ridderström chr
Sat Aug 16 11:51:18 CDT 2003


On Sat, 16 Aug 2003, Patrick R. Michaud wrote:

> On Sat, Aug 16, 2003 at 06:26:10PM +0200, Christian Ridderstr?m wrote:
> > 
> > (1)	[[ThisPage:#Anchor link text]]
> > (2)	[[http:#Anchor link text]]
> 
> As of version 0.5.15 you can do PageName#anchor, where PageName is the
> name of the page you want to anchor to.  So you can just reuse the current
> pagename in the anchor.
> 
Umm.. the point here was to use the name of the current page, without 
having to state that name explicitly (useful in included files for 
instance)

> > Questions:
> > 	- Is [[http:#Anchor ]] supposed to work?
> > 	- If not, is it safe to use it? (or will it disappear in 
> > 	  future versions)
> 
> It's very browser dependent.  What happens is that it gets translated
> into html that looks like  <a href='http:#Anchor'>link text</a>, and
> some browsers definitely cannot handle the url properly.  So, I wouldn't
> consider it safe--not because PmWiki will ever get rid of it, but just
> because it doesn't work in all browsers.

Thanks... testing this page:

	http://www.pmichaud.com/wiki/Test/AnchorLink

indicates that <a href='http:#Anchor'>link text</a> is valid HTML-code 
even if some browsers don't support it. 

> 
> > Otherwise I'd like to suggest that the anchor link could be written as:
> > 	[[#Anchor link text]]
> > Spaces doesn't work as anchor names anyway (unless maybe we start adding 
> > %20 or something?).
> 
> This is just a bit tricky in the current markup, because [[#Anchor]] 
> is currently being used to define an anchor.  Thus we'd have the following
> situation:
> 
>    [[WikiWord]]             - link to WikiWord, renders as "[1]"
>    [[WikiWord link text]]   - link to WikiWord, renders as "link text"
>    [[#Anchor]]              - defines an anchor, renders nothing
>    [[#Anchor link text]]    - link to #Anchor, renders as "link text"
>    [[WikiWord#Anchor]]      - link to WikiWord#Anchor, renders as "[2]"
>    [[WikiWord#Anchor text]] - link to WikiWord#Anchor, renders as "text"
>    #Anchor                  - neither a link nor anchor--renders as "#Anchor"

Note that '#Anchor' renders as '1. Anchor' if on the beginning of a line,
see http://www.pmichaud.com/wiki/Test/AnchorLink 

> I definitely need to hear opinions/votes on this before I commit to 
> anything--either respond to the listserv or mail me directly so 
> I can have some idea of how others feel about the proposal.

I'm for it of course (since I suggested it). Using '[[#Anchor]]' to define 
an anchor is nice since it's so compact, but it might be good to 
introduce an alternative markup for anchors such as: '[[name:Anchor]]'.

Hmm... maybe the question should be if '[[#Anchor]]' is an intuitive 
way of definining an anchor? 

/Christian

PS. I'm on the list now, so you don't have to mail me directly.


-- 
Christian Ridderstr?m, +46-8-768 39 44		http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list