@@ -3381,79 +3381,6 @@ the buffer)."
3381
3381
(defun markdown-match-yaml-metadata-key (last)
3382
3382
(markdown-match-propertized-text 'markdown-metadata-key last))
3383
3383
3384
- (defun markdown-fontify-wiki-links (last)
3385
- "Add text properties to next wiki link from point to LAST."
3386
- (when (and markdown-enable-wiki-links
3387
- (markdown-match-inline-generic markdown-regex-wiki-link last))
3388
- (let* ((begin (match-beginning 1))
3389
- (end (match-end 1))
3390
- (beg2 (match-beginning 2))
3391
- (end2 (match-end 2))
3392
- (beg3 (match-beginning 3))
3393
- (end3 (match-end 3))
3394
- (beg4 (match-beginning 4))
3395
- (end4 (match-end 4))
3396
- (beg5 (match-beginning 5))
3397
- (end5 (match-end 5))
3398
- (beg6 (match-beginning 6))
3399
- (end6 (match-end 6))
3400
- (part1 (match-string-no-properties 3))
3401
- (part2 (match-string-no-properties 5))
3402
- (aliasp (string-equal (match-string-no-properties 4) "|"))
3403
- (file-name (markdown-convert-wiki-link-to-filename (markdown-wiki-link-link)))
3404
- (file-missing-p (not (file-exists-p file-name))))
3405
- (if (or (markdown-in-comment-p begin)
3406
- (markdown-in-comment-p end)
3407
- (markdown-inline-code-at-pos-p begin)
3408
- (markdown-inline-code-at-pos-p end)
3409
- (markdown-code-block-at-pos begin))
3410
- (progn (goto-char (min (1+ begin) last))
3411
- (when (< (point) last)
3412
- (markdown-fontify-wiki-links last)))
3413
- ;; Add text properties for hiding markup
3414
- (progn
3415
- (if aliasp
3416
- (progn
3417
- ;; Propertize pipe separating URL from link text
3418
- (add-text-properties beg4 end4 markup-props)
3419
- (add-face-text-property beg4 end4 'markdown-markup-face)
3420
- (if markdown-wiki-link-alias-first
3421
- (progn
3422
- (if (and file-missing-p markdown-wiki-link-fontify-missing)
3423
- (progn
3424
- (add-text-properties beg3 end3 (missing-link-props part2))
3425
- (put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face))
3426
- (progn
3427
- (add-text-properties beg3 end3 (link-props part2))
3428
- (put-text-property beg3 end3 'font-lock-face 'markdown-link-face)))
3429
- (progn
3430
- (add-text-properties beg5 end5 url-props)
3431
- (add-face-text-property beg5 end5 'markdown-url-face)))
3432
- (progn
3433
- (add-text-properties beg3 end3 url-props)
3434
- (add-face-text-property beg3 end3 'markdown-url-face)
3435
- (if (and file-missing-p markdown-wiki-link-fontify-missing)
3436
- (progn
3437
- (add-text-properties beg5 end5 (missing-link-props part1))
3438
- (put-text-property beg5 end5 'font-lock-face 'markdown-missing-link-face))
3439
- (progn
3440
- (add-text-properties beg5 end5 (link-props part1))
3441
- (put-text-property beg5 end5 'font-lock-face 'markdown-link-face))))))
3442
- (if (and file-missing-p markdown-wiki-link-fontify-missing)
3443
- (progn
3444
- (add-text-properties beg3 end3 (missing-link-props part1))
3445
- (put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face))
3446
- (progn
3447
- (add-text-properties beg3 end3 (link-props part1))
3448
- (put-text-property beg3 end3 'font-lock-face 'markdown-link-face))))
3449
- ;; Propertize opening and closing brackets
3450
- (add-text-properties beg2 end2 markup-props)
3451
- (add-text-properties beg6 end6 markup-props)
3452
- (add-face-text-property beg2 end2 'markdown-markup-face)
3453
- (add-face-text-property beg6 end6 'markdown-markup-face))
3454
- (set-match-data (list begin end))
3455
- t))))
3456
-
3457
3384
(defun markdown-match-inline-attributes (last)
3458
3385
"Match inline attributes from point to LAST."
3459
3386
;; #428 re-search-forward markdown-regex-inline-attributes is very slow.
@@ -3591,15 +3518,15 @@ SEQ may be an atom or a sequence."
3591
3518
(heading-face
3592
3519
(intern (format "markdown-header-face-%d" level)))
3593
3520
(heading-props `(face ,heading-face))
3594
- (left-markup-props
3521
+ (left-markdown-- markup-props
3595
3522
`(face markdown-header-delimiter-face
3596
3523
,@(cond
3597
3524
(markdown-hide-markup
3598
3525
`(display ""))
3599
3526
(markdown-marginalize-headers
3600
3527
`(display ((margin left-margin)
3601
3528
,(markdown--marginalize-string level)))))))
3602
- (right-markup-props
3529
+ (right-markdown-- markup-props
3603
3530
`(face markdown-header-delimiter-face
3604
3531
,@(when markdown-hide-markup `(display ""))))
3605
3532
(rule-props `(face markdown-header-rule-face
@@ -3619,7 +3546,7 @@ SEQ may be an atom or a sequence."
3619
3546
(min (point-max) (1+ (match-end 0)))
3620
3547
(match-end 0))))
3621
3548
(add-text-properties
3622
- (match-beginning 4) (match-end 4) left-markup-props)
3549
+ (match-beginning 4) (match-end 4) left-markdown-- markup-props)
3623
3550
3624
3551
;; If closing tag is present
3625
3552
(if (match-end 6)
@@ -3629,15 +3556,13 @@ SEQ may be an atom or a sequence."
3629
3556
(add-text-properties
3630
3557
(match-beginning 5) header-end heading-props)
3631
3558
(add-text-properties
3632
- (match-beginning 6) (match-end 6) right-markup-props))
3559
+ (match-beginning 6) (match-end 6) right-markdown-- markup-props))
3633
3560
(add-text-properties
3634
3561
(match-beginning 5) (match-end 5) heading-props)
3635
3562
(add-text-properties
3636
- (match-beginning 6) header-end right-markup-props)))
3563
+ (match-beginning 6) header-end right-markdown-- markup-props)))
3637
3564
;; If closing tag is not present
3638
- (add-text-properties
3639
- (match-beginning 5) header-end heading-props))
3640
- )))
3565
+ (add-text-properties (match-beginning 5) header-end heading-props)))))
3641
3566
t))
3642
3567
3643
3568
(defun markdown-fontify-tables (last)
@@ -5286,8 +5211,7 @@ Otherwise, do normal delete by repeating
5286
5211
(back-to-indentation)
5287
5212
(unless (looking-at-p "[ \t]*$")
5288
5213
(setq mincol (min mincol (current-column))))
5289
- (forward-line 1)
5290
- ))
5214
+ (forward-line 1)))
5291
5215
mincol))
5292
5216
5293
5217
(defun markdown-indent-region (beg end arg)
@@ -5762,6 +5686,36 @@ Assumes match data is available for `markdown-regex-italic'."
5762
5686
"Keymap for `gfm-mode'.
5763
5687
See also `markdown-mode-map'.")
5764
5688
5689
+
5690
+ ;;; Text Properties ===========================================================
5691
+
5692
+ (defconst markdown--markup-props (list 'invisible 'markdown-markup
5693
+ 'rear-nonsticky t
5694
+ 'font-lock-multiline t))
5695
+
5696
+ (defconst markdown--url-props (list 'invisible 'markdown-markup
5697
+ 'keymap markdown-mode-mouse-map
5698
+ 'mouse-face 'markdown-highlight-face
5699
+ 'font-lock-multiline t))
5700
+
5701
+ (defconst markdown--title-props (list 'invisible 'markdown-markup
5702
+ 'font-lock-multiline t))
5703
+
5704
+ (defun markdown--link-props (url &optional title)
5705
+ "Return a property list for URL with optional TITLE."
5706
+ (let ((echo-text (if title (concat title "\n" url) url)))
5707
+ (list 'keymap markdown-mode-mouse-map
5708
+ 'mouse-face 'markdown-highlight-face
5709
+ 'font-lock-multiline t
5710
+ 'help-echo echo-text)))
5711
+
5712
+ (defun markdown--missing-link-props (url)
5713
+ "Return a property list for URL for file that doesn't exist."
5714
+ (list 'keymap markdown-mode-mouse-map
5715
+ 'mouse-face 'markdown-highlight-face
5716
+ 'font-lock-multiline t
5717
+ 'help-echo url))
5718
+
5765
5719
5766
5720
;;; Menu ======================================================================
5767
5721
@@ -8229,33 +8183,6 @@ Translate filenames using `markdown-filename-translate-function'."
8229
8183
(markdown--browse-url (markdown-link-url)))
8230
8184
(user-error "Point is not at a Markdown link or URL")))
8231
8185
8232
- (defconst markup-props (list 'invisible 'markdown-markup
8233
- 'rear-nonsticky t
8234
- 'font-lock-multiline t))
8235
-
8236
- (defconst url-props (list 'invisible 'markdown-markup
8237
- 'keymap markdown-mode-mouse-map
8238
- 'mouse-face 'markdown-highlight-face
8239
- 'font-lock-multiline t))
8240
-
8241
- (defconst title-props (list 'invisible 'markdown-markup
8242
- 'font-lock-multiline t))
8243
-
8244
- (defun link-props (url &optional title)
8245
- "Return a property list for URL with optional TITLE."
8246
- (let ((echo-text (if title (concat title "\n" url) url)))
8247
- (list 'keymap markdown-mode-mouse-map
8248
- 'mouse-face 'markdown-highlight-face
8249
- 'font-lock-multiline t
8250
- 'help-echo echo-text)))
8251
-
8252
- (defun missing-link-props (url)
8253
- "Return a property list for URL for file that doesn't exist."
8254
- (list 'keymap markdown-mode-mouse-map
8255
- 'mouse-face 'markdown-highlight-face
8256
- 'font-lock-multiline t
8257
- 'help-echo url))
8258
-
8259
8186
(defun markdown-fontify-inline-links (last)
8260
8187
"Add text properties to next inline link from point to LAST."
8261
8188
(when (markdown-match-generic-links last nil)
@@ -8270,17 +8197,17 @@ Translate filenames using `markdown-filename-translate-function'."
8270
8197
(url-char (markdown--first-displayable markdown-url-compose-char)))
8271
8198
(dolist (g '(1 2 4 5 8))
8272
8199
(when (match-end g)
8273
- (add-text-properties (match-beginning g) (match-end g) markup-props)
8200
+ (add-text-properties (match-beginning g) (match-end g) markdown-- markup-props)
8274
8201
(add-face-text-property (match-beginning g) (match-end g) 'markdown-markup-face)))
8275
8202
;; Preserve existing faces applied to link part (e.g., inline code)
8276
8203
(when link-start
8277
- (add-text-properties link-start link-end (link-props url title))
8204
+ (add-text-properties link-start link-end (markdown-- link-props url title))
8278
8205
(add-face-text-property link-start link-end 'markdown-link-face))
8279
8206
(when url-start
8280
- (add-text-properties url-start url-end url-props)
8207
+ (add-text-properties url-start url-end markdown-- url-props)
8281
8208
(add-face-text-property url-start url-end 'markdown-url-face))
8282
8209
(when title-start
8283
- (add-text-properties url-end title-end title-props)
8210
+ (add-text-properties url-end title-end markdown-- title-props)
8284
8211
(add-face-text-property url-end title-end 'markdown-link-title-face))
8285
8212
(when (and markdown-hide-urls url-start)
8286
8213
(compose-region url-start (or title-end url-end) url-char))
@@ -8326,6 +8253,79 @@ Translate filenames using `markdown-filename-translate-function'."
8326
8253
(compose-region ref-start ref-end url-char)))
8327
8254
t)))
8328
8255
8256
+ (defun markdown-fontify-wiki-links (last)
8257
+ "Add text properties to next wiki link from point to LAST."
8258
+ (when (and markdown-enable-wiki-links
8259
+ (markdown-match-inline-generic markdown-regex-wiki-link last))
8260
+ (let* ((begin (match-beginning 1))
8261
+ (end (match-end 1))
8262
+ (beg2 (match-beginning 2))
8263
+ (end2 (match-end 2))
8264
+ (beg3 (match-beginning 3))
8265
+ (end3 (match-end 3))
8266
+ (beg4 (match-beginning 4))
8267
+ (end4 (match-end 4))
8268
+ (beg5 (match-beginning 5))
8269
+ (end5 (match-end 5))
8270
+ (beg6 (match-beginning 6))
8271
+ (end6 (match-end 6))
8272
+ (part1 (match-string-no-properties 3))
8273
+ (part2 (match-string-no-properties 5))
8274
+ (aliasp (string-equal (match-string-no-properties 4) "|"))
8275
+ (file-name (markdown-convert-wiki-link-to-filename (markdown-wiki-link-link)))
8276
+ (file-missing-p (not (file-exists-p file-name))))
8277
+ (if (or (markdown-in-comment-p begin)
8278
+ (markdown-in-comment-p end)
8279
+ (markdown-inline-code-at-pos-p begin)
8280
+ (markdown-inline-code-at-pos-p end)
8281
+ (markdown-code-block-at-pos begin))
8282
+ (progn (goto-char (min (1+ begin) last))
8283
+ (when (< (point) last)
8284
+ (markdown-fontify-wiki-links last)))
8285
+ ;; Add text properties for hiding markup
8286
+ (progn
8287
+ (if aliasp
8288
+ (progn
8289
+ ;; Propertize pipe separating URL from link text
8290
+ (add-text-properties beg4 end4 markdown--markup-props)
8291
+ (add-face-text-property beg4 end4 'markdown-markup-face)
8292
+ (if markdown-wiki-link-alias-first
8293
+ (progn
8294
+ (if (and file-missing-p markdown-wiki-link-fontify-missing)
8295
+ (progn
8296
+ (add-text-properties beg3 end3 (markdown--missing-link-props part2))
8297
+ (put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face))
8298
+ (progn
8299
+ (add-text-properties beg3 end3 (markdown--link-props part2))
8300
+ (put-text-property beg3 end3 'font-lock-face 'markdown-link-face)))
8301
+ (progn
8302
+ (add-text-properties beg5 end5 markdown--url-props)
8303
+ (add-face-text-property beg5 end5 'markdown-url-face)))
8304
+ (progn
8305
+ (add-text-properties beg3 end3 markdown--url-props)
8306
+ (add-face-text-property beg3 end3 'markdown-url-face)
8307
+ (if (and file-missing-p markdown-wiki-link-fontify-missing)
8308
+ (progn
8309
+ (add-text-properties beg5 end5 (markdown--missing-link-props part1))
8310
+ (put-text-property beg5 end5 'font-lock-face 'markdown-missing-link-face))
8311
+ (progn
8312
+ (add-text-properties beg5 end5 (markdown--link-props part1))
8313
+ (put-text-property beg5 end5 'font-lock-face 'markdown-link-face))))))
8314
+ (if (and file-missing-p markdown-wiki-link-fontify-missing)
8315
+ (progn
8316
+ (add-text-properties beg3 end3 (markdown--missing-link-props part1))
8317
+ (put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face))
8318
+ (progn
8319
+ (add-text-properties beg3 end3 (markdown--link-props part1))
8320
+ (put-text-property beg3 end3 'font-lock-face 'markdown-link-face))))
8321
+ ;; Propertize opening and closing brackets
8322
+ (add-text-properties beg2 end2 markdown--markup-props)
8323
+ (add-text-properties beg6 end6 markdown--markup-props)
8324
+ (add-face-text-property beg2 end2 'markdown-markup-face)
8325
+ (add-face-text-property beg6 end6 'markdown-markup-face))
8326
+ (set-match-data (list begin end))
8327
+ t))))
8328
+
8329
8329
(defun markdown-fontify-angle-uris (last)
8330
8330
"Add text properties to angle URIs from point to LAST."
8331
8331
(when (markdown-match-angle-uris last)
0 commit comments