This module is like MiniLaTeX.Edit, except that the Data type, which is an
alias of the record type Internal.DifferSimple.EditRecord
, contains no functions.
Internal.DifferSimple.EditRecord
Data structures and functions for managing interactive edits. The parse tree, rendered text, and other information needed for this is stored in a value of type
MiniLatex.Edit.Data
That data is initialized using
data =
init version text
where the version is an integer that distinguishes different edits.
@docs Data, emptyData, init, update, get, LaTeXMsg
emptyData : Data
Used for initialization.
init : Basics.Int -> String -> Maybe String -> Data
Create Data from a string of MiniLaTeX text and a version number. The version number should be different for each call of init.
update : Basics.Int -> String -> Maybe String -> Data -> Data
Update Data with modified text, re-parsing and re-rerendering changed elements.
get : String -> Data -> List (Html LaTeXMsg)
Retrieve Html from a Data object and construct the click handlers used to highlight the selected paragraph (if any). Example:
get "p.1.10" data
will retrieve the rendered text and will hightlight the paragraph with ID "p.1.10". The ID decodes as "paragraph 10, version 1". The version number of a paragraph is incremented when it is edited.
render : String -> List (Html LaTeXMsg)
Simplest function for rendering a string of LaTeX
renderWithVersion : Basics.Int -> String -> List (Html LaTeXMsg)
Like 'render', but adds a 'version' id to the Html. This is used in applications that edit LaTeX text
Use this type so that clicks in the rendered text can be detected