nteract / markdown

A package for rendering Markdown within Jupyter notebooks
BSD 3-Clause "New" or "Revised" License
9 stars 8 forks source link

Syntax highlighting works in rendered markdown not respecting theme #4

Open SpencerPark opened 5 years ago

SpencerPark commented 5 years ago

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 ```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"
}
captainsafia commented 4 years ago

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.