
TeXMe Self-rendering Markdown and LaTeX documents - harporoeder
https://github.com/susam/texme
======
sxp
Another similar script is [http://casual-effects.com/markdeep/](http://casual-
effects.com/markdeep/) which has a pretty wide set of features for ASCII art.
With some slight tweaking, it can be used to embed markdown inside normal
HTML+JS docs so I've been using it for some of my personal notes.

~~~
legends2k
Markdeep supports MathJax as well.

------
rahimiali
What a great idea. This lets me skip the md->html conversion step. Which means
I can edit equations interactively by just cmd-R'ing in the browser, and share
md files with people without telling them what tool to use to render.

------
Cyykratahk
This script could be automatically injected before .md files using the nginx
directive add_before_body. An instant static site of markdown files with no
preprocessing step.

    
    
        location ~* /markdown/.*\.md$ {
          add_before_body "/markdown/header.html";
          types {}
          default_type text/html;
        }
    

And a little bit of CSS to keep the line breaks if the JS is disabled:

    
    
        <!DOCTYPE html><script src="https://cdn.jsdelivr.net/npm/texme@0.7.0"></script>
        <style>body > main { white-space: normal; }</style>
        <body style="white-space: pre-line;">

------
fspeech
A lot of these scripts that focus on rendering just wrap around mathjax/katex
and md processors that do the actual heavy lifting. To me the real innovation
needed to advance math authoring lies in processing cross references. Browser
tech has yet to be fully utilized to present arguments in a manner that best
facilitates reading instead of the linear fashion that comes from the
constraint of printed documents. To be sure there are some work done in this
direction in online open textbooks, but the tools and formats are too heavy
for wide adoption.

~~~
utopcell
Wondering what you have in mind ? Deep linking to other papers for example ?

~~~
fspeech
For example like an IDE one should be able to easily see definitions defined
somewhere else. Right now it is doable only if an author spends a lot of
manual effort.

~~~
mnky9800n
You mean like how Wikipedia renders the beginning of a page if you hover over
a link in a wiki page?

~~~
fspeech
Sure floating tooltips or "show and hide" buttons are possible ways to let one
preview cross reference within current context instead of leaving the page.
This would reduce friction and memory load. This book
[https://mphitchman.com/geometry/](https://mphitchman.com/geometry/)
extensively uses this and other (inline exercises, e.g.) through the pretext
markup scheme and tools. As a first step it would be nice to have some of
these features working in the more popular md schemes. But I also happen to
think that it is possible to go beyond. Math could use a better semantic
markup that enables better presentation of underlying structures in addition
to pretty tex formulaes.

~~~
mnky9800n
I would like to see a math equation traceback. Like for a stochastic model of
animal population distribution you might have something like

p_ih = p_0 _exp[(a_ d_ih)^c + (b*s_star)^e]

and it would be really nice if you could just see the traceback on everything,
like you click on s_star and it takes you to the definition

s_star = (s_max - s_h)/(s_max - s_min)

and you can keep going until you are done. I guess I'm just tlaking about a
wiki at this point but the focus would be on integrating the definitions into
the equation itself so that when you read it in a textbook or whatever you can
see where the ultimate comes from.

------
bachmeier
I really liked this because it's easy to save that line as a snippet in your
text editor. It's a process of creating a new html file, inserting the
snippet, and typing away.

Unfortunately, my usage came to a quick end when I discovered dollar signs in
code are treated as math. It would have to switch from the Commonmark library
to something like markdown-it that has a full set of features.

~~~
susam
Hi Lance (@bachmeier),

Thank you for reporting this issue and especially for posting your
investigation details on this issue at
[https://github.com/susam/texme/issues/9](https://github.com/susam/texme/issues/9).

I have now added support for a special purpose environment named "md" to
TeXMe. This environment protects LaTeX delimiters ($, $$, etc.) within
Markdown code blocks and code spans. More details about this feature is
available at the following two URLs:

\-
[https://github.com/susam/texme/issues/9#issuecomment-6994876...](https://github.com/susam/texme/issues/9#issuecomment-699487692)

\-
[https://github.com/susam/texme/blob/6213f86/README.md#markdo...](https://github.com/susam/texme/blob/6213f86/README.md#markdown-
priority-environment)

------
pcarbonn
Does it support linking to another file in the same directory ?

~~~
susam
Yes, it does. Plain Markdown links and HTML links remain intact and behave
normally. Here is an example:

    
    
      <!DOCTYPE html><script src="https://cdn.jsdelivr.net/npm/texme@0.7.0"></script><textarea>
    
      # Euler's Identity
    
      In mathematics, **Euler's identity** is the equality
      $$ e^{i \pi} + 1 = 0. $$
    
      To read more, [click here](bar.html).
    

The last line in the above example contains a link to a file named bar.html in
the same directory.

