Syntax Highlighting inside Shortcode

I am using the theme Poison and I particularly liked their addition of tabs as shortcodes.

However, it seems that shortcut setup in this theme does not support Syntax Highlighting.

The shortcode syntax in this theme is this - poison/layouts/shortcodes/tab.html at 4b36ef57e6834471d946d634f9677971b5acc43e · lukeorth/poison · GitHub

I put the following code in my page, and while the tabs work, the syntax highlighting is not working.

{{< tabs tabTotal="2" >}}

{{% tab tabName="First Tab" %}}
### h3. This is markdown content - h3.
#### h4. This is markdown content - h4
{{% /tab %}}

{{< tab tabName="Second Tab" >}}
{{< highlight text >}}
private static void main() {
}
{{< /highlight >}}
{{< /tab >}}

{{< /tabs >}}

Just to make sure that Syntax Highlighting is working for my page, I also added the following code just after the tabs and the syntax highlighting is working with codefences.

    ```java
    private static void main(){
    }
    ```

Attached are the screenshots -

Can somebody suggest how can I make this work?

Without digging into the details, why not use fenced code blocks:

{{% tab tabName="Second Tab" %}}
```text
private static void main() {
}
```
{{% /tab %}}

Oh yes, did not try this version, but it works perfectly. Here is the working version of the code.

    {{< tabs tabTotal="2" >}}

    {{% tab tabName="First Tab" %}}
    ### h3. This is markdown content - h3.
    #### h4. This is markdown content - h4
    {{% /tab %}}

    {{% tab tabName="Second Tab" %}}
    ```java
    private static void main() {
    }
    ```
    {{% /tab %}}

    {{< /tabs >}}

Here is the screenshot -

Thank you so much @jmooring

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.