Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting works in rendered markdown not respecting theme #4

Open
SpencerPark opened this issue Jul 18, 2019 · 1 comment · Fixed by nteract/nteract#4546
Assignees

Comments

@SpencerPark
Copy link

For some languages in the markdown source editor, code fences are properly highlighted, but when rendered that syntax highlighting is lost. This is a tear off of a comment left on the related issue nteract/nteract#4445.

java is working in markdown source but not in code cells, nor in rendered markdown. Here is a screenshot:
nteract-syntax

This was on nteract desktop v0.14.3, windows 10. I'll also attach the notebook in case anything in there is interesting/helpful:

Notebook JSON
{
  "cells": [
    {
      "cell_type": "code",
      "source": [
        "for (int i = 0; i < 3; i++) {\n",
        "    System.out.println(\"i: \" + i);\n",
        "}"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "i: 0\n",
            "i: 1\n",
            "i: 2\n"
          ]
        }
      ],
      "execution_count": 2,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "```java\n",
        "for (int i = 0; i < 3; i++) {\n",
        "    System.out.println(\"i: \" + i);\n",
        "}\n",
        "```\n",
        "```python\n",
        "for i in range(0, 3):\n",
        "    print('i:', i)\n",
        "```\n",
        "```go\n",
        "package main\n",
        "```"
      ],
      "metadata": {}
    },
    {
      "cell_type": "markdown",
      "source": [],
      "metadata": {}
    }
  ],
  "metadata": {
    "kernel_info": {
      "name": "java"
    },
    "language_info": {
      "name": "Java",
      "version": "9+181",
      "mimetype": "text/x-java-source",
      "file_extension": ".jshell",
      "pygments_lexer": "java",
      "codemirror_mode": "java"
    },
    "kernelspec": {
      "name": "java",
      "language": "java",
      "display_name": "Java"
    },
    "nteract": {
      "version": "0.14.3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}

The interesting information being:

"language_info": {
  "name": "Java",
  "version": "9+181",
  "mimetype": "text/x-java-source",
  "file_extension": ".jshell",
  "pygments_lexer": "java",
  "codemirror_mode": "java"
}
@lock lock bot locked as resolved and limited conversation to collaborators Dec 9, 2019
@captainsafia captainsafia reopened this Apr 29, 2020
@captainsafia
Copy link
Member

Re-opening this again.

We've leveled up from the previous scenario because rendered markdown now shows proper syntax highlighting for code.

However, it looks like the themes we are using from react-syntaxhighlighter don't get updated appropriately when the app theme changes. My suspicion is that this has something to do with the way the theme prop is propagated from the Source component to the syntax highlighter.

@captainsafia captainsafia self-assigned this May 5, 2020
@nteract nteract unlocked this conversation May 6, 2020
@captainsafia captainsafia transferred this issue from nteract/nteract May 6, 2020
@captainsafia captainsafia changed the title Syntax highlighting works in markdown source yet not in rendered markdown Syntax highlighting works in rendered markdown not respecting theme May 6, 2020
@captainsafia captainsafia transferred this issue from nteract/outputs May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants