I am using marked with highlightjs for syntax highlighting. Both are latest versions. the following markdown is generating inconsistent highlighted code.
You can see it live here https://fastfoodcoding.com/tutorials/1504364531942/file-handling-in-java
See the difference between first code snippet and the rest.
Following is my configuration in code
```javascript
marked = require('marked');
// Synchronous highlighting with highlight.js
marked.setOptions({
breaks: true,
highlight: function(code) {
return require('highlight.js').highlightAuto(code).value;
}
});
I am using marked with highlightjs for syntax highlighting. Both are latest versions. the following markdown is generating inconsistent highlighted code.
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.List; class FilesHandling { public static void main(String[] args) { try { List<String> lines = Files.readAllLines(Paths.get("/path/to/file.txt")); int lineNum = 1; } catch (IOException e) { } } }
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; class FilesHandling { public static void main(String[] args) { try { } catch (IOException e) { } } }