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

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

Open
dpaetzel opened this issue Feb 1, 2021 · 8 comments
Open

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

dpaetzel opened this issue Feb 1, 2021 · 8 comments
Labels
awaiting-pr bug Something isn't working good first issue Good for newcomers

Comments

@dpaetzel
Copy link

dpaetzel commented Feb 1, 2021

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 dpaetzel changed the title Math in Zettel titles is not rendered as math Math in Zettel titles is not rendered as math in Zettel links Feb 1, 2021
@dpaetzel
Copy link
Author

dpaetzel commented Feb 1, 2021

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

@srid
Copy link
Owner

srid commented Feb 2, 2021

Works for me?

image

(Tested in neuron's ./doc zettelkasten)

@srid
Copy link
Owner

srid commented Feb 2, 2021

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:

B.Math _mathTyp s -> s

@srid srid added the good first issue Good for newcomers label Feb 2, 2021
@srid
Copy link
Owner

srid commented Feb 2, 2021

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.
   _ -> ""

@dpaetzel
Copy link
Author

dpaetzel commented Feb 15, 2021

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

@onnyyonn
Copy link

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

@srid
Copy link
Owner

srid commented Aug 8, 2021

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

@srid
Copy link
Owner

srid commented Aug 8, 2021

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

@onnyyonn Probably related to #525

@srid srid added the bug Something isn't working label Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-pr bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants