I want something like this, where it numbers the lines on the left hand side and has code indentation and everything in it…what are these called? Is it a script? Sorry for being vague. This above example isn’t perfect. If the above example had numbering on the left hand side (some websites have this feature also.
Any websites with examples of this are falling short on my mind.
It took me a few minutes to even come up with that measly explanation as to what I want.
IIRC Sitepoint used to have a [css] tag which I THOUGHT had numbering but it doesn’t work anymore. Anyway, just need some admin control panel stuff put in so I can type my articles and I’ll be all set with my website! Thanks Ralph.
One thing I’m worried about is how this will look with JS off - would you recommend I have a default style of it set up and just let JS override everything? Working on another site project ATM so I haven’t delved into the SyntaxHighlighter.
Is there any way to simplify this? I have hte sitepoint example below:
<main>
<p id="example1-description">
This is the descriptive text that comes before the code example,
talking about whatever the code is an example of:
</p>
<figure>
<figcaption id="example1-caption">This is the caption</figcaption>
<pre
aria-describedby="example1-description"
aria-labelledby="example1-caption"><code
contenteditable="true"
tabindex="0"
spellcheck="false"><i>//try to get to sleep unless there's too much noise in the room</i>
<b>function</b> getToSleep()
{
<b>while</b>(noise <= 10 && sleep !== <u>"zzz"</u>)
{
sheep ++;
}
<b>if</b>(noise > 10)
{
<b>return</b> <b>false</b>;
}
<b>return</b> <b>true</b>;
}</code></pre>
</figure>
</main>
Typing that into my database would be difficult (my form will be submitting directly to the database). Is there any way to convert this into <code> or some similar format? Less structure to it?