A simple way to maintain a personal wiki in Sublime Text 2.
This extension isn't designed to replace wikipedia, or even go on the web at all. This is a flat-file, no-nesting, no-nonsense system designed purely to give you (well, me) a place to catch fleeting thoughts and turn them into something useful. To keep it as fiddle-proof as possible, the list of features is intentionally kept very small.
In other words, It's job is to let you maintain a personal wiki without spending too much time on it. Thanks to Andy Hunt for the inspiration. If you haven't yet, I strongly recommend you read Pragmatic Thinking and Learning for more excellent tips on how to really use your brain.
##How It Works
- Create a directory where you want to keep all your files. I recommend setting this up in DropBox or some similar service so it auto-syncs across your computers.
- in Sublime Text, Add your new Personal Wiki folder to a project and save that project. There! That doesn't do much, but it does make your sidebar list all your wiki pages for you.
- Create a file with a name like
MainIndex.wiki
in that directory. The name isn't important, the extension is. Write some stuff in that file, and make sure to put in someWikiWords
. - Any
WikiWords
(i.e. UpperCamelCase) will be converted to internal links.- By default,
Ctrl+F11
orCtrl+Enter
are the keystrokes to folow a link.- Hyperlinks now open in your default browser and email links open in your default mail client. (thank you to stadja for getting that working! )
- If a file doesn't exist, you'll be given a new buffer with the default text for a new page.
- if the file does exist it's opened. Yeah.
- By default,
- This system is sparse by design. There are only a few things that get marked:
- WikiLinks
- These are identified as
markup.underline.internal.link.Wiki
. You may need to add style rules to your favorite theme to have it render.
- These are identified as
- Email Links
- Identified as
string.quoted.link.email.Wiki
- Identified as
- Web Links (i.e.
Http://
orftp://
links)- Identified as
string.quoted.link.external.Wiki
- Identified as
- Markdown-style
**bold** __markings__
are used.- Identified as
markup.bold.Wiki
- Identified as
- For that matter, Markdown-esque
_italic_ *strings*
are also supported.- Identified as
markup.italic.Wiki
- Identified as
- "Double Quoted Strings"
- Identified as
string.quoted.double.Wiki
- Identified as
- WikiLinks
##If Things Aren't Getting Highlighted
It's very possible that your favorite theme doesn't define styles for markup.bold
, markup.italic
, or even markup.underline.internal.link
(although most themes catch that one, because it has link
in it.)
If this is the case you can edit your theme file pretty easily, and I've included a snippet to make it even easier.
All themes are stored as .tmTheme
files, which are really just .plist
files that have been renamed, which are really just .xml
files.
ANYWAY
To add style rules for bold and italic wiki text to your favorite theme simply follow these steps:
- Open
/Packages/favoriteTheme/favoriteTheme.tmTheme
in Sublime Text 2. - Do a quick search for
markup.italic
ormarkup.bold
and make sure it's not there. - Inside the
<array>
element place your cursor between the closing tag of one<dict>
element and the opening tag of the next. - Type
dict{enter}
and the snippet should pop up. - Type "bold" (or italic) into the first completion slot. Watch the fancy joy of snippets that re-use one variable.
- Note that one place where your bold or italic choice gets used is the
<fontStyle>
element. Make sure you're typing something that actually is a font style here. If you stick with bold or italic you should be fine.
- Note that one place where your bold or italic choice gets used is the
- Hit tab to go to the color slot. This is where you decide what color works for you, and it has to be in hex.
- Save the file and restart ST2.
Now all your **bold**
(or __bold__
) text should be bold and all your _italic_
(or *italic*
) text should be slanty. It's just that easy.
##How You Could Help
- I would like to make the WikiWords linker more robust, and possibly find a way to have it identify (and therefore highlight) any words that are the names of other pages in the directory, so that you could use any word as a keyword, á la Tomboy.
- There's something wrong with my regex for checking
_italic_
links. They work everywhere but at the beginning of the line. I'm too lazy to figure it out myself right now, but anyone who wants to fix it would have my undying gratitude. For at least twenty minutes. :)