How are the line numbers being generated in the examples of code? Markdown?

I see most of the questions with examples of code have line numbers. but the "C" (code) button does little. are these line numbers being generated in another editor and pasted into this box? If so, what is a good (read easy) editor to use? Where can it be found?

Answers

  • edited June 2015 Answer ✓

    no.

    they come directly from markup

    the C or ctrl-o has two ways

    highlight a word in a line with a ` thing

    or

    highlight 
    several 
    lines
    
    • for the latter come the line numbers

    • for the latter make sure to select several lines and have one empty line before and after

    • for the latter: no ` thing

    after submitting I have to press F5 sometimes

    Chrisir ;-)

  • I'm not getting it... I copy a few lines of code, past into this box, highlight same and hit the "C" above. All that happens is a few space indent... As with below.

    void mousePressed(){
      if (mouseButton == LEFT){
      pen = true;
      previousX = mouseX;
      previousY = mouseY;
      }
      else if (mouseButton == RIGHT){
        rect(0,0,800,800);
      }  
    }
    
  • edited June 2015 Answer ✓

    your example looks great here - with line numbers, colors and all...

    hit F5 please / reload in the browser / revisit the page

  • This is frustrating.... 
    

    I've gone through this many times, rebooted, added 1 space, 5 spaces, hit F5, AltF5, CtrlF5, hit F5 with everything but a hammer. Still all I can get is a few spaces of indent....

    is it acceptable to just have the following as for example?

    void mousePressed(){
      if (mouseButton == LEFT){
      pen = true;
      previousX = mouseX;
      previousY = mouseY;
      }
      else if (mouseButton == RIGHT){
        rect(0,0,800,800);
      }  
    }
    
  • edited June 2015 Answer ✓

    wait, the look of the code when you edit is just a few spaces!

    the line number only come in when you save

    your code looks good!

    don't be frustrated.

    ;-)

  • lol thanks

  • Answer ✓

    ;-)

Sign In or Register to comment.