mike42 / wikitext Goto Github PK
View Code? Open in Web Editor NEWMediaWiki-style wikitext parser and HTML generator
Home Page: https://mike42.me/wikitext/
License: MIT License
MediaWiki-style wikitext parser and HTML generator
Home Page: https://mike42.me/wikitext/
License: MIT License
Mixing list types does not work correctly. Example:
# order
# order
#* point below
# order
#: definition term
# order
A minimal example is:
[[foo=bar]]
Discovered with the following markup, with a backend which expands "ex:".
{{ex:113} {{ex:122}} {{ex:119}}
Detail: This causes it to look for a template called "ex:113} {{ex:122", which is bogus, so the custom getTemplateMarkup("ex:113} {{ex:122") returns "[[ex:113} {{ex:122]]". From here, the template on the right is expanded and returns HTML markup. The markup contains '=', so is treated as variable-argument (like [[image:foo|width=2em]]), and the back-end attempts to render this:
[[ex:113} <whatever class="...">...</whatever>]]
Triggering the PHP warning:
Notice: Undefined offset: 0 in WikitextParser.php on line 905
This element is not currently supported.
Example from http://www.mediawiki.org/wiki/Help:Tables
{|
|+Food complements
|-
|Orange
|Apple
|-
|Bread
|Pie
|-
|Butter
|Ice cream
|}
This will not render correctly with this parser, due to the table caption.
Example of this causing problems:
Beeble:
* Foo
** Bar
<!-- Baz -->
** Quux
The comment is rendered in its own paragraph (like 'Beeble' is), and this produces two list structures, rather than one.
An unclosed external link causes:
Fatal error: Call to undefined method (backend class)::processArgs() in /home/mike/workspace/samoan/vendor/wikitext/WikitextParser.php on line 414
Documented here
MediaWiki does not put line breaks between items written on separate lines. This will be replaced with a space instead.
Because the parser checks for close-tags before it checks for new open-tags, this sequence will render as if the italics were closed originally:
normal text ''italic text '''bold inner text''' still italic '' back to normal
Tags need to be evaluated in descending order of length, regardless of whether they are open or close tags.
As a developer who wants to use this package
I want to include it as a Composer dependency
So that it works like all the other libraries out there.
--
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.