{"id":16149048,"url":"https://github.com/julianmendez/wikihtml","last_synced_at":"2025-10-28T03:32:12.680Z","repository":{"id":54043970,"uuid":"38873003","full_name":"julianmendez/wikihtml","owner":"julianmendez","description":"Application in Java that converts wikitext documents into HTML documents.","archived":false,"fork":false,"pushed_at":"2024-11-20T21:40:03.000Z","size":178,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-20T09:22:36.821Z","etag":null,"topics":["converter","java","mediawiki","wiki-format","wiki-markup","wikitext"],"latest_commit_sha":null,"homepage":"https://julianmendez.github.io/wikihtml/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/julianmendez.png","metadata":{"files":{"readme":"docs/README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-10T09:38:14.000Z","updated_at":"2024-11-20T21:40:07.000Z","dependencies_parsed_at":"2024-11-01T22:33:40.597Z","dependency_job_id":"66a12a64-afaa-4815-afaa-be6d1d6709cd","html_url":"https://github.com/julianmendez/wikihtml","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianmendez%2Fwikihtml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianmendez%2Fwikihtml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianmendez%2Fwikihtml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/julianmendez%2Fwikihtml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/julianmendez","download_url":"https://codeload.github.com/julianmendez/wikihtml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238590602,"owners_count":19497350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["converter","java","mediawiki","wiki-format","wiki-markup","wikitext"],"created_at":"2024-10-10T00:36:15.573Z","updated_at":"2025-10-28T03:32:12.325Z","avatar_url":"https://github.com/julianmendez.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [WikiHTML](https://julianmendez.github.io/wikihtml/)\n\n[![build](https://github.com/julianmendez/wikihtml/workflows/Java%20CI/badge.svg)](https://github.com/julianmendez/wikihtml/actions)\n[![maven central](https://maven-badges.herokuapp.com/maven-central/de.tu-dresden.inf.lat.wikihtml/wikihtml/badge.svg)](https://search.maven.org/#search|ga|1|g%3A%22de.tu-dresden.inf.lat.wikihtml%22)\n[![license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.txt)\n[![license](https://img.shields.io/badge/license-LGPL%203.0-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0.txt)\n\n**WikiHTML** is a Java library and executable standalone application that converts a document in wiki text format to an HTML document.\n\n\n## Download\n\n* [executable JAR file](https://sourceforge.net/projects/latitude/files/wikihtml/0.1.0/wikihtml-0.1.0.jar/download)\n* [The Central Repository](https://repo1.maven.org/maven2/de/tu-dresden/inf/lat/wikihtml/)\n* as dependency:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ede.tu-dresden.inf.lat.wikihtml\u003c/groupId\u003e\n  \u003cartifactId\u003ewikihtml\u003c/artifactId\u003e\n  \u003cversion\u003e0.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\n## Use\n\nIt can be used as a Java library or from the command line. For example, use:\n\n```\njava -jar wikihtml-0.1.0.jar inputfile.text outputfile.html\n```\n\nto create a new HTML file from the command line, and use\n\n```\njava -jar wikihtml-0.1.0.jar inputoutputfile.html\n```\n\nto just update an HTML file with embedded wiki text.\n\n\n## Description\n\nWiki markup, also wikitext or wikicode, is a markup language for wiki-based pages. It is a simplified human-friendly substitute of HTML. This library reads text written in this markup language and produces an HTML document. There are several \"dialects\" of wiki markup. This library implements a subset of the language used by the [MediaWiki](https://www.mediawiki.org/wiki/MediaWiki) software.\n\nThe application generates the HTML document with the original wiki markup source code inside. Technically, the source code will be between: `\u003c!--begin_wiki_text` and `end_wiki_text--\u003e`. This allows to update an HTML file using the source in the same file.\n\nThis could be useful, for example, when maintaining documentation of a project. The files can be easily edited using a text editor, but after processing them with this library, they can be viewed with a browser.\n\nWhen using only the wiki formatting, the produced document is an [XHTML 1.1](https://www.w3.org/TR/xhtml11/) document.\n\n\n#### Sections\n\nSections are marked at the beginning of a line. The heading should be between a sequence of equals signs (=). Using more equals signs makes the heading smaller. For example:\n\n| wiki markup                   | HTML                    |\n|:------------------------------|:------------------------|\n| `= heading 1 =`               | \u003ch1\u003eheading 1\u003c/h1\u003e      |\n| `== heading 2 ==`             | \u003ch2\u003eheading 2\u003c/h2\u003e      |\n| `=== heading 3 ===`           | \u003ch3\u003eheading 3\u003c/h3\u003e      |\n| `==== heading 4 ====`         | \u003ch4\u003eheading 4\u003c/h4\u003e      |\n| `===== heading 5 =====`       | \u003ch5\u003eheading 5\u003c/h5\u003e      |\n| `====== heading 6 ======`     | \u003ch6\u003eheading 6\u003c/h6\u003e      |\n\n\n#### Line breaks\n\nA new line is marked with two new lines. For example,\n\n```\nTwo lines\ntogether\nare not considered different lines.\n```\n\nis rendered\n\n```\nTwo lines together are not considered different lines.\n```\n\nbut:\n\n```\nOne line.\n\nAnother line.\n```\n\nis rendered\n\n```\nOne line.\nAnother line.\n```\n\n\n#### Indented text\n\nText can be indented using colons (:) at the beginning of the line. For example:\n\n```\n: item 1\n: item 2\n:: item 2.1\n:: item 2.2\n::: item 2.2.1\n: item 3\n```\n\nproduces:\n\n```\n   item 1\n   item 2\n     item 2.1\n     item 2.2\n       item 2.2.1\n   item3\n```\n\n\n#### Unordered lists\n\nItems in a list are marked with asterisks (*) at the beginning of the line. A subitem is marked with more asterisks. For example:\n\n```\n* item 1\n* item 2\n** item 2.1\n** item 2.2\n*** item 2.2.1\n* item 3\n```\n\nis rendered as\n\n* item 1\n* item 2\n  * item 2.1\n  * item 2.2\n    * item 2.2.1\n* item 3\n\n\n#### Ordered lists\n\nNumbered items are marked with hash signs (#) at the beginning of the line. A subitem is marked with more hash signs. For example:\n\n```\n\n# item 1\n\n# item 2\n\n## item 2.1\n\n## item 2.2\n\n### item 2.2.1\n\n# item 3\n```\n\nis rendered as\n\n1. item 1\n2. item 2\n  1. item 2.1\n  2. item 2.2\n    1. item 2.2.1\n3. item 3\n\n\n#### Text formatting\n\nThe text can be formatted using apostrophes (') according to the following table:\n\n| wiki markup                   | HTML                    |\n|:------------------------------|:------------------------|\n| `''italics''`                 | *italics*               |\n| `'''bold'''`                  | **bold**                |\n| `'''''bold italics'''''`      | ***bold italics***      |\n\n\n#### Links\n\nLinks can be marked with square backets ([ ]). For example:\n`[https://www.wikipedia.org Wikipedia]` renders [Wikipedia](https://www.wikipedia.org).\nIf the brackets are omitted, the URI is shown directly. For example: `https://www.wikipedia.org` renders https://www.wikipedia.org .\n\nThe double square brackets ([[ ]]) are rendered as local links.\n\n\n#### Tables\n\nThis wiki text:\n\n```markdown\n{| border=\"1\"\n| 4 || 9 || 2\n|-\n| 3 || 5 || 7\n|-\n| 8 || 1 || 6\n|}\n```\n\nproduces the following table:\n\n\u003ctable boder=\"1\"\u003e\n\u003ctr\u003e\u003ctd\u003e4\u003c/td\u003e\u003ctd\u003e9\u003c/td\u003e\u003ctd\u003e2\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e3\u003c/td\u003e\u003ctd\u003e5\u003c/td\u003e\u003ctd\u003e7\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e8\u003c/td\u003e\u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e6\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\n(without the white and gray alternation of lines)\n\nThe following wiki text is not implemented in MediaWiki, but it also produces the same table:\n\n* using semicolon:\n\n```markdown\n{||; border=\"1\"\n4;9;2\n3;5;7\n8;1;6\n||}\n```\n\n* using comma:\n\n```markdown\n{||, border=\"1\"\n4,9,2\n3,5,7\n8,1,6\n||}\n```\n\n* using tabs:\n\n```markdown\n{|| border=\"1\"\n4  9  2\n3  5  7\n8  1  6\n||}\n```\n\n\n#### nowiki\n\nThe pair of tags `\u003cnowiki\u003e`...`\u003c/nowiki\u003e` is used to mark text without using the wiki formatting. For example:\n`\u003cnowiki\u003e'''\u003c/nowiki\u003enon-bold\u003cnowiki\u003e'''\u003c/nowiki\u003e` is not in bold.\n\n\n#### Variables\n\nThe following MediaWiki variables are implemented:\n\n| name                              | example          | meaning                                                                |\n|:----------------------------------|:-----------------|:-----------------------------------------------------------------------|\n|\u003ctt\u003e\u0026#x7B;{CURRENTDAY}}\u003c/tt\u003e       |    `1`              | Displays the current day in numeric form.                              |\n|\u003ctt\u003e\u0026#x7B;{CURRENTDAY2}}\u003c/tt\u003e      |    `01`            | Same as \u003ctt\u003e\u0026#x7B;{CURRENTDAY}}\u003c/tt\u003e, but with leading zero (01 .. 31). |\n|\u003ctt\u003e\u0026#x7B;{CURRENTDAYNAME}}\u003c/tt\u003e   |    `Friday`         | Name of the day in the language of the project or English.             |\n|\u003ctt\u003e\u0026#x7B;{CURRENTDOW}}\u003c/tt\u003e       |    `5`  | Same as \u003ctt\u003e\u0026#x7B;{CURRENTDAYNAME}}\u003c/tt\u003e, but as a number (0=Sunday, 1=Monday...). |\n|\u003ctt\u003e\u0026#x7B;{CURRENTMONTH}}\u003c/tt\u003e     |    `01`             | The number 01 .. 12 of the month.                                      |\n|\u003ctt\u003e\u0026#x7B;{CURRENTMONTHABBREV}}\u003c/tt\u003e| `Jan`   | Same as \u003ctt\u003e\u0026#x7B;{CURRENTMONTH}}\u003c/tt\u003e, but in abbreviated form as Jan .. Dec. |\n|\u003ctt\u003e\u0026#x7B;{CURRENTMONTHNAME}}\u003c/tt\u003e |`January` | Same as \u003ctt\u003e\u0026#x7B;{CURRENTMONTH}}\u003c/tt\u003e, but in named form January .. December. |\n|\u003ctt\u003e\u0026#x7B;{CURRENTTIME}}\u003c/tt\u003e      |    `16:03`          | The current time (00:00 .. 23:59).                                     |\n|\u003ctt\u003e\u0026#x7B;{CURRENTHOUR}}\u003c/tt\u003e      |    `16`             | The current hour (00 .. 23).                                           |\n|\u003ctt\u003e\u0026#x7B;{CURRENTWEEK}}\u003c/tt\u003e      |    `1`        | Number of the current week (1-53) according to ISO 8601 with no leading zero.|\n|\u003ctt\u003e\u0026#x7B;{CURRENTYEAR}}\u003c/tt\u003e      |    `2016`           | Returns the current year.                                              |\n|\u003ctt\u003e\u0026#x7B;{CURRENTTIMESTAMP}}\u003c/tt\u003e |    `20160101160345` | ISO 8601 time stamp                                                    |\n\nIn addition, the \u003ctt\u003e\u0026#x7B;{LOCAL...}}\u003c/tt\u003e variables are also implemented:\u003ctt\u003e\u0026#x7B;{LOCALDAY}}\u003c/tt\u003e, \u003ctt\u003e\u0026#x7B;{LOCALDAY2}}\u003c/tt\u003e, ... , \u003ctt\u003e\u0026#x7B;{LOCALTIMESTAMP}}\u003c/tt\u003e. For example, in UTC+1 \u003ctt\u003e\u0026#x7B;{CURRENTTIMESTAMP}}\u003c/tt\u003e returns `20160101160345`, while \u003ctt\u003e\u0026#x7B;{LOCALTIMESTAMP}}\u003c/tt\u003e returns `20160101170345`.\n\n\n#### HTML\n\nHTML code can also be inserted directly. For example:\n`\u003cb\u003ebold\u003c/b\u003e` is the same as `'''bold'''`, and `\u0026lambda;` is rendered \u0026lambda;.\n\n\n## Example\n\nThe file [mupuzzle.text](https://github.com/julianmendez/wikihtml/blob/master/wikihtml/src/test/resources/mupuzzle.text) has the following wiki text:\n\n```\n== MIU system  ==\n(see [https://en.wikipedia.org/wiki/MU_puzzle MU puzzle])\n\n\n# ''x''I \u0026rarr; ''x''IU\n\n# M''x'' \u0026rarr; M''xx''\n\n# ''x''III''y'' \u0026rarr; ''x''U''y''\n\n# ''x''UU''y'' \u0026rarr; ''xy''\n```\n\nand is translated to the following HTML document:\n\n```html\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003c!--begin_wiki_text\n== MIU system  ==\n(see [https://en.wikipedia.org/wiki/MU_puzzle MU puzzle])\n\n\n# ''x''I \u0026rarr; ''x''IU\n\n# M''x'' \u0026rarr; M''xx''\n\n# ''x''III''y'' \u0026rarr; ''x''U''y''\n\n# ''x''UU''y'' \u0026rarr; ''xy''\n\nend_wiki_text--\u003e\n\n\u003c!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"https://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"\u003e\n\n\u003chtml xmlns=\"https://www.w3.org/1999/xhtml\" lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /\u003e\n  \u003ctitle\u003e\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cdiv\u003e\n\n\u003ch2\u003e MIU system  \u003c/h2\u003e\n (see \u003ca href=\"https://en.wikipedia.org/wiki/MU_puzzle\"\u003eMU puzzle\u003c/a\u003e)\u003cbr /\u003e\n\n\u003col\u003e\n\u003cli\u003e \u003ci\u003ex\u003c/i\u003eI \u0026rarr; \u003ci\u003ex\u003c/i\u003eIU\u003c/li\u003e\n\u003cli\u003e M\u003ci\u003ex\u003c/i\u003e \u0026rarr; M\u003ci\u003exx\u003c/i\u003e\u003c/li\u003e\n\u003cli\u003e \u003ci\u003ex\u003c/i\u003eIII\u003ci\u003ey\u003c/i\u003e \u0026rarr; \u003ci\u003ex\u003c/i\u003eU\u003ci\u003ey\u003c/i\u003e \u003c/li\u003e\n\u003cli\u003e \u003ci\u003ex\u003c/i\u003eUU\u003ci\u003ey\u003c/i\u003e \u0026rarr; \u003ci\u003exy\u003c/i\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\u003cbr /\u003e\n\n  \u003c/div\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nThe file [example.text](https://github.com/julianmendez/wikihtml/blob/master/wikihtml/src/test/resources/example.text) has more examples.\n\n\n## Source code\n\nTo checkout and compile the project, use:\n\n```\n$ git clone https://github.com/julianmendez/wikihtml.git\n$ cd wikihtml\n$ mvn clean install\n```\n\nThe created executable library, its sources, and its Javadoc will be in `wikihtml/target`.\n\nTo compile the project offline, first download the dependencies:\n\n```\n$ mvn dependency:go-offline\n```\n\nand once offline, use:\n\n```\n$ mvn --offline clean install\n```\n\nThe bundles uploaded to [Sonatype](https://oss.sonatype.org/) are created with:\n\n```\n$ mvn clean install -DperformRelease=true\n```\n\nand then:\n\n```\n$ cd wikihtml/target\n$ jar -cf bundle.jar wikihtml-*\n```\n\nThe version number is updated with:\n\n```\n$ mvn versions:set -DnewVersion=NEW_VERSION\n```\n\nwhere *NEW_VERSION* is the new version.\n\n\n## Architecture\n\nThe library reads a wiki text and creates a `WikiDocument`.\nIt extracts the wiki text from the given input and processes it line by line.\n\nEach line is transformed into a `ConversionToken`. Each token is processed by a pipeline of objects where each one is a `Renderer`. Each renderer (`-Renderer`) processes each conversion token producing a list of conversion tokens. These are the input for the next renderer, if any. Some renderers are parameterized and grouped (`-GroupRenderer`). Some renderers process whole lines (in package `...line`) and some renderers process pieces of lines (in package `...part`).\n\nFor example, all variables are processed by `...part.DateVariableRenderer`, but the headings are processed by a group of renderers (`...line.HeadingGroupRenderer`) composed by 6 renderers (h1, h2, ..., h6), where each one is a `...line.HeadingRenderer`.\n\n\n## Author\n\n[Julian Mendez](https://julianmendez.github.io)\n\n\n## Licenses\n\n[Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt), [GNU Lesser General Public License version 3](https://www.gnu.org/licenses/lgpl-3.0.txt)\n\n\n## Release notes\n\nSee [release notes](https://julianmendez.github.io/wikihtml/RELEASE-NOTES.html).\n\n\n## Contact\n\nIn case you need more information, please contact @julianmendez .\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulianmendez%2Fwikihtml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjulianmendez%2Fwikihtml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjulianmendez%2Fwikihtml/lists"}