-
Notifications
You must be signed in to change notification settings - Fork 171
Open
Description
Expected Behavior
I would like to have header scaling enabled in markdown-view-mode
but
not in markdown-mode
.
I have a local hack in my personal config that looks like this:
;;;###autoload
(define-minor-mode +markdown-scale-headers-mode
"Scale `markdown-mode' headers."
:lighter "M↑"
(+markdown-update-header-faces +markdown-scale-headers-mode))
(defun +markdown-update-header-faces (&optional scaling scaling-values)
"Update header faces, depending on if header SCALING is desired.
If so, use given list of SCALING-VALUES relative to the baseline
size of `markdown-header-face'.
Like `markdown-update-header-faces' but buffer local."
(dotimes (num 6)
(let* ((face-name (intern (format "markdown-header-face-%s" (1+ num))))
(scale (cond ((not scaling) 1.0)
(scaling-values (float (nth num scaling-values)))
(t (float (nth num markdown-header-scaling-values))))))
(unless (get face-name 'saved-face) ; Don't update customized faces
(face-remap-add-relative face-name :height scale)))))
The important points in the code snippet above are:
- I add a buffer local minor mode for enabling or disabling header scaling
- I change
markdown-update-header-faces
like this:- (set-face-attribute face-name nil :height scale) + (face-remap-add-relative face-name :height scale)
Posting this hack in the issue itself is mostly to show that it can be done
but I realize there are several ways to do this and there might be downsides
I haven't considered.
Actual Behavior
Enabling markdown-header-scaling
will toggle header scaling in all modes.
Steps to Reproduce
- Enable header scaling
Software Versions
- Markdown Mode: 6f59f72 + these patches:
- Emacs: 29.4
- OS: Fedora Workstation 41
Metadata
Metadata
Assignees
Labels
No labels