In a Bitbucket wiki, is it possible to show the line numbers in a block code. Below is an example of what i am looking for.
1. <?php
2. $name = 'Paul';
3. echo 'Received name is: ' . $name;
4. ?>
I am using this code, but i am not getting the line number.
#!php
<?php
use evokernel\core\controllers as coreControllers;
class Cliente extends coreControllers\AbstractController {
}
No, there is no built in feature for that.
Although both work (and the second one might even look very pretty and you can customize it a whole lot more), I wouldn't choose either of them.
The problem is, people often copy example code because there too lazy to type it. It is extremely annoying to have line numbers right next to the code.
Don't use line numbers at all. I oft find myself editing example code quite often and adding/removing a new line could break the complete tutorial. Finding and replacing the line numbers is a hassle and you might forget some.
You can avert line numbers by using short examples. You really don't need to post more than ~15 lines of code. The more code you have, the harder to understand.
If you really need to add large code chunks and want to guide the user through, you should split the code into sections. You could add comments with a number and a little explanation.
Here is a very good example how Soheil Azarpour did it while he was explaining one of these long hard to understand crash reports. Even though you might not understand what he is talking about, it is worth a look how he solved the issue. Scroll down to "A Sample Crash Log" and look how he group the output and explained it almost line by line below. He didn't need a single line number!