One of the things that's been a real killer for me using most wikis has been the syntax. None of them get it right.
MediaWiki has been bearable, and over time I've grown used to it. The problem is that nobody agrees on a remotely similar syntax. There were some early efforts to create a generally agreed-upon syntax, and it did fairly well.. but it's still not used everywhere.
I'm not just talking about wikis, but about markup languages in general. Even something like Ruby's RDoc decided on its own syntax.
And they're all wrong. Seriously, who thinks that __this is italicized__
?
I've even seen and participated in some discussions on better syntax, and programmers keep saying that it's hard to create certain kinds of syntaxes. They're wrong. After some dabbling I was able to create a markup language myself. Easily.
_underlined_
-strikethrough-
/emphasis/
*bold*
**big**
_ - / underlined strikethrough italics /-_
Everyone can understand that syntax.
Oh, and I could easily zip off and create italics
<i>
which is separate from /emphasis/
<em>
Plain URL automatic-linking was trivial too:
http://example.com
=>
http://example.com
Simple syntax like this is really only for the shorthand for everyday English. Sure I could create ^superscript^
, and maybe =subscript=
and `pre`
and whatever else comes to mind.. those become less and less obvious and more about personal preference. `backticks`
are used in shell scripting, so that one's easy to remember (though it's more correct to use $(foo)
). Superscript is obvious.. subscript not so much. I figure if someone needs to do something fancy, they could just use proper HTML. I've maintained the habit of using HTML wherever possible, because it makes it much easier to move the source to another wiki without having to translate everything.
And yes, I do realise that I ought to be using CSS instead of the old HTML v2 stuff. I'll get around to that.
Oh, and about wiki linking. I implemented an automatic linking. Screw all the [[some title|whatever]]
nonsense. If you need to do that, you're doing it wrong. I just have the engine check the list of files, then check for appropriate phrases and build links intelligently.
So if I have some-example.html
, then
some example text
=>
some example text
That code is a huge maul right now, but it'll turn into a smaller hammer soon enough if I manage to do things like link only one occurrence per section - so between <h1>
and some other header there is only one unique link to a file, and in the next section another link can be made.
Syntax should get the hell out of the way, and the computer should do as much of the clumsy footwork as possible.
I can think of still-smarter things I could do.
the last word in this sentence is a linkhttp://example.com
=>
the last word in this sentence is a link
That's a bit messy, but I could imagine something cleaner..
the last word in this sentence is a link
http://example.com
sentence continues.
=>
the last word in this sentence is a link sentence continues.
I'm even tempted in doing a standard and a print version. The standard version would have inline links, but the print version would remove all linking and instead have endnote references, with a nice list of links at the end. Heck, I could automatically URL-shorten (e.g. simple-url-shortener) all those links too.
- Source
This is a sentence with a link
- Regular:
This is a sentence with a link
- Print:
This is a sentence with a link[1]
So all in all, this is an excellent learning project. I find file and string processing to be the very best for my goofing around. Ruby is very good at string processing, and while its file processing is slow, it's also very simple to work with. Oh, and I still hate regular expressions.
This little syntax "engine" is still being hacked on, but it'll get released eventually. I won't really chain it to any other project like my compiled website, so it can be used wherever it needs to be used - toss it a variable and it'll return a conversion. Or just use whatever bits of it you like. Stay tuned.
Last updated 2023-03-19 at 04:53:43