openpatch / hyperbook

Hyperbook is a quick and easy way to build interactive workbooks, that support modern standards and runs superfast.
https://hyperbook.openpatch.org
MIT License
33 stars 7 forks source link

Online IDE shows wrong filenames with showLineNumbers: true #903

Closed jneug closed 2 days ago

jneug commented 2 days ago

In my config, I set showLineNumbers: true for code elements. When using an Online IDE, the first filename shows showLineNumbers in front of the actual filename configured in the code element.

Example hyperbook.json:

{
  "elements": {
    "code": {
      "showLineNumbers": true
    }
  }
}

Example onlineide-test.md:

---
name: Online IDE example
---

:::onlineide{height=500 console=false}

````markdown A Hint
## Tip:

Tips are written in a simple Markdown syntax which
which allows **boldface** and the like, but also syntax
syntax highlighting in body text (`class square extends rectangle { }`)
and in whole paragraphs:

double v = Math.random()*8 + 2; // Amount of speed between 2 and 10

double w = Math.random()2Math.PI; // angle between 0 and 2*PI

vx = v * Math.cos(w);

vy = v * Math.sin(w);


new Feuerwerk();

class Feuerwerk extends Actor {

   public void act() {
      if(Math.random() < 0.03) {

         int funkenzahl = Math.floor(Math.random() * 50 + 30);
         int farbe = Color.randomColor(128);

         double x = Math.random() * 400 + 200;
         double y = Math.random() * 600;
         double lebensdauer = 60 + Math.random() * 60;
         for (int i = 0; i < funkenzahl; i++) {
            new Funke(x, y, farbe, lebensdauer);
         }
         Sound.playSound(Sound.cannon_boom);

      }
   }

}

class Funke extends Circle {
   double vx;
   double vy;
   double lebensdauer;           // lebensdauer in 1/30 s

   Funke(double x, double y, int farbe, double lebensdauer) {
      super(x, y, 4);
      double winkel = Math.random() * 2 * Math.PI;
      double v = Math.random() * 15 + 5;
      vx = v * Math.cos(winkel);
      vy = v * Math.sin(winkel);
      setFillColor(farbe);
      this.lebensdauer = lebensdauer;
   }

   public void act() {
      lebensdauer--;
      move(vx, vy);
      vy = vy + 0.2;
      if(lebensdauer < 30) {
         setAlpha(lebensdauer / 30);
      }
      if(isOutsideView() || lebensdauer < 0) {
         destroy();
      }
   }

}

:::



Result:
![](https://i.imgur.com/zonhaWY.png)
mikebarkmin commented 2 days ago

Fixed in 9072589