neuron icon indicating copy to clipboard operation
neuron copied to clipboard

Math in Zettel titles is not rendered as math in Zettel links

Open dpaetzel opened this issue 5 years ago • 8 comments

I often have mathematical expressions in Zettel titles, e.g.

# Proof that $1 \neq 0$

…

I thought that links to such a Zettel got rendered correctly in browser in an earlier release but this is not the case any more. Probably has something to do with a change in the used math engine? Can it be made to work again?

dpaetzel avatar Feb 01 '21 08:02 dpaetzel

To clarify further: Links to the above example Zettel are rendered as

Proof that 1 \neq 0

but should be rendered as

Proof that 1 ≠ 0

dpaetzel avatar Feb 01 '21 08:02 dpaetzel

Works for me?

image

(Tested in neuron's ./doc zettelkasten)

srid avatar Feb 02 '21 17:02 srid

Oh, you mean links. Right, neuron generates the following HTML

<a href=".">Proof that 1 \neq 0</a>

The $ is missing. plainify is discarding them?

Yup, the fix could go here: https://github.com/srid/neuron/blob/468737141a92faacb1e9a2f33081ff073251852d/neuron/src/lib/Text/Pandoc/Util.hs#L82

srid avatar Feb 02 '21 18:02 srid

Though, this patch has no effect - so I've no idea.

diff --git a/neuron/src/lib/Text/Pandoc/Util.hs b/neuron/src/lib/Text/Pandoc/Util.hs
index 6b853d67..bf187dfa 100644
--- a/neuron/src/lib/Text/Pandoc/Util.hs
+++ b/neuron/src/lib/Text/Pandoc/Util.hs
@@ -79,7 +79,7 @@ plainify = W.query $ \case
   B.SoftBreak -> " "
   B.LineBreak -> " "
   B.RawInline _fmt s -> s
-  B.Math _mathTyp s -> s
+  B.Math _mathTyp s -> "$" <> s <> "$"
   -- Ignore the rest of AST nodes, as they are recursively defined in terms of
   -- `Inline` which `W.query` will traverse again.
   _ -> ""

srid avatar Feb 02 '21 18:02 srid

Thank you for looking into it! I might create a PR some time.

dpaetzel avatar Feb 15 '21 08:02 dpaetzel

This is probably related: Parenthesis in title is not rendered properly as well. Sometimes I add wiki-style links in title, like this:

Screenshot_20210628_212641

That is rendered as this in the link:

Screenshot_20210628_212803

onnyyonn avatar Jun 28 '21 16:06 onnyyonn

Could anyone port this issue, if applicable, to Emanote? See https://neuron.zettel.page/next

srid avatar Aug 08 '21 00:08 srid

This is probably related: Parenthesis in title is not rendered properly as well.

@onnyyonn Probably related to #525

srid avatar Aug 08 '21 15:08 srid