How Liquid works

This document provides a view of how the mechanics of Liquid works, with focus on the details from a user perspective. 

Virtual editor in the center

For the scope of this document consider the editor itself a datastructure with related functions. 

 

Almost everything that is done in Liquid is doing actions to the editor: 

 

  • Key inputs are translated into functions and applied to the editor.
  • Programs are applying functions to the editor.
  • Any view is just reading the state of the editor and drawing its interpretation on the screen, in a window, in a webbrowser, etc.
  •  

    So Liquid is a virtual editor on which you can act from some input and drag out information for some output. 

    Apps are just recepies of actions to apply to the editor

    When you create an app for Liquid, you just run the functions needed to make Liquid do your apps functionality. The steps for that might be: 

     

  • Create a buffer: (editor/new-buffer "some-name")
  • Create a keymap: {:a do-stuff-on-editor :b do-something-else-on-editor}
  • Attach the keymap to the buffer: (editor/set-keymap my-keymap)
  • Maybe (but not needed) set a syntax highlight function: (editor/set-highlighter my-highlighter)
  •  

    Now the actions in the keymap defines what the app does, when the buffer is in front. 

    Core is also just an app

    When Liquid is started, the -main function in the core namespace is executed. It just does actions to the editor, to make some buffer from the beginning. It sets up input handlers and a view, so there is something from the beginning. How input and output should be done can be configured with input parameters, but you can actually just create your own -main function to set it up exactly as you like. 

     

    To do just additions to the default setup add your code to a .liq file in your home folder.