scala-cli icon indicating copy to clipboard operation
scala-cli copied to clipboard

Support `java raw` snippets in `.md` inputs

Open Gedochao opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. We currently support compilation of plain scala snippets (as an equivalent of .sc Scala script inputs) and scala raw snippets (as an equivalent of .scala inputs) inside of Markdown sources. (relevant docs for scala raw code blocks) To be consistent, we could support java raw snippets as an equivalent of .java inputs.

Describe the solution you'd like Code blocks tagged as java raw inside of Markdown inputs should be compiled as Java code. No wrapping should take place, similarly to how scala raw is handled with Scala.

# Java Snippet
```java raw
public class Main { 
  public static void main(String[] args) { 
    System.out.println("Hello"); 
  } 
}
```

Describe alternatives you've considered Theoretically, we could support raw Java code in plain java snippets, if we decide that wrapped Java code similar to scala snippets isn't to be supported, anyway. However, that'd be inconsistent with how Scala is handled and should probably be avoided. The keyword raw should be required.

Additional context If plain java snippets were to be supported, we'd have to implement wrapping of Java code on par with Scala CLI's implementation of Scala scripts, which is a considerably bigger effort. (#1602)

Gedochao avatar Nov 23 '22 11:11 Gedochao