📜 ⬆️ ⬇️

Hab formatting

Today I translated an article about KIS, and met with one very unpleasant feature of the habr: the difficulty of inserting code (sources).

The only way to do this is to use the pre tag.
But for reasons unknown to science, the height of the lines in this tag is exorbitantly large.

This can be seen in the code below. For better visibility, I wrapped it in a block quota and showed what the same code looks like with pre and without pre.
')
It is impossible to change the style. How to publish the code?

With pre (spaces in place - the lines are ultra high):
  class Test {
    
     protected $ justForFun;

     public static function test2 () {
         echo "Line1 \ n";
         echo "Line2 \ n";
         echo "Line3 \ n";
         echo "Line4 \ n";
     }
  
 } 


Without pre (normal line, spaces left by the forest):
class Test {
protected $ justForFun;

public static function test2 () {
echo "Line1 \ n";
echo "Line2 \ n";
echo "Line3 \ n";
echo "Line4 \ n";
}
}


When writing a translation, I solved this problem by first copying the text into the editor and replacing all the spaces with nbsp and refusing to use pre - but this is not an option ...

November 12th. Issue resolved
rossomachin November 12, 2007 10:40
We know about it. In the next version of Habr, there will be no error.

Source: https://habr.com/ru/post/16040/


All Articles