neo4j-documentation / asciidoctor-jupyter

A Jupyter converter for Asciidoctor.js. Write your Notebook in AsciiDoc!
16 stars 1 forks source link

inline math is not displayed properly in vscode-jupyter #8

Closed prudhomm closed 1 year ago

prudhomm commented 1 year ago

inline math is not displayed at least in vscode-jupyter

with version 0.3.0 it is rendered like this

Screenshot 2023-03-26 at 22 13 05

as you can see $\sigma$ $\beta$ and $\rho$ are not rendered properly after Let's change

A slight change to index.js allows to fix that

Screenshot 2023-03-26 at 22 14 55
diff --git a/src/index.js b/src/index.js
index edde7b1..b635183 100644
--- a/src/index.js
+++ b/src/index.js
@@ -299,8 +299,8 @@ class JupyterConverter {
       if (type === 'strong') {
         return `**${node.getText()}**`
       }
-      if (type === 'asciimath') {
-        return `\\\\(${node.getText()}\\\\)`
+      if (type === 'asciimath' || type === 'latexmath') {
+        return `$${node.getText()}$`
       }
       if (type === 'unquoted') {
         return node.getText()
prudhomm commented 1 year ago

Now such a notebook is rendered properly

Screenshot 2023-03-26 at 22 26 03
ggrossetie commented 1 year ago

You are correct, we should enclose inline math expressions using $: https://jupyterbook.org/en/stable/content/math.html#in-line-math