Are preparing to publish a post with formulas

recently on habré there was a lot of posts with mathematical formulas. For example, it is impossible not to recall a series of articles maisvendoo on theoretical mechanics.


In this regard, has become an important question on choosing a convenient tool for creating and preparing these posts. SeptiM a script that convert markdown markup + latex in the html code. I decided to develop the idea and to simplify the tool, and made for the same purpose the online editor with support for markdown and lateja


Screenshot editor



the

Editor of mathematical texts


In the editor, for convenient text typing with lots of formulas and immediately see the result. You format the text in markdown, enter the formula to lathe and get html code.


Consider an example. Fragment


the
Formula for solution of quadratic equation <nobr>_ax_^2^ + _bx_ + _c_ = 0</nobr> has the form

$$
x_{1,2} = {-b\pm\sqrt{b^2 - 4ac} \over 2a}
$$ (1)

becomes


the Formula for solving the quadratic equation ax2 + bx + c = 0 is


x_{1,2} = {-b\pm\sqrt{b^2 - 4ac} \over 2a}


the

Features editor


the Editor saves the text you type in localStorage, so when it crashes your browser, operating system, computer, or supply your labor is not lost.


There is an export option in the html markup, understandable garrapatero (which ignores the attributes of the style and <p>, but understands "" <source> and line breaks).


the Editor works in a browser, calls to the server only for formulas in the preview mode.


Some possibilities in no markdown. To insert images with alignment or dimension, use bare html.


the

Mathematical formulas on the web


For there are two ways of embedding lateja. Formula either rendered on the server and are given as images or rendered on the client.


Existing solutions I didn't like. Service codecogs.com for server-side rendering is sometimes buggy: generate images with a too large upper and lower indices, and then cache them. JS-renderer MathJax does one the actual rendering every time on all computers and mobile, and contains a limited set of commands.


So even before I made a service the generation of svg and png images with formulas. The editor uses svg-images, so that the formula looked nice on the retina.


the

syntax Highlighting


most of all I'm happy with the syntax highlighting. It managed to combine a browser with a spell check and make fairly quick work on the fly:


syntax Highlighting

unfortunately, the backlight does not always work correctly (and never will be, because it is based on a parser based on regular expressions). However, the task orientation of the text this method solves well. Please report bugs, I'll try to fix them.


the

development Plan


eventually, I want to support keyboard shortcuts, modify the animation (not in all browsers now smooth), add to open files via drag & drop, deal with the equalization formula under the baseline in the preview mode.


Code editor as of service generating images, posted on github. Forcite and send a pool of requests :)


the

Acknowledgement


Thanks to maisvendoo for testing. The editor uses parser for markdown-it. The idea of illumination found in the draft LDT.

Article based on information from habrahabr.ru

Популярные сообщения из этого блога

Approval of WSUS updates: import, export, copy

Kaspersky Security Center — the fight for automation

The Hilbert curve vs. Z-order