commercetools / commercetools-docs-kit

Tools and components for developing Documentation websites 🛠
https://docs-kit.commercetools.vercel.app
MIT License
18 stars 5 forks source link

Java code examples are not highlighted #1261

Closed industrian closed 2 years ago

industrian commented 2 years ago

In the docs smoke test, Java code examples are highlighted: https://commercetools-docs-kit.vercel.app/docs-smoke-test/views/code-examples#java

In the docs website they're not. This is regardless of them being a code example from a file or in a code block.

image image

Another good example being the current Java SDK page.

I was testing with the example code in the docs smoke test, but as you can see above it also affects any Java code:

public class MyClass {
  public static void main(String[] args) {
    System.out.println("Hello World");
  }
}
    System.out.println("Hello World");  
nkuehn commented 2 years ago

@industrian I think I have a potential culprit, which is due to lack of proper documentation in the kit:

https://commercetools-docs-kit.vercel.app/documentation/configuration/setup#folder-structure (nearest heading, it does not directly have to do with this)

The additionalPrismLanguages configuration flag was never actually set in the conent repository, that means it relies on whatever Prism (the syntax highlighter library) ships built-in in any given version. The kit smoke test explicitly sets the supported languages so I guess it is a regression with some prism version that went undetected in the kit repo but popped up in your case.

Kit config: https://github.com/commercetools/commercetools-docs-kit/blob/main/websites/documentation/gatsby-config.js#L20

content repo: https://github.com/commercetools/commercetools-docs/blob/main/packages/gatsby-theme-docs-base/configure-theme.js#L7 (not public just in case someone wonders)

nkuehn commented 2 years ago

@timonrey if the above turns out true another sign we should simplify the package and configuration structure and invest significantly more into documentation.

industrian commented 2 years ago

@nkuehn

Defining the additionalPrismLanguages in gatsby-config.js has added code highlighting, as below (running locally):

image

nkuehn commented 2 years ago

great, thank you for the fast feedback!