Closed warrenseine closed 7 years ago
A pull request is welcome. The adding of the source tag would need to be optional though.
Also, just sticking a tag source tag around all the content is a bit hacky.
In case it needs to go around the whole content, is is not possible to just insert it around the call to the github parser function?
Perhaps a parameter can be added to allow surrounding the thing with a tag? ie
{{#github: ... |tag=source}}
Or perhaps like this for greater flexibility?
{{#github: ... |intro=<source>|outro=</source>}}
Or perhaps given source code is such a typical thing to have on GH, having a flag makes more sense.
{{#github: ... |highlightsyntax=yes}}
With such a flag, the extension could surround with the "pre" tag by default, and use "source" if it detects GeSHi is installed. And this way it could also support other highlighting extensions easily.
I'll be happy to review a PR. If it gets merged you won't have to re-apply your changes every time you update, and other people will have an easier time using the functionality.
I like the last idea. Putting that in my todo list :)
I guess you have a very big todo list :)
GeSHi functionality would really help! Also, right now the imported text from github is rendered as 'wiki text', so e.g. "#" becomes a '1'. Is there anyway to change that as well?
I've created a new ticket to track that enhancement request: https://github.com/JeroenDeDauw/GitHub/issues/20 (it is not currently possible to do this)
@JeroenDeDauw I do :)
I didn't take the time to look at it and it was always low priority anyway.
I also switched my documentation system to GitHub, dropping MediaWiki in the mean time. So yeah, I'm not going to contribute this addition, sorry :)
You can close or keep it open if you think it still makes sense.
@warrenseine thanks for th update. The enhancement itself makes sense, so keeping this open.
I was hoping to simply preparse the text from this extension using e.g.:
{{#tag:syntaxhighlight|{{#github:Time-Current Grading.sagews|danyill/time-current-grading}}|lang=python}}
Unfortunately that didn't work for me. See also here
Would this be a better general purpose solution allowing a range of post-processing options?
That'd be nice as well, and generally I think it's good to keep programs simple and making them chainable. Not sure this would always work here though. The markdown output can contain HTML such as tables. Does the syntaxhighlight
tag deal with those correctly? I kinda doubt it.
This was implemented in 1.2
I'm using this extension to display source code on a documentation wiki so it stays up to date.
I've had to hack the extension to re-render the rendered content with a
<source>
tag around it, which will be rendered by another extension I use, Syntax Highlight GeSHi if I remember correctly. This works fine if my case.I suppose adding a dependency to the project would not be acceptable, so I'm not going to make a pull request. Instead, I'm simply going to post the patch here so it might be useful to somebody someday.