Skip to content

Mixed web code should use a common indentation format #2697

@fnielsen

Description

@fnielsen

Mixed web code should use a common indentation format.

It seems that 2 spaces in HTML, CSS and Javascript may be the norm. And no tabs.

In Emacs I did add this to ~/emacs.d/init.el:

(defun my-mhtml-mode-indent-setup ()
  "Consistent 2-space, space-based indentation for mhtml-mode (HTML + JS + Jinja2)."
  (setq-local indent-tabs-mode nil)     ;; Always use spaces
  (setq-local tab-width 2)              ;; Just in case
  (setq-local sgml-basic-offset 2)      ;; HTML
  (setq-local css-indent-offset 2)      ;; CSS
  (setq-local js-indent-level 2))       ;; JS / inline scripts

(add-hook 'mhtml-mode-hook #'my-mhtml-mode-indent-setup)
``

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsome suggestions to improve Scholia

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions