Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code blocks in MediaWiki markup with <source> or <syntaxhighlight> tags rather than <pre> #3461

Closed
joelostblom opened this issue Feb 21, 2017 · 2 comments

Comments

@joelostblom
Copy link

Is there a way for pandoc to output syntax highlighted code blocks in mediawiki format (possibly using the <source> or <syntaxhighlight> tags)? Preferably without converting < to &lt;.


Background

If I have a markdown file ~/test-r.md:

A function in `R`:

```R
x <- 3
x + 5
## 8
```

pandoc -f mediawiki ~/test-r.md outputs

A function in <code>R</code>:

<pre class="r">x &lt;- 3
x + 5
## 8</pre> 

which is rendered on mediawiki sites without R-specific syntax highlighting:

selection-20170221-01

If I manually change the tags to either <syntaxhighlight lang="r"> or <source lang="r"> (as described here)I get output with syntax highlighting:

selection-20170221-02

However, the odd assignment operator conventions in R, <-, causes troubles since pandoc converted the < to &lt;, and it needs to be manually changed back to achieve the desired output (possibly related):

selection-20170221-03

@joelostblom joelostblom changed the title Format code blocks in MediaWiki markup with <source> or <syntax> tags rather than <pre> Format code blocks in MediaWiki markup with <source> or <syntaxhighligh> tags rather than <pre> Feb 21, 2017
@joelostblom joelostblom changed the title Format code blocks in MediaWiki markup with <source> or <syntaxhighligh> tags rather than <pre> Format code blocks in MediaWiki markup with <source> or <syntaxhighlight> tags rather than <pre> Feb 21, 2017
@jgm jgm closed this as completed in 7af3d90 Feb 21, 2017
@jgm
Copy link
Owner

jgm commented Feb 21, 2017

This was just a matter of updating the list of highlighting languages mediawiki supports.

@joelostblom
Copy link
Author

Wow, that was quick! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants