Extension talk:WikiMarkdown

About this board

Way to set parsedown's $permitRawHtml = True?

2
99.192.96.81 (talkcontribs)

I use a mediawiki for internal docs... single user/not public url... so I want to allow html to remain (and be processed as such) inside of <markdown> tags.

I don't want to edit the string in parsedown.php, and would rather handle this in localsettings.php.

I can't seem to find a config/setting to handle this

Kuenzign (talkcontribs)

I don't think that will do what you think it will do. I have no plans to make that a feature of this extension.

Reply to "Way to set parsedown's $permitRawHtml = True?"
Masin Al-Dujaili (WMDE) (talkcontribs)
Kuenzign (talkcontribs)

No, this is not currently possible.

Reply to "Internal links"

Parsedown Extended error

4
S0ring (talkcontribs)

When LocalSettings.php allows usage of Parsedown Extended:

wfLoadExtension( 'WikiMarkdown' );

$wgAllowMarkdownExtra = true; // allows usage of Parsedown Extra

$wgAllowMarkdownExtended = true; // allows usage of Parsedown Extended


the following error occurs:

InvalidArgumentException: Sub-setting 'single_dollar' does not exist in 'math'.

Backtrace:

from /var/www/html/vendor/benjaminhoegh/parsedown-extended/src/ParsedownExtended.php(250)

#0 /var/www/html/vendor/benjaminhoegh/parsedown-extended/src/ParsedownExtended.php(190): ParsedownExtended->initializeSettings(array)

#1 /var/www/html/extensions/WikiMarkdown/includes/WikiMarkdown.php(327): ParsedownExtended->__construct(array)

#2 /var/www/html/extensions/WikiMarkdown/includes/WikiMarkdown.php(215): WikiMarkdown::getParsedown()

#3 /var/www/html/extensions/WikiMarkdown/includes/WikiMarkdown.php(46): WikiMarkdown::parseMarkdown(string, array)

#4 /var/www/html/includes/parser/Parser.php(4019): WikiMarkdown::parserHook(string, array, Parser, PPFrame_Hash)

#5 /var/www/html/includes/parser/PPFrame_Hash.php(353): Parser->extensionSubstitution(array, PPFrame_Hash, boolean)

#6 /var/www/html/includes/parser/Parser.php(2953): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)

#7 /var/www/html/includes/parser/Parser.php(1609): Parser->replaceVariables(string)

#8 /var/www/html/includes/parser/Parser.php(723): Parser->internalParse(string)

#9 /var/www/html/includes/content/WikitextContentHandler.php(301): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)

#10 /var/www/html/includes/content/ContentHandler.php(1721): WikitextContentHandler->fillParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams, ParserOutput)

#11 /var/www/html/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams)

#12 /var/www/html/includes/EditPage.php(4535): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(WikitextContent, Title, NULL, ParserOptions)

#13 /var/www/html/includes/EditPage.php(4438): EditPage->doPreviewParse(WikitextContent)

#14 /var/www/html/includes/EditPage.php(3144): EditPage->getPreviewText()

#15 /var/www/html/includes/EditPage.php(779): EditPage->showEditForm()

#16 /var/www/html/includes/actions/EditAction.php(73): EditPage->edit()

#17 /var/www/html/includes/actions/SubmitAction.php(38): EditAction->show()

#18 /var/www/html/includes/MediaWiki.php(542): SubmitAction->show()

#19 /var/www/html/includes/MediaWiki.php(322): MediaWiki->performAction(Article, Title)

#20 /var/www/html/includes/MediaWiki.php(904): MediaWiki->performRequest()

#21 /var/www/html/includes/MediaWiki.php(562): MediaWiki->main()

#22 /var/www/html/index.php(50): MediaWiki->run()

#23 /var/www/html/index.php(46): wfIndexMain()

#24 {main}


Setting single_dollar to true or false doesn't fix the error

$wgParsedownExtendedParameters = [

           'math' => [

               'single_dollar' => true

           ],

           'sup' => true,

           'sub' => true

       ];

Kuenzign (talkcontribs)

What version of Parsedown Extended are you using?

Kuenzign (talkcontribs)

It looks like Parsedown Extended 1.2+ completely changes the configs. Please try downgrading to version 1.1.2 of Parsedown Extended.

99.192.96.81 (talkcontribs)

This worked perfectly, thank you!

Reply to "Parsedown Extended error"
AraAraSayonaraReal (talkcontribs)
  1. It is not working in docker, it breaks VisualEditor,User menu, notification button, etc.
  2. I tried running `composer install --no-dev` in its folder, got error that it needs php 7.0 which i fixed by running `composer config platform.php 7.0` then 7.2 then 7.2.9. After that it runs install command even on 8.1.29 BUT throws ' Error: Class "ParsedownExtended" not found' even though i am not using extended config
99.192.96.81 (talkcontribs)

Did you get this working? I just upgraded a mediawiki, and getting the same issues with this.

Reply to "Not working in docker"

Is it possible to use MediaWiki's table of contents?

2
2601:644:8B00:1EC0:40BC:FD69:62AC:1E08 (talkcontribs)

If I include a Markdown with multiple levels of headers (e.g. `#`, `##`...), the headers do not appear in MediaWiki's automatically generated table of contents (only those headers defined outside the `<markdown>` tags appear).

Is it possible to also include headers inside the Markdown using this extension? There's the `toc` option in Parsdown Extended but that generates a TOC inline at the top of the page which is separate from the regular MediaWiki table of contents.

Kuenzign (talkcontribs)

No, sadly this is not currently possible. To my knowledge, making changes to a page's ToC would require modifications to the core MediaWiki software.

Reply to "Is it possible to use MediaWiki's table of contents?"

How to use if you can't run composer?

3
MrStonedOne (talkcontribs)

Is there a zip with the included dependencies on the github? most extensions have releases with everything needed to run it in a .zip. in fact thats how the mediawiki releases work.

Cavila (talkcontribs)

I'm afraid that Composer is used so it can install dependencies in the vendor directory and update logs, which is not always something you can do by hand. An approach you could try is to run Composer on a local copy of your MediaWiki files inside something like Docker. Some people without access to a CLI have managed to run Composer from a PHP file, but I'm not sure how practical that would be.

MrStonedOne (talkcontribs)

I was able to fork the repo and make a github action that just runs composer and compiles up a .zip as a artifact.

I was able to just add "load_composer_autoloader": true, to the extension json and the .zip just worked no issue.


Somebody working on the repo with more time and experience with github actions than me could automate releases that do this for all supported php versions (which seems to just be 7.4 because all the other ones errored out) and then installation wouldn't require a cli at all!

Reply to "How to use if you can't run composer?"

SyntaxHighlight error

4
195.77.243.20 (talkcontribs)

I have "SyntaxHighlight" extension installed and it works fine with Wikitext, but when I edit in markdown mode like this:


```python

python code here

```


System throws this error:

[015b401c65ab6b87b21ccd91] /index.php?title=Azala Error: Class "SyntaxHighlight" not found

Backtrace:

from /home/projects/wiki/extensions/WikiMarkdown/includes/WikiMarkdown.php(102) #0 [internal function]: WikiMarkdown::{closure}()

#1 /home/projects/wiki/extensions/WikiMarkdown/includes/WikiMarkdown.php(104): preg_replace_callback()

#2 /home/projects/wiki/includes/parser/Parser.php(3996): WikiMarkdown::parserHook()

...

my LocalSettings:

# highlight

wfLoadExtension('SyntaxHighlight');

# markdown

wfLoadExtension('WikiMarkdown');

$wgAllowMarkdownExtra    = true; // allows usage of Parsedown Extra

$wgAllowMarkdownExtended = true; // allows usage of Parsedown Extended

$wgSyntaxHighlightLanguageCodeMap['markdown'] = 'markdown';

Kuenzign (talkcontribs)

What version of SyntaxHighlight do you have installed?

195.77.243.20 (talkcontribs)

SyntaxHighlight_GeSHi: REL1_40

2023-09-28T07:23:27

d0cf937

@Kuenzign

Kuenzign (talkcontribs)

It seems that on versions of SyntaxHighlight 1.39+, they put everything in a namespace. As a workaround for the time being, you can change line 102 of WikiMarkdown/includes/WikiMarkdown.php to be this instead:

return MediaWiki\SyntaxHighlight\SyntaxHighlight::parserHook( html_entity_decode( $matches[3] ), $args, $parser );
Reply to "SyntaxHighlight error"
Dakster86 (talkcontribs)

I can't seem to get internal (to the wiki) links to work in blocks of markdown.

If I include a mediawiki-formatted internal link, e.g., [[TestPage]] inside of the <markdown> ... </markdown> tags, it doesn't get formatted as a link but just appears as "TestPage".

Is there a way to have internal links within the markdown blocks?

Kuenzign (talkcontribs)

No, there is not currently a way to do internal links as the linking is handled by Parsedown.

Dakster86 (talkcontribs)

Got it; thanks for getting back to me!

Reply to "Internal Links?"
2001:250:1001:A008:0:0:2:1BB3 (talkcontribs)

Hello,

I'm trying to insert an image using vanilla Markdown semantics:

![SomeText](://my_ip/index.php/File:some_image.png)

To avoid spam, the link header is removed.


But this does not correctly show the image.

I'm wondering how I can insert images correctly? Thanks!

Kuenzign (talkcontribs)

You should be able to use the same url that you are able to use to display the raw image in your browser. If you go to the File page and then click on the image, it should take you to the url where the raw image is hosted at. This isn't a very nice way to do it though, so I'd recommend putting an issue on the GitHub repo to have native support for MediaWiki File pages.

Reply to "Inserting images"
76.209.246.53 (talkcontribs)

that's all

Kuenzign (talkcontribs)

You just download the git repo, which is linked on the extension page

77.29.214.65 (talkcontribs)

Download link for the Wiki Markdown extension is broken. If you follow the link to download extension it takes you to a page where it says the extension does not exist.

Kuenzign (talkcontribs)

How so? The download link takes you to the GitHub repo where you can download the repo.

Kuenzign (talkcontribs)

Actually, I figured out which link you were talking about. I have since replaced that link with a link to the GitHub repo.

Reply to "download link broken"
Return to "WikiMarkdown" page.