@@ -3384,76 +3384,6 @@ the buffer)."
3384
3384
(defun markdown-match-yaml-metadata-key (last)
3385
3385
(markdown-match-propertized-text 'markdown-metadata-key last))
3386
3386
3387
- (defun markdown-fontify-wiki-links (last)
3388
- "Add text properties to next wiki link from point to LAST."
3389
- (when (and markdown-enable-wiki-links
3390
- (markdown-match-inline-generic markdown-regex-wiki-link last))
3391
- (let* ((begin (match-beginning 1))
3392
- (end (match-end 1))
3393
- (beg2 (match-beginning 2))
3394
- (end2 (match-end 2))
3395
- (beg3 (match-beginning 3))
3396
- (end3 (match-end 3))
3397
- (beg4 (match-beginning 4))
3398
- (end4 (match-end 4))
3399
- (beg5 (match-beginning 5))
3400
- (end5 (match-end 5))
3401
- (beg6 (match-beginning 6))
3402
- (end6 (match-end 6))
3403
- (part1 (match-string-no-properties 3))
3404
- (part2 (match-string-no-properties 5))
3405
- (aliasp (string-equal (match-string-no-properties 4) "|"))
3406
- (file-name (markdown-convert-wiki-link-to-filename (markdown-wiki-link-link)))
3407
- (file-missing-p (not (file-exists-p file-name))))
3408
- (if (or (markdown-in-comment-p begin)
3409
- (markdown-in-comment-p end)
3410
- (markdown-inline-code-at-pos-p begin)
3411
- (markdown-inline-code-at-pos-p end)
3412
- (markdown-code-block-at-pos begin))
3413
- (progn (goto-char (min (1+ begin) last))
3414
- (when (< (point) last)
3415
- (markdown-fontify-wiki-links last)))
3416
- ;; Add text properties for hiding markup
3417
- (progn
3418
- ;; Propertize opening and closing brackets
3419
- (remove-text-properties begin end '(font-lock-face nil))
3420
- (add-text-properties beg2 end2 markup-props)
3421
- (add-face-text-property beg2 end2 'markdown-markup-face)
3422
- (add-text-properties beg6 end6 markup-props)
3423
- (add-face-text-property beg6 end6 'markdown-markup-face)
3424
- (if aliasp
3425
- (progn
3426
- ;; Propertize pipe separating URL from link text
3427
- (add-text-properties beg4 end4 markup-props)
3428
- (add-face-text-property beg4 end4 'markdown-markup-face)
3429
- (if markdown-wiki-link-alias-first
3430
- (progn
3431
- ;; Properties alias portion of link
3432
- (add-text-properties beg3 end3 (link-props part2))
3433
- (add-face-text-property beg3 end3 'markdown-link-face)
3434
- (add-text-properties beg5 end5 url-props)
3435
- (add-text-properties beg5 end5 '(invisible markdown-markup))
3436
- (add-face-text-property beg5 end5 'markdown-url-face)
3437
- (when (and file-missing-p markdown-wiki-link-fontify-missing)
3438
- (put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face)))
3439
- (progn
3440
- ;; Properties URL portion of link
3441
- (add-text-properties beg3 end3 url-props)
3442
- (add-text-properties beg3 end3 '(invisible markdown-markup))
3443
- (add-face-text-property beg3 end3 'markdown-url-face)
3444
- (add-text-properties beg5 end5 (link-props part1))
3445
- (add-face-text-property beg5 end5 'markdown-link-face)
3446
- (when (and file-missing-p markdown-wiki-link-fontify-missing)
3447
- (put-text-property beg5 end5 'font-lock-face 'markdown-missing-link-face)))))
3448
- (progn
3449
- ;; Properties link as link text
3450
- (add-text-properties beg3 end3 (link-props part1))
3451
- (add-face-text-property beg3 end3 'markdown-link-face)
3452
- (when (and file-missing-p markdown-wiki-link-fontify-missing)
3453
- (put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face)))))
3454
- (set-match-data (list begin end))
3455
- t))))
3456
-
3457
3387
(defun markdown-match-inline-attributes (last)
3458
3388
"Match inline attributes from point to LAST."
3459
3389
;; #428 re-search-forward markdown-regex-inline-attributes is very slow.
@@ -5757,6 +5687,29 @@ Assumes match data is available for `markdown-regex-italic'."
5757
5687
"Keymap for `gfm-mode'.
5758
5688
See also `markdown-mode-map'.")
5759
5689
5690
+
5691
+ ;;; Text Properties ===========================================================
5692
+
5693
+ (defconst markdown--markup-props (list 'invisible 'markdown-markup
5694
+ 'rear-nonsticky t
5695
+ 'font-lock-multiline t))
5696
+
5697
+ (defconst markdown--url-props (list 'invisible 'markdown-markup
5698
+ 'keymap markdown-mode-mouse-map
5699
+ 'mouse-face 'markdown-highlight-face
5700
+ 'font-lock-multiline t))
5701
+
5702
+ (defconst markdown--title-props (list 'invisible 'markdown-markup
5703
+ 'font-lock-multiline t))
5704
+
5705
+ (defun markdown--link-props (url &optional title)
5706
+ "Return a property list for URL with optional TITLE."
5707
+ (let ((echo-text (if title (concat title "\n" url) url)))
5708
+ (list 'keymap markdown-mode-mouse-map
5709
+ 'mouse-face 'markdown-highlight-face
5710
+ 'font-lock-multiline t
5711
+ 'help-echo echo-text)))
5712
+
5760
5713
5761
5714
;;; Menu ======================================================================
5762
5715
@@ -8222,26 +8175,6 @@ Translate filenames using `markdown-filename-translate-function'."
8222
8175
(markdown--browse-url (markdown-link-url)))
8223
8176
(user-error "Point is not at a Markdown link or URL")))
8224
8177
8225
- (defconst markup-props (list 'invisible 'markdown-markup
8226
- 'rear-nonsticky t
8227
- 'font-lock-multiline t))
8228
-
8229
- (defconst url-props (list 'invisible 'markdown-markup
8230
- 'keymap markdown-mode-mouse-map
8231
- 'mouse-face 'markdown-highlight-face
8232
- 'font-lock-multiline t))
8233
-
8234
- (defconst title-props (list 'invisible 'markdown-markup
8235
- 'font-lock-multiline t))
8236
-
8237
- (defun link-props (url &optional title)
8238
- "Return a property list for URL with optional TITLE."
8239
- (let ((echo-text (if title (concat title "\n" url) url)))
8240
- (list 'keymap markdown-mode-mouse-map
8241
- 'mouse-face 'markdown-highlight-face
8242
- 'font-lock-multiline t
8243
- 'help-echo echo-text)))
8244
-
8245
8178
(defun markdown-fontify-inline-links (last)
8246
8179
"Add text properties to next inline link from point to LAST."
8247
8180
(when (markdown-match-generic-links last nil)
@@ -8256,17 +8189,17 @@ Translate filenames using `markdown-filename-translate-function'."
8256
8189
(url-char (markdown--first-displayable markdown-url-compose-char)))
8257
8190
(dolist (g '(1 2 4 5 8))
8258
8191
(when (match-end g)
8259
- (add-text-properties (match-beginning g) (match-end g) markup-props)
8192
+ (add-text-properties (match-beginning g) (match-end g) markdown-- markup-props)
8260
8193
(add-face-text-property (match-beginning g) (match-end g) 'markdown-markup-face)))
8261
8194
;; Preserve existing faces applied to link part (e.g., inline code)
8262
8195
(when link-start
8263
- (add-text-properties link-start link-end (link-props url title))
8196
+ (add-text-properties link-start link-end (markdown-- link-props url title))
8264
8197
(add-face-text-property link-start link-end 'markdown-link-face))
8265
8198
(when url-start
8266
- (add-text-properties url-start url-end url-props)
8199
+ (add-text-properties url-start url-end markdown-- url-props)
8267
8200
(add-face-text-property url-start url-end 'markdown-url-face))
8268
8201
(when title-start
8269
- (add-text-properties url-end title-end title-props)
8202
+ (add-text-properties url-end title-end markdown-- title-props)
8270
8203
(add-face-text-property url-end title-end 'markdown-link-title-face))
8271
8204
(when (and markdown-hide-urls url-start)
8272
8205
(compose-region url-start (or title-end url-end) url-char))
@@ -8296,7 +8229,7 @@ Translate filenames using `markdown-filename-translate-function'."
8296
8229
'font-lock-multiline t)))
8297
8230
(dolist (g '(1 2 4 5 8))
8298
8231
(when (match-end g)
8299
- (add-text-properties (match-beginning g) (match-end g) markup-props)
8232
+ (add-text-properties (match-beginning g) (match-end g) markdown-- markup-props)
8300
8233
(add-face-text-property (match-beginning g) (match-end g) 'markdown-markup-face)))
8301
8234
(when link-start
8302
8235
(add-text-properties link-start link-end lp)
@@ -8308,6 +8241,76 @@ Translate filenames using `markdown-filename-translate-function'."
8308
8241
(compose-region ref-start ref-end url-char)))
8309
8242
t)))
8310
8243
8244
+ (defun markdown-fontify-wiki-links (last)
8245
+ "Add text properties to next wiki link from point to LAST."
8246
+ (when (and markdown-enable-wiki-links
8247
+ (markdown-match-inline-generic markdown-regex-wiki-link last))
8248
+ (let* ((begin (match-beginning 1))
8249
+ (end (match-end 1))
8250
+ (beg2 (match-beginning 2))
8251
+ (end2 (match-end 2))
8252
+ (beg3 (match-beginning 3))
8253
+ (end3 (match-end 3))
8254
+ (beg4 (match-beginning 4))
8255
+ (end4 (match-end 4))
8256
+ (beg5 (match-beginning 5))
8257
+ (end5 (match-end 5))
8258
+ (beg6 (match-beginning 6))
8259
+ (end6 (match-end 6))
8260
+ (part1 (match-string-no-properties 3))
8261
+ (part2 (match-string-no-properties 5))
8262
+ (aliasp (string-equal (match-string-no-properties 4) "|"))
8263
+ (file-name (markdown-convert-wiki-link-to-filename (markdown-wiki-link-link)))
8264
+ (file-missing-p (not (file-exists-p file-name))))
8265
+ (if (or (markdown-in-comment-p begin)
8266
+ (markdown-in-comment-p end)
8267
+ (markdown-inline-code-at-pos-p begin)
8268
+ (markdown-inline-code-at-pos-p end)
8269
+ (markdown-code-block-at-pos begin))
8270
+ (progn (goto-char (min (1+ begin) last))
8271
+ (when (< (point) last)
8272
+ (markdown-fontify-wiki-links last)))
8273
+ ;; Add text properties for hiding markup
8274
+ (progn
8275
+ ;; Propertize opening and closing brackets
8276
+ (remove-text-properties begin end '(font-lock-face nil))
8277
+ (add-text-properties beg2 end2 markdown--markup-props)
8278
+ (add-face-text-property beg2 end2 'markdown-markup-face)
8279
+ (add-text-properties beg6 end6 markdown--markup-props)
8280
+ (add-face-text-property beg6 end6 'markdown-markup-face)
8281
+ (if aliasp
8282
+ (progn
8283
+ ;; Propertize pipe separating URL from link text
8284
+ (add-text-properties beg4 end4 markdown--markup-props)
8285
+ (add-face-text-property beg4 end4 'markdown-markup-face)
8286
+ (if markdown-wiki-link-alias-first
8287
+ (progn
8288
+ ;; Properties alias portion of link
8289
+ (add-text-properties beg3 end3 (markdown--link-props part2))
8290
+ (add-face-text-property beg3 end3 'markdown-link-face)
8291
+ (add-text-properties beg5 end5 markdown--url-props)
8292
+ (add-text-properties beg5 end5 '(invisible markdown-markup))
8293
+ (add-face-text-property beg5 end5 'markdown-url-face)
8294
+ (when (and file-missing-p markdown-wiki-link-fontify-missing)
8295
+ (put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face)))
8296
+ (progn
8297
+ ;; Properties URL portion of link
8298
+ (add-text-properties beg3 end3 markdown--url-props)
8299
+ (add-text-properties beg3 end3 '(invisible markdown-markup))
8300
+ (add-face-text-property beg3 end3 'markdown-url-face)
8301
+ (add-text-properties beg5 end5 (markdown--link-props part1))
8302
+ (add-face-text-property beg5 end5 'markdown-link-face)
8303
+ (when (and file-missing-p markdown-wiki-link-fontify-missing)
8304
+ (put-text-property beg5 end5 'font-lock-face 'markdown-missing-link-face)))))
8305
+ (progn
8306
+ ;; Properties link as link text
8307
+ (add-text-properties beg3 end3 (markdown--link-props part1))
8308
+ (add-face-text-property beg3 end3 'markdown-link-face)
8309
+ (when (and file-missing-p markdown-wiki-link-fontify-missing)
8310
+ (put-text-property beg3 end3 'font-lock-face 'markdown-missing-link-face)))))
8311
+ (set-match-data (list begin end))
8312
+ t))))
8313
+
8311
8314
(defun markdown-fontify-angle-uris (last)
8312
8315
"Add text properties to angle URIs from point to LAST."
8313
8316
(when (markdown-match-angle-uris last)
@@ -8319,7 +8322,7 @@ Translate filenames using `markdown-filename-translate-function'."
8319
8322
'mouse-face 'markdown-highlight-face
8320
8323
'font-lock-multiline t)))
8321
8324
(dolist (g '(1 3))
8322
- (add-text-properties (match-beginning g) (match-end g) markup-props))
8325
+ (add-text-properties (match-beginning g) (match-end g) markdown-- markup-props))
8323
8326
(add-text-properties url-start url-end up)
8324
8327
t)))
8325
8328
0 commit comments