Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting wiki format to XHTML

Tags:

php

xhtml

wiki

I have a database storing "wiki formatted" text which I would like to display in XHTML using PHP.

Here is an example output with all the wiki markup:

Default text
== Heading 1 ==
=== Heading 2 ===
==== Heading 3 ====
===== Heading 4 =====
====== Heading 5 ======
'''Bold'''
''Italic''
<s>Strikethrough</s>

* List item 1
* List item 2

# Numbered item 1
# Numbered item 2

[[Image:http://domain.com/image.png|Image name]]

[http://google.com Link text goes here]

> Blockquote

<source lang="language">Source code</source>

Is that fairly standard wiki syntax? Is there a fairly standard way of interpreting it with PHP?

Thanks in advance!

like image 507
Al. Avatar asked Dec 29 '25 22:12

Al.


2 Answers

I would say that the most standard wiki-like format around today is markdown. There are libraries available for almost any platform, including PHP.

like image 53
troelskn Avatar answered Dec 31 '25 13:12

troelskn


MediaWiki is written in PHP and licensed under GPL. So you just could take the WikiText converter and use it.

like image 45
Gumbo Avatar answered Dec 31 '25 12:12

Gumbo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!