dwmkerr / chatgpt-diagrams-extension

A Chrome browser extension that renders diagrams in the ChatGPT website inline.
MIT License
13 stars 3 forks source link

bug: Unknown Diagram Type #11

Open dwmkerr opened 1 year ago

dwmkerr commented 1 year ago

If you try and render a diagram from a code snippet such as typescript, you get an error like the below:

image

This is good, because we can properly catch it and handle it, unlike the invalid markdown for diagrams (which I will raise an issue for). The specific code snippet that causes this issue (good to add to a test) is:

enum Color {
  Red,
  Green,
  Blue
}

class SampleClass {
  color: Color;
  isEnabled: boolean;

  constructor(color: Color, isEnabled: boolean) {
    this.color = color;
    this.isEnabled = isEnabled;
  }

  printValues() {
    console.log(`Color: ${Color[this.color]}`);
    console.log(`Is enabled: ${this.isEnabled}`);
  }
}

// Usage:
const sample = new SampleClass(Color.Green, true);
sample.printValues();
dwmkerr commented 1 year ago

Note that #19 improves on this by encapsulating the mermaidjs error content in our container div.