🐕
Corgi
  • 🐕About Corgi
  • 🎓Learning Corgi
    • 📂File Structure
    • 🎉Getting Started
    • 🔟Code
    • 📄Arrow Blocks
    • 🪄If and Switch
    • ✏️Interpolation
    • 🔁For
    • 🤝Attributes
    • 🎭Expressions
    • 👮Security and Escaping
    • 💉Nonce Injection
    • ➡️Block Expansions
    • ➕Mixins
    • 📚Libraries
    • ✨The Standard Library
    • 💬Comments
    • ⛓️Filters
    • 🖨️Include
    • 👪Inheritance (Extending)
    • ⚡Breaking Changes
Powered by GitBook
On this page

Was this helpful?

  1. Learning Corgi

Arrow Blocks

You already know one way to write text: On the same line of an element.

Corgi also has another way to write longer lines of text: Arrow Blocks

All HTML you will see on this page will be the actual HTML that corgi generates, not pretty-printed HTML to make you familiar with how corgi controls whitespace.

p
  > Everything in here
    belongs to the same
    p tag.
p
  > And so does everything
    that is written
  em  in here
  >  and here
    as well
<p>Everything in here
belongs to the same
p tag.</p><p>And so does everything
that is written
<em> in here</em> and here
as well</p>

Leading whitespace after indentation will be preserved, as will all but the last newline. Other trailing whitespace will not be preserved.

An empty Arrow Block produces a single newline.

Technical Note: Corgi will always generate HTML with Unix-style line endings (LF), even if the corgi file uses CRLF.

Whitespace Control

Apart from the whitespace in text (which is handled as described above), corgi does not add any whitespace between elements, even if there is in the corgi file. This means, corgi removes all indentation or other whitespace, such as empty lines between elements.

As a result, the closing tag of an element will touch the opening tag of the next.

You can use empty arrow blocks to insert whitespace where you need it.

Additionally, you'll learn another way to insert whitespace when you learn about interpolation.

PreviousCodeNextIf and Switch

Last updated 1 year ago

Was this helpful?

🎓
📄