Auto-linked paragraphs

23 March 2013, 15:47

Keywords: link, inline

Inspired by this Forum post.

To append anchors to p and h5 nodes, replace <txp:body /> in the article form with

<txp:etc_query data='<txp:body />'
	replace="//p@@id=p{$md5}@+= <a href='#{@id?}'>#</a>;
	//h5@@id={$ucwords.str_replace( ||$).lcfirst}@+= <a href='#{@id?}'>#</a>" />

Before

First post

I don’t know if this is a plugin, or what, but it’s a fantastic idea for anyone like me who researches content and often uses quotations. Check this site out, this article, for example, and note the little “#“s at the end of each paragraph. That’s fawking cool. Could that be done?

First reply

I loves it too. I think it’s native to one of Mr Winer’s own systems, but I’m not sure which. Most of the time I can’t figure out what he’s on about. Would love to see a Txp plugin doing the same thing though.

Only problem I can see is the risk of link rot. I mean – what if you edited a live article and added paragraphs earlier in the body than a paragraph that had already been bookmarked/indexed/liked/tweeted/whatever? Small chance, but it feels a bit fragile.

After

First post #

I don’t know if this is a plugin, or what, but it’s a fantastic idea for anyone like me who researches content and often uses quotations. Check this site out, this article, for example, and note the little “#“s at the end of each paragraph. That’s fawking cool. Could that be done? #

First reply #

I loves it too. I think it’s native to one of Mr Winer’s own systems, but I’m not sure which. Most of the time I can’t figure out what he’s on about. Would love to see a Txp plugin doing the same thing though. #

Only problem I can see is the risk of link rot. I mean – what if you edited a live article and added paragraphs earlier in the body than a paragraph that had already been bookmarked/indexed/liked/tweeted/whatever? Small chance, but it feels a bit fragile. #

File(s)