Variable: markdown-ts-code-block-context-mode
markdown-ts-code-block-context-mode is a buffer-local variable defined
in markdown-ts-mode.el.gz.
Documentation
Non-nil if Markdown-Ts-Code-Block-Context mode is enabled.
Use the command markdown-ts-code-block-context-mode(var)/markdown-ts-code-block-context-mode(fun) to change this
variable.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(define-minor-mode markdown-ts-code-block-context-mode
"Minor mode to enable commands in fenced code block context.
If non-nil and `point' is in a fenced code block, run `indent-for-tab-command',
`newline', et.al., in the mode of the code block."
:group 'markdown-ts
:interactive nil
(markdown-ts--barf-if-not-mode 'markdown-ts-code-block-context-mode)
(cond (markdown-ts-code-block-context-mode
;; Enable the minor mode `markdown-ts-code-block-in-context-mode' and
;; its keymap when point is within a code block.
(add-hook 'post-command-hook
#'markdown-ts--enable-code-block-in-context-mode nil 'local)
;; If `save-place-mode' or similar is used, point could start within
;; a code block so initialize from that state.
(run-with-timer 0.01 nil
#'markdown-ts--enable-code-block-in-context-mode)
;; For each eligible command, execute it in a code-block context,
;; otherwise in the `markdown-ts-mode' buffer's context.
(add-hook 'pre-command-hook
#'markdown-ts--maybe-run-command-in-code-block nil 'local)
;; Prune stale code block overlays when the host parse tree
;; changes (e.g., when fenced code block delimiters are
;; deleted but the overlay from a prior fontification remains).
(treesit-parser-add-notifier
treesit-primary-parser
#'markdown-ts--host-ranges-notifier))
(t
(remove-hook 'post-command-hook
#'markdown-ts--enable-code-block-in-context-mode 'local)
(remove-hook 'pre-command-hook
#'markdown-ts--maybe-run-command-in-code-block 'local)
(treesit-parser-remove-notifier
treesit-primary-parser
#'markdown-ts--host-ranges-notifier))))