html_guidelines.rst 718 B

1234567891011121314151617
  1. HTML coding guidelines
  2. ======================
  3. We use `Django templates <https://docs.djangoproject.com/en/stable/ref/templates/language/>`_ to author HTML.
  4. Linting HTML
  5. ~~~~~~~~~~~~
  6. We use `jinjalint <https://github.com/motet-a/jinjalint>`_ to lint templates. If you have installed Wagtail's testing dependencies (``pip install -e .[testing]``), you can check your code by running ``make lint``.
  7. Principles
  8. ~~~~~~~~~~
  9. * Write `valid HTML <https://validator.w3.org/nu/>`_. We target the HTML5 doctype.
  10. * Write `semantic HTML <https://html5doctor.com/element-index/>`_.
  11. * Attach JavaScript behavior with ``data-`` attributes, rather than classes or IDs.
  12. * For comments, use Django templates syntax instead of HTML.