I’m looking at the tutorial pages covering the development of a component within Joomla. In the sections of code there are lines highlighted with a yellow background which indicate the lines of code which are new / changed from the previous step in the tutorial. An example is the large code block near the start of this page.
The problem is that when you try to copy these highlighted lines and paste them into your own code in your own editor (eg notepad++ or sublime), you just get all of those lines pasted into a single long line, instead of having them as separate lines as shown on the web page.
I’d really like to amend the documentation so that you can continue to have the new lines highlighted, but also be able to copy and paste them into your own editor, but I can’t see how.
What I’ve discovered so far:
According to this wiki extensions page the Joomla documentation wiki uses a syntax highlighting extension which can highlight sections of code.
In the specific developer tutorial pages this is invoked through eg
<source lang="php" highlight="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21"> ... </source>
However, this results in html where the line feeds are not actually present for those lines. Instead the CSS (in particular a class called ‘xtra’) converts those elements using a display:block directive to get them to appear on separate lines.
I’ve tried various things such as adding line feeds via html ampersands, changing the highlight attribute to give a range of pages (highlight=”1-21″), trying to add line numbers, tried replicating what’s shown on that syntax highlighting page above, etc but nothing has worked. Also I raised this question on the Joomla forum a couple of months ago, but haven’t got any responses.
I think this is related in part to different browser behaviour, so try experimenting with other browsers.
When copying the highlighted text you mention and pasting into Sublime on OSX, for me the line breaks are lost with Firefox but are retained with Chrome and Safari.
Answered By – David Taiaroa
Answer Checked By – Dawn Plyler (AngularFixing Volunteer)