kuenzign / WikiMarkdown

MediaWiki extension that allows for markdown syntax to be used on wiki pages
https://www.mediawiki.org/wiki/Extension:WikiMarkdown
MIT License
12 stars 11 forks source link

does this work with parsedown packages or is composer required? #12

Open sascha-wi opened 1 year ago

sascha-wi commented 1 year ago

See title, I am looking to use markdown on our mediawiki instance. But I don't want to install unnecessary libraries which come with composer. So is it possible to install this extension with the use of php-parsedown package e.g. for debian?

kuenzign commented 1 year ago

I've never tried using anything other than composer. You are welcome to try using alternative methods of installing the dependencies needed for this extension, but I can't guarantee they will work.

sascha-wi commented 1 year ago

Hm thats sad to hear, esp. since under requirements on this page its nowhere mentioned that composer is required. Also its mentioned that you could install the parsedown "manually" so I assumed that would be possible.

Also the install instructions here https://www.mediawiki.org/wiki/Extension:WikiMarkdown#Configuration are different from whats shown on this github I am not sure where the discrepancy stems from.

kuenzign commented 1 year ago

I'm sure that as long as you have parsedown installed and the extension is able to access it, you will be able to use it, but I've not personally tried that as composer is the preferred method.

sascha-wi commented 1 year ago

Still I am not sure the installation instructions on this github are leading anywhere? By following them I would simple install the parsedown package from my repos and add wfLoadExtension( 'WikiMarkdown' ); to LocalSettings.php Which probably isn't enough to make this extension work. The previously linked wiki page at least mentions cloning this repo...

kuenzign commented 1 year ago

You need to download the files for this repo and put them into a folder in your extensions folder for your server just like any other extension install. The instructions on the wiki page are just more complete.

sascha-wi commented 1 year ago

So for debian there is only one php-parsedown package, I think extended and extra are part of backports, so we will not use them for now. I get this 2023-05-15_10-50 content drop down when editing pages but when entering any markdown syntax its not showing up. When using tags on the source code it throws this error when trying to save. 2023-05-15_10-52

kuenzign commented 1 year ago

Are you able to use the wikitext editor instead of the visual editor to add <markdown> tags? That would help narrow down where your issue might be.

sascha-wi commented 1 year ago

I assume you are referring to the source editor? That is the one I used in the previous comment, where I received the Internal error. 2023-05-15_15-55

kuenzign commented 1 year ago

Okay, then can you add $wgShowExceptionDetails = true; to your LocalSettings.php and see if that provides a better error message to diagnose the issue?

sascha-wi commented 1 year ago

`[0cdca3b43efdd41cbe61ea28] /index.php?title=IT:Abteilungsbesprechung_20230427&action=submit Error from line 330 of /var/www/bla.org/extensions/WikiMarkdown/includes/WikiMarkdown.php: Class 'Parsedown' not found

Backtrace:

0 /var/www/bla.org/extensions/WikiMarkdown/includes/WikiMarkdown.php(215): WikiMarkdown::getParsedown()

1 /var/www/bla.org/extensions/WikiMarkdown/includes/WikiMarkdown.php(46): WikiMarkdown::parseMarkdown()

2 /var/www/bla.org/includes/parser/Parser.php(3922): WikiMarkdown::parserHook()

3 /var/www/bla.org/includes/parser/PPFrame_Hash.php(330): Parser->extensionSubstitution()

4 /var/www/bla.org/includes/parser/Parser.php(2887): PPFrame_Hash->expand()

5 /var/www/bla.org/includes/parser/Parser.php(1556): Parser->replaceVariables()

6 /var/www/bla.org/includes/parser/Parser.php(651): Parser->internalParse()

7 /var/www/bla.org/includes/content/WikitextContent.php(374): Parser->parse()

8 /var/www/bla.org/includes/content/AbstractContent.php(590): WikitextContent->fillParserOutput()

9 /var/www/bla.org/includes/EditPage.php(4282): AbstractContent->getParserOutput()

10 /var/www/bla.org/includes/EditPage.php(4187): EditPage->doPreviewParse()

11 /var/www/bla.org/includes/EditPage.php(2965): EditPage->getPreviewText()

12 /var/www/bla.org/includes/EditPage.php(701): EditPage->showEditForm()

13 /var/www/bla.org/includes/actions/EditAction.php(71): EditPage->edit()

14 /var/www/bla.org/includes/actions/SubmitAction.php(38): EditAction->show()

15 /var/www/bla.org/includes/MediaWiki.php(527): SubmitAction->show()

16 /var/www/bla.org/includes/MediaWiki.php(313): MediaWiki->performAction()

17 /var/www/bla.org/includes/MediaWiki.php(940): MediaWiki->performRequest()

18 /var/www/bla.org/includes/MediaWiki.php(543): MediaWiki->main()

19 /var/www/bla.org/index.php(53): MediaWiki->run()

20 /var/www/bla.org/index.php(46): wfIndexMain()

21 {main}`

I guess the php-parsedown package is not working?

kuenzign commented 1 year ago

Yes that is indeed the case. I'm not certain what it would take to get MediaWiki to be able to access Parsedown via php-parsedown. Composer works well, but if you don't want to use that then I'm not certain what you need to do.

mjsir911 commented 9 months ago

btw, this is kind of a kludge but does work for me to get things running without composer:

in localsettings.php

require_once("<parsedown path>/Parsedown.php");
sascha-wi commented 2 weeks ago

kludge

Can you elaborate why you describe this solution as a such? I haven't tried it yet, but really would like to get markdown running for our mediawiki without composer.