WTF Engine (Wiki Text Formatting Engine)

WTF Engine is a multi language, multi platform engine for converting simple to read and understand text formatting codes into html. It is based on the same formatting commands commonly used on popular wiki platforms. Specifically, the bulk of the syntax is derived directly from the php wiki engine.

It is important to note that this is not a wiki, but is a "text formatting engine". A set of programming routines that can be embedded into other projects to provide a consistent, user friendly markup that provides basic document formatting. A good example would be a message/discussion board. Allowing HTML often presents security risks, so using WTF provides a good compromise.

Status: Planning/Prototyping

The current status of this project is in planning phase. There is already a working prototype of the WTF-Engine written in PHP. It has a few deficiencies, however I'd like to get community feedback before performing too much additional work on this.

I need your help!

If you have an opinion in this matter, or if you are a regular expression wiz in any programming language, or if you would like to help port the WTF-Engine to your favorite programming language, I can use your help. Please contact me.

Tentative Schedule

The first step is to standardize and agree on the acceptable markup. This will probably be done in two phases, phase 1, which should produce a version 1.0 project will be introducing the core syntax, outlined below. Phase 2 will be to introduce code for optional extended syntax, for example the use of emote-icons, stylized blocks and etc. Keep in mind that one major design goal is to keep the syntax *very* simple.

Step 2 will be to create the program flow that should be followed when writing the wtf-engine in it's various languages. Some languages are very different from one another, but the general program flow should be consistent no matter what language you use.

Step 3 will be to create the regular expressions. I realize that this will not work for all languages. PHP, PERL, C++ all provide "Perl compatible regular expressions" which are not exactly the same in other platforms. However we should be able to help those porters out by providing working examples in PCRE.

Step 4 is to work on the actual programming. Of course this will have already begun to some extent. I believe once steps 1-3 are done, porting the engine will be quite easy. Here's the order I suggest for the porting to be done:

Step 5 is to create useful examples in each programming language. The goal will be to create useful, simple examples that are well written in easily understood code that can be repurposed with little effort. This leads into licensing which is discussed in the next section. One note about examples, my current employer is designing a commercial content management system (CMS), so out of respect, I ask that none of the examples be a CMS.

License and Related Concerns

WTF-Engine will be released under the BSD license. None of the code in the first prototype has been taken from any other software. It is important that any code contributed to this project be "free" of any licensing encumbrances that restrict it's use outside of the BSD license. This means no GPL code can be contained in this package.

The BSD license is being used because it is one of the least restrictive licenses available. Realize that it allows code to be incorporated into both commercial and non-commercial software, both open and closed source. I encourage that anyone who uses WTF-Engine and adds to it release their changes back to the project, but I don't require it.

Suggested Syntax of WTF Markup

This is the part you've been waiting for, I'm sure. Here is the proposed syntax as it stands at the moment:

Multi-line elements:
Bulleted List: first character of line must be *
Numbered List: first character of line must be #
Multiple * and # allow nesting of lists.
Pre: first character of line must be a space
Complete line elements:
Heading 1: Begin line with !
Heading 2: Begin line with !!
Heading 3: Begin line with !!!
Horizontal Rule: Begin line with ---- (four hyphens)
Formatting elements:
Bold: begin and end bold text with __ ie: __this is bold__
Italic: begin and end italicized text with .. (two apostrophes) ie: ..this is italicized..
Superscript: begin and end superscript text with ^^ (two carats) ie: X^^2^^ means X squared
Subscript: begin and end subscript text with ~~ (two tildes) ie O~~2~~ means oxygen molecule
Simple link: Insert complete url prefixed with either http://, https://, ftp:// or mailto:
Link with alternate text: [link text|url] where url is assumed to be complete relative or absolute link.
Link with alternate text and alternate target: [link text|_blank|url] where _blank can be a window reference, or one of _blank, _self, _top, _parent
Inline image: image url encased in [ ] ie: [/images/myimage.jpg]
Anchor targets: encase a unique number in [ ] ie: [1], [2], [3]
Anchor link: prefix anchor number with # inside [ ] ie: [#1], [#2], [#3]
Anchor to top of page: encase # in [ ] ie: [#]
WikiLink: String mixed case words together to create a relative hyperlink to that document. Ie: HomePage creates link: <a href=.HomePage.>HomePage</a>. The API should support a standard WikiLinkPrefix that will be prepended to the WikiLink so that if WikiLinkPrefix is ./wiki/index.php?. then the HomePage link would actually produce <a href=./wiki/index.php?HomePage.>HomePage</a>

More Information

I realize that this is not the best website, I hope to fix that very soon by replacing it with a version that uses the WTF-Engine prototype. In the meantime, please use the excellent SourceForge utilities to contact me. Here's a link to the SF project page: .

SourceForge Logo