Wikimarks/Syntax

Wikimarks are just a list of links written in wikitext. For those of you that are admins, it's similar to MediaWiki:Wiki-navigation. However, unlike the wiki navigation, Wikimarks supports 4 levels of menus, which are written as follows:
* Level 2 link
** Level 3 link
** Level 3 link
*** Level 4 link
*** Level 4 link
** Level 3 link
* Level 2 link
* Level 2 link
== Link syntax ==
Each link is wikitext:
; Standard wikilink
:* [[link|text]]
; A link to your userpage
:* [[Special:MyPage|User page]]
; An interwiki link
:* [[w:c:dev:Wikimarks|Wikimarks]]
; An external link
:* [link_url text]
; An external link to the Wikimarks page
:* Wikimarks
; An external link to Google
:* Google
; Simple text, usually used to just above a submenu
:* text
=== Advanced ===
Wikimarks also comes with extra features for wikitext:
; Using relative URLs for links
:* [/wiki/Special:AllPages?namespace=10 All templates]
; Using query strings
:* [?action=history History]
; Append URL parameters to the existing query string
:* [&uselang=qqx QQX]
; Using wg* variables
:* [[Special:PrefixIndex/{$wgPageName}/|Subpages]]
=== Old syntax ===
Originally, wikimarks used it's own syntax, which can be read about at w:c:wikimarks:Manual.
; A basic link
:* text = link
Link can be anything, from a page name, to a URL to a query string. This syntax is considered deprecated, but is still supported at this time.
Unfortunately, javascript: links are now unsupported. This is due to difficulties in making them compatible with the wikitext parser. However, most of their functionality can be replicated with normal wikitext or with the advanced features.
If you're still struggling to replicate the functionality of javascript: links and are a confident JavaScript programmer, the following can be used as an alternative:
; A link wrapped in a span tag
:* [[#|Click me!]]
In itself, this is not that useful. However, Wikimarks fires an event when loading is complete which can be hooked onto as follows:
mw.hook('wikimarks.loaded').add(function ($wikimarks) {
 $wikimarks.find('#mySpan').click(function (e) {
 e.preventDefault();
 alert('Hello!');
 });
});
importArticles({
 type: 'script',
 articles: [
 'u:dev:MediaWiki:Wikimarks/code.js'
 ]
});
It is recommended to import the Wikimarks script after you have declared your hook callbacks to avoid the hook being called before your event registers and therefore not allowing you to add the extra behaviour.
Category:Demo pages