Topic on Extension talk:SyntaxHighlight

Feature request: add title/external file/collapse

2
Sjoerd72 (talkcontribs)

Hi,

I have not found a way to feed the syntaxhighlighter with a previous uploaded file (eg a shell or python script). I really would like to have this feature implemented and while we are at it, wouldn't it be nice to add a title (eg filename) also and a collapse mechanisme to show only the first n-th lines

Bit like this:

<syntaxhighlight lang="shell" file="my_bash_script.sh" title="My Bash Script" collapse="5" />

This would render the file my_bash_script.sh were only the 1st 5 lines are visible with a title (heading nth style) "My Bash Script".

Any thoughts?

PerfektesChaos (talkcontribs)

I wonder whether I caught the meaning of file= but I think it is a page in your wiki. Then, the following will work:

{{#tag:syntaxhighlight | {{Module:Hello}} |lang=lua}}

There is no collapse="5" but you might wrap the entire thing into <div style="max-height:8em; overflow:hidden;"> or you may offer scroll bars by overflow:auto.

There is an HTML title= available but this is no visible caption but a hint for blind users or as brief explanation. However, you could place a headline outside this feature by any means.

Reply to "Feature request: add title/external file/collapse"