Proposal: Markdown, plugged in

Michel Fortin michel.fortin at michelf.com
Sun May 16 16:14:52 EDT 2004


Hum, that concept is great, but I'm not so sure you took the right 
approach to the problem. I'm taking as an example your wikipedia 
plugin.

This:

	[Wikipedia:Markup][]

insert is converted to this in HTML:

	<a href="http://www.wikipedia.com/wiki/Markup">Markup</a>

I see two problem with that. Markdown link concept is that you put the 
text you want to link to inside the brackets followed by the URL or a 
reference to an url, but you are changing the linked text by removing 
the "Wikipedia:" part. I believe this would be more in line with 
current Markdown:

	[Markup][Wikipedia:Markup]

and that would work with your plugin.

Now with the second problem. I think you are making a mistake by using 
the reference syntax for this. Let's say I want to write a link to 
wikipedia inside my text. Here is what I would expect to be able to do:

	This is a small paragraph with a [link to a normal url][1] and another
	[link to a Wikipedia page][2].

	[1]: http://www.michelf.com/
	[2]: Wikipedia:Markup

But that's not quite possible if you are using the reference syntax 
like you do currently. Predefined references (bookmarks) may be a good 
idea, but Wikipedia references are more like a shortened url than a 
reference.

I think the best way of accomplishing this would be to write Wikipedia 
links directly in the url, using a wikipedia pseudo protocol. The link 
could then be rewritten by a link post processor that convert any 
wikipedia:something url into the proper http url. Let me explain:

	[a wikipedia link](wikipedia:Markup)

get converted by markdown this way:

	<a href="wikipedia:Markup">a wikipedia link</a>

Your program can then check the `href` attribute inside of all `a` tags 
and convert Wikipedia urls to the intended http url:

	<a href="http://www.wikipedia.com/wiki/Markup">Markup</a>

This has two advantage:

*	no need for a plugin;
*	the program can be used outside of Markdown context.

There is still two problems remaining regarding integration of such a 
thing with Markdown:

*	You currently cannot put a closing parenthesis inside an inline url.
		[a wikipedia link](Wkipedia:Markup (computer programming))
*	You currently cannot put a space inside a reference url.
		[a wikipedia link][1]
		[1]: Wkipedia:Markup (computer programming)

Not that this couldn't be solved one way or another.

I'm thinking of another thing. On wikipedia, all pages are on the same 
level, the /wiki/ directory. That means that if you write a relative 
link like:

	[a link to markup](Markup)

on one of these page, it would works already! If your link has spaces, 
they need to be converted to underscore -- something you can also do 
using a post processor program. Maybe Markdown could be expanded so 
that if you put an empty url like:

	[Markup]()

it generate a link with the link text as the URL, helping the usage of 
Markdown on wikis.


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/



More information about the Markdown-discuss mailing list