bharley / mw-markdown Goto Github PK
View Code? Open in Web Editor NEWMediaWiki Markdown extension
License: MIT License
MediaWiki Markdown extension
License: MIT License
Normal wiki text internal links are like this
[[name of page]]
And they either create a new page or link automatically to the page, while markdown links look like this:
[text in the link](url goes here)
If this plugin allows the parser to use markdown, then how does it handle internal links? Do you have to write out the url for the page etc?
Hello
Since the update to MW 1.35, I have this error :
[7f97b81e8eee35691a6d95e4] /index.php?title=Impression_3D Error from line 110 of /stockage/www/wiki/extensions/Markdown/Markdown.php: Call to undefined method Parser::doDoubleUnderscore()
(full log at the end of this message).
I also reproduced it with the mediawiki Docker. I use MW 1.35, fresh install with only Markdown extension. When disabling this extension, MW works fine.
[7f97b81e8eee35691a6d95e4] /index.php?title=Impression_3D Error from line 110 of /stockage/www/wiki/extensions/Markdown/Markdown.php: Call to undefined method Parser::doDoubleUnderscore()
Backtrace:
#0 /stockage/www/wiki/extensions/Markdown/Markdown.php(85): MarkdownExtension::parseMarkdown(Parser, string)
#1 /stockage/www/wiki/includes/HookContainer/HookContainer.php(320): MarkdownExtension::onParserBeforeInternalParse(Parser, string, StripState)
#2 /stockage/www/wiki/includes/HookContainer/HookContainer.php(131): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#3 /stockage/www/wiki/includes/HookContainer/HookRunner.php(2901): MediaWiki\HookContainer\HookContainer->run(string, array)
#4 /stockage/www/wiki/includes/parser/Parser.php(1539): MediaWiki\HookContainer\HookRunner->onParserBeforeInternalParse(Parser, string, StripState)
#5 /stockage/www/wiki/includes/parser/Parser.php(651): Parser->internalParse(string)
#6 /stockage/www/wiki/includes/content/WikitextContent.php(374): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#7 /stockage/www/wiki/includes/content/AbstractContent.php(590): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#8 /stockage/www/wiki/includes/Revision/RenderedRevision.php(263): AbstractContent->getParserOutput(Title, integer, ParserOptions, boolean)
#9 /stockage/www/wiki/includes/Revision/RenderedRevision.php(235): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#10 /stockage/www/wiki/includes/Revision/RevisionRenderer.php(215): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string)
#11 /stockage/www/wiki/includes/Revision/RevisionRenderer.php(152): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#12 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#13 /stockage/www/wiki/includes/Revision/RenderedRevision.php(197): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#14 /stockage/www/wiki/includes/poolcounter/PoolWorkArticleView.php(216): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#15 /stockage/www/wiki/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#16 /stockage/www/wiki/includes/page/Article.php(810): PoolCounterWork->execute()
#17 /stockage/www/wiki/includes/actions/ViewAction.php(74): Article->view()
#18 /stockage/www/wiki/includes/MediaWiki.php(527): ViewAction->show()
#19 /stockage/www/wiki/includes/MediaWiki.php(313): MediaWiki->performAction(Article, Title)
#20 /stockage/www/wiki/includes/MediaWiki.php(940): MediaWiki->performRequest()
#21 /stockage/www/wiki/includes/MediaWiki.php(543): MediaWiki->main()
#22 /stockage/www/wiki/index.php(53): MediaWiki->run()
#23 /stockage/www/wiki/index.php(46): wfIndexMain()
#24 {main}
I've seen such messages in a few other places on my wiki as well.
<pre>
, <math>
don't seem to work.
The edit toolbar always inserts wiki markup, and this isn't very useful if Markdown is the primary article syntax being used.
Either add an option to remove the toolbar or modify it so that it can handle Markdown syntax.
For some extensions, I end up with UNIQ-QINU
problems.
For example, using the Labeled Section Transclusion or Simple Calendar, the parser output looks like this:
�'"UNIQ--section-00000002-QINU"'� Labeled Section Transclusion section tag �'"UNIQ--section-00000003-QINU"'�
�'"UNIQ--item-4--QINU"'� SimpleCalendar should have appeared here
After much digging, I found what might be a solution. I changed line 116 from replaceVariables
to recursivePreprocess
instead. I've tested this on a few of my private wiki's pages and haven't seen a downside to using this method instead.
Per the MediaWiki source code, the recursivePreprocess
calls replaceVariables
itself, so it should hopefully(!) Just Work...
The <nowiki>
tag doesn't quite function correctly with this extension active, in particular when used with the mediawiki links syntax.
An example of the problem is shown on the Special:Upload page. Instead of seeing the correct markup help, I see this:
When we should be seeing:
[[File:File.jpg]]
to use the full version of the fileetc
This seems to be because Markdown.php calls $parser->replaceInternalLinks($html)
without any attempt to escape things that are inside a <nowiki>
tag.
Ideally I'd like to escape <nowiki>
content before processing these links, but I can't find any simple function to call in the parser to make this happen 😞
I'd love to help fix this up if anyone has any ideas about where to start.
I try to integrate Markdown extension with MediaWiki but it does not work.
I have MediaWiki 1.35.2 and php 7.4.3.
When I use {{MARKDOWN}} in page I see this error:
"mediawiki/extensions/Markdown/Markdown.php: Call to undefined method Parser::doDoubleUnderscore()"
Extension is unable to find WikiMedia parser so all available functions on parser become undefined.
After installing and requiring the plugin, I got an MWException. This is the exception message:
Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook MarkdownExtension::onBeforePageDisplay failed to return a value; should return true to continue hook processing or false to abort.' in /srv/http/mediawiki/includes/Hooks.php:284
I'm using mediawiki-1.21.2
With Markdown rendering active I get this:
instead of this:
The markup in the first example (Markdown active) looks like this:
<p>The Sun is pretty big.</p><p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup></p><p> The Moon, however, is not so big.</p><p><sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[2]</a></sup></p><p class="mw-empty-elt"></p>
but the markup should look like this:
The Sun is pretty big.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[1]</a></sup> The Moon, however, is not so big.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3">[2]</a></sup>
Per better practices, you should use composer to bring in erusev/parsedown from https://packagist.org/packages/erusev/parsedown and erusev/parsedown-extra from https://packagist.org/packages/erusev/parsedown-extra
When I include {{WIKI}}
in a template, it renders correctly on the template page itself, but it literally says "{{WIKI}}" on any pages that include the template.
Using this on a mediawiki can cause problems because of both legacy content and the Special:: pages. However, it should be possible to analyze the content of a page and determien if it is in mediawiki markup or in markdown by counting the number of headlines that match each headline format. Then it would be possible to dispense with the {{WIKI}} tag.
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.