Function: markdown--unhex-url-string

markdown--unhex-url-string is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown--unhex-url-string URL)

Documentation

Unhex control characters and spaces in URL.

This is similar to url-unhex-string but this doesn't unhex all percent-encoded characters.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown--unhex-url-string (url)
  "Unhex control characters and spaces in URL.
This is similar to `url-unhex-string' but this doesn't unhex all percent-encoded
characters."
  (let ((str (or url ""))
        (tmp "")
        (case-fold-search t))
    (while (string-match "%\\([01][0-9a-f]\\|20\\)" str)
      (let* ((start (match-beginning 0))
             (ch1 (url-unhex (elt str (+ start 1))))
             (code (+ (* 16 ch1)
                      (url-unhex (elt str (+ start 2))))))
        (setq tmp (concat
                   tmp (substring str 0 start)
                   (cond
                    ((or (= code ?\n) (= code ?\r))
                     " ")
                    (t (byte-to-string code))))
              str (substring str (match-end 0)))))
    (concat tmp str)))