Skip to main content
Every template is Liquid and HTML underneath. The Visual editor builds that code for you from blocks and document styles; the Code editor shows the code itself. You switch with the Visual and Code tabs at the top of the editor. Foliant never throws code away when you switch: anything it can’t turn into a regular block is kept as a Custom Liquid block.

Before you start

The Visual tab depends on your plan. Without it, the tab shows the plan that includes it, and the code editor works as usual. See Visual editor plan availability.

Convert a code template to blocks

  1. Open the template in the editor. It opens in Code.
  2. Click the Visual tab. The Convert to visual dialog opens.
  3. Choose how to start:
  1. Check the page, then save.
The layouts offered depend on the template: one document per order (Invoice, Credit note, Quote, Packing slip, Returns form, Commercial invoice, Purchase order, General order document, Shipping label, Receipt) or one document for all the selected orders (Pick list, Order summary). A layout for a document type gives a template without a type that type, so an invoice layout is numbered as an invoice.

See or edit a visual template’s code

  1. In a visual template, click the Code tab. You see Compiled Liquid: the code Foliant generates from your blocks and document styles. It’s read-only.
  2. To change it, click Edit code. From now on the code editor is active and saving saves your code.
  3. When you save, Foliant reads the blocks back from your code, so the template stays visual.
You can also open the compiled code of a single block: select it and click See the compiled Liquid in its Content tab.

Switch back to Visual after editing code

Click the Visual tab. Foliant reads the blocks from your code:
  • Blocks whose code you didn’t change come back as they were.
  • If some code no longer matches its block, or was written outside any block, the Switch back to Visual? dialog lists those parts under Parts kept as Custom Liquid, with the reason:
    • Edited code: the block’s code changed, so it becomes a Custom Liquid block.
    • Written outside any block: new code you added between blocks.
  • Click Switch to Visual to continue, or Stay in Liquid to keep editing code.
Nothing is removed, and you can undo the switch. You need to fix any code errors before you can switch.

Replace a template with a starter

Replace with a starter… in the top bar replaces everything in the editor with a starter template or design. The starters are code templates, so a visual template becomes a code template. Nothing changes until you save, and Discard brings back what you had.

Good to know

  • Custom Liquid blocks can be moved, styled and given conditions like any other block. Their code prints exactly as written.
  • Converting is per template and only happens when you choose it.
  • Templates made from a purchased design use the design editor and can’t be switched to Visual or Code here.