gonzalezreal / swift-markdown-ui

Display and customize Markdown text in SwiftUI
MIT License
2.53k stars 318 forks source link

Will return undefined in code block sometimes #244

Closed hanrw closed 1 year ago

hanrw commented 1 year ago
image

But the issue not happened everytime

E.g raw response from stream below

Certainly! Here are a few examples of Java code:

  1. Hello World Program:

    public class HelloWorld {
    public static void main(String[] args) {
      System.out.println("Hello, World!");
    }
    }
  2. Fibonacci Series:

    public class Fibonacci {
    public static void main(String[] args) {
      int n = 10, t1 = 0, t2 = 1;
      System.out.print("Fibonacci Series: ");
      for (int i = 1; i <= n; ++i) {
         System.out.print(t1 + " ");
         int sum = t1 + t2;
         t1 = t2;
         t2 = sum;
      }
    }
    }
  3. Factorial of a Number:

    public class Factorial {
    public static void main(String[] args) {
      int num = 5;
      long factorial = 1;
      for(int i = 1; i <= num; ++i) {
         factorial *= i;
      }
      System.out.printf("Factorial of %d = %d", num, factorial);
    }
    }
  4. Simple Calculator:

    
    import java.util.Scanner;

public class Calculator { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter first number: "); double num1 = scanner.nextDouble(); System.out.print("Enter second number: "); double num2 = scanner.nextDouble(); System.out.print("Enter an operator (+, -, *, /): "); char operator = scanner.next().charAt(0); scanner.close(); double result;

  switch(operator) {
     case '+':
        result = num1 + num2;
        break;
     case '-':
        result = num1 - num2;
        break;
     case '*':
        result = num1 * num2;
        break;
     case '/':
        result = num1 / num2;
        break;
     default:
        System.out.println("Error! Invalid operator.");
        return;
  }
  System.out.println(num1 + " " + operator + " " + num2 + " = " + result);

} }

Please note that these code snippets are just simple examples and there is so much more to explore and learn in Java programming.

gonzalezreal commented 1 year ago

Hey @hanrw,

I can't reproduce any issue with the content you gave me. Could you please provide Markdown content that reproduces the problem? Otherwise, I cannot help you.

hanrw commented 1 year ago

Thank you, @gonzalezreal, for addressing the issue. I will now attempt to create a basic demo project in order to determine if it can be reproduced.

gonzalezreal commented 1 year ago

Closing due to staleness. Feel free to re-open when you can provide a sample reproducing the issue.