Function: web-mode-lify-region

web-mode-lify-region is an interactive and natively compiled function defined in web-mode.el.

Signature

(web-mode-lify-region)

Documentation

Transform current REGION in an html list (<li>line1</li>...)

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
(defun web-mode-lify-region ()
  "Transform current REGION in an html list (<li>line1</li>...)"
  (interactive)
  (let (beg end lines)
    (save-excursion
      (combine-after-change-calls
        (when  mark-active
          (setq beg (region-beginning)
                end (region-end))
          (setq lines (buffer-substring beg end))
          (kill-region beg end)
          (setq lines (replace-regexp-in-string "^[ \t]*" "<li>" lines))
          (setq lines (replace-regexp-in-string "$" "</li>" lines))
          (web-mode-insert-and-indent lines)
          ) ;when
        ) ;combine-after-change-calls
      ) ;save-excursion
    ) ;let
  )