Coder Social home page Coder Social logo

Comments (14)

josevalim avatar josevalim commented on June 4, 2024 1

You can run MIX_ENV=docs mix docs (or just mix docs?) in the nx subfolder and you should be able to see results locally. :)

from nx.

jonatanklosko avatar jonatanklosko commented on June 4, 2024 1

This is the same as elixir-lang/ex_doc#1571.

In this specific example this manifests in two ways:

  • _ pairs being expanded to markdown italic
  • \\ is escaped backslash and gets converted to \

from nx.

josevalim avatar josevalim commented on June 4, 2024

@ndrean, would you be able to take a look? Thank you!

from nx.

ndrean avatar ndrean commented on June 4, 2024

oh, indeed! I didn't looked at the Hexdocs. Time to dive into Hexdocs, Earmark and probably Mathjax.

from nx.

josevalim avatar josevalim commented on June 4, 2024

You can also find the configuration on nx/mix.exs.

from nx.

ndrean avatar ndrean commented on June 4, 2024

@jonatanklosko Maybe a naive quick thought: Earmark produces an HTML string, doesn't it? If we just ask Earmark to leave whatever is between $ signs, and embed MathJax in the rendered document (like adding a <script src=cdn mathjax...>), couldn't it render math? I also saw a MathJax.typeset

from nx.

jonatanklosko avatar jonatanklosko commented on June 4, 2024

@ndrean we don't want Earmark to inject the script, that should be up to the user. But yeah, the proper solution is to make Earmark aware of $ and $$, so their contents are not interpreted as Markdown :)

from nx.

ndrean avatar ndrean commented on June 4, 2024

@jonatanklosko ah, I see you already inject Katex, somehow used the "mix": defp before_closing_body_tag(:html)

I don't understand/know the interactions between ex_docs, earmark, so I believe you have a better position to open an issue to earmark, if this is the potential response?

from nx.

josevalim avatar josevalim commented on June 4, 2024

We don't have another option to handle this that doesn't require changing Earmark? Make we can indent with four spaces and remove the wrapping pre tag accordingly?

from nx.

jonatanklosko avatar jonatanklosko commented on June 4, 2024

@josevalim we could support alternative syntax (like GitLab, elixir-lang/ex_doc#1571 (comment)), but that creates more friction for people to use it. IIRC we were leaning towards $ and $$ support in Earmark, because GitHub added support for it.

from nx.

josevalim avatar josevalim commented on June 4, 2024

So request on Earmark it is. We will most likely have to contribute it. What do we do with this guide meanwhile? Can we avoid using _ or \\? Or should we keep it on GitHub and remove it from the docs?

from nx.

polvalente avatar polvalente commented on June 4, 2024

So request on Earmark it is. We will most likely have to contribute it. What do we do with this guide meanwhile? Can we avoid using _ or \\? Or should we keep it on GitHub and remove it from the docs?

\\ is used for linebreaks, so I think it's rather unavoidable. _ could maybe be substituted by ^ if we changed subscripts to superscripts

from nx.

ndrean avatar ndrean commented on June 4, 2024

When you look at the Nx guide - for example, https://hexdocs.pm/nx/intro-to-nx.html#broadcasts- you see that Latex is parsed correctly with $$ and \begin. The problem starts when you have nested commands (\begin{matrix} \begin{matrix}...)., so it might not be straightforward.

I would remove this one from the hexdocs for the moment, just keep the Livebook and a link to the Github.

from nx.

josevalim avatar josevalim commented on June 4, 2024

Done for now. The core issue is currently trackled on ExDoc. Thanks!

from nx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.