               600)))
     (org-display-inline-images)))
 
+(defun spacemacs//space-doc-tags-fontify (startish endish &optional verbose)
+  "Fontify `org-mode' tags in the fuzzy region that might start
+ before STARTISH and end after ENDISH. VERBOSE ignored."
+  ;; TODO add more types of tags or meta-line if needed.
+  (let ((invisible-org-meta-tags-list
+         `(;; Hide TITLE tag.
+           "\\([ \t]*\\#\\+TITLE\\:\[ \t]*\\)"
+           ;; Hide CAPTION logo meta line.
+           "\\(\n.*\\#\\+CAPTION\\:.*\\)"
+           ;; Hide TOC-ORG tag and spaces before it.
+           ;; Use modified `toc-org-toc-org-regexp' because
+           ;; the original one matches whole string.
+           ,(concat "\\([ \t]*:toc\\([@_][0-9]\\|\\([@_][0-9]"
+                    "[@_][a-zA-Z]+\\)\\)?:\\($\\|[^ ]*:$\\)\\)")
+           ;; Hide empty line before #+BEGIN_SRC tag if
+           ;; background color of the `org-block-begin-line'
+           ;; face is unspecified.
+           ,(unless (face-background 'org-block-begin-line)
+              "\n\\(\n\\)[ \t]*\\#\\+begin_src.*$")
+           ;; Hide empty line after #+END_SRC tag if
+           ;; background color of the `org-block-end-line'
+           ;; face is unspecified and the next line isn't
+           ;;an org headline.
+           ,(unless (face-background 'org-block-end-line)
+              "^[ \t]*\\#\\+end_src.*\n\\(\n\\)[^\\*]")))
+        (start (save-excursion (goto-char startish)
+                               (point-at-bol -15)))
+        (end   (save-excursion (goto-char endish)
+                               (point-at-eol 15))))
+    ;; Remove nils.
+    (setq invisible-org-meta-tags-list
+          (remove nil invisible-org-meta-tags-list))
+    ;; Make `org-mode' meta tags invisible.
+    (dolist (tag invisible-org-meta-tags-list)
+      (save-excursion
+        (goto-char start)
+        (while (re-search-forward tag end t)
+          (add-text-properties (match-beginning 1)
+                               (match-end 1)
+                               (list 'invisible 'spacemacs--space-doc-invisible-marker)))))))
+
+(defun spacemacs//space-doc-font-lock-fontify-region-function (start end &optional verbose)
+  "Wrapper around `font-lock-default-fontify-region' function for the buffer local value of
+`font-lock-fontify-region-function'. Makes sure that `font-lock-default-fontify-region'
+text property persist after `org-mode' shenanigans.
+NOTE: Not using `advice-add' because it is global modification.
+FIXME: Find cleaner solution."
+  (font-lock-default-fontify-region  start end verbose)
+  (spacemacs//space-doc-tags-fontify start end verbose))
+
 (defun spacemacs//space-doc-alternative-tags-look (&optional enable)
   "Modify meta tag appearance.
 If ENABLE is non-nil, modify `org-mode' meta tags appearance in the current
 buffer.
-Otherwise, disable modifcations.
-This functions is aimed to be used with `spacemacs-space-doc-modificators'."
-  (if enable
-      ;; TODO add more types of tags or meta-line if needed.
-      (let* ((invisible-org-meta-tags-list
-              `(;; Hide TITLE tag.
-                ("\\([ \t]*\\#\\+TITLE\\:\[ \t]*\\)"
-                 invisible t)
-                ;; Hide CAPTION logo meta line.
-                ("\\(\n.*\\#\\+CAPTION\\:.*\\)"
-                 invisible t)
-                ;; Hide TOC-ORG tag and spaces before it.
-                ;; Use modified `toc-org-toc-org-regexp' because
-                ;; the original one matches whole string.
-                (,(concat "\\([ \t]*:toc\\([@_][0-9]\\|\\([@_][0-9]"
-                          "[@_][a-zA-Z]+\\)\\)?:\\($\\|[^ ]*:$\\)\\)")
-                 invisible t)
-                ;; Hide empty line before #+BEGIN_SRC tag if
-                ;; background color of the `org-block-begin-line'
-                ;; face is unspecified.
-                ,(unless (face-background 'org-block-begin-line)
-                   '("\n\\(\n\\)[ \t]*\\#\\+begin_src.*$"
-                     invisible t))
-                ;; Hide empty line after #+END_SRC tag if
-                ;; background color of the `org-block-end-line'
-                ;; face is unspecified and the next line isn't
-                ;;an org headline.
-                ,(unless (face-background 'org-block-end-line)
-                   '("^[ \t]*\\#\\+end_src.*\n\\(\n\\)[^\\*]"
-                     invisible t)))))
-        ;; Remove nils.
-        (setq invisible-org-meta-tags-list
-              (remove nil invisible-org-meta-tags-list))
-        ;; Make `org-mode' meta tags invisible.
-        (dolist (tag invisible-org-meta-tags-list)
-          (save-excursion
-            (goto-char (point-min))
-            (while (re-search-forward (car tag) nil t)
-              (let ((new-overlay
-                     (make-overlay (match-beginning 1)
-                                   (match-end 1))))
-                (overlay-put new-overlay  (cadr tag) (cddr tag))
-                (overlay-put new-overlay 'space-doc-tag-overlay t))))))
-    ;; Remove overlays.
-    (dolist (overlay (overlays-in (point-min) (point-max)))
-      (when (overlay-get overlay 'space-doc-tag-overlay)
-        (delete-overlay overlay)))))
+This functions is aimed to be used with `spacemacs-space-doc-modificators'."
+  (if enable
+      (setq-local font-lock-fontify-region-function
+                  'spacemacs//space-doc-font-lock-fontify-region-function)
+    (kill-local-variable 'font-lock-fontify-region-function)))
 
 (defun spacemacs//space-doc-org-block-line-face-remap (&optional enable)
   "Hide drawers.

    ;; Also it has to be run when the `window-body-width' is properly calculated.
    (run-with-idle-timer 0 nil 'spacemacs-centered-buffer-mode))
  (spacemacs-centered-buffer-mode -1))

(defun spacemacs//space-doc-centered-buffer-mode-hook ()
  "Apply `spacemacs//space-doc-alternative-emphasis' to the `current-buffer'
if `space-doc-mode' is enabled."
  (when space-doc-mode
    (when (member 'alternative-emphasis
                  spacemacs-space-doc-modificators)
      (spacemacs//space-doc-alternative-emphasis t))
    (when (member 'alternative-tags-look
                  spacemacs-space-doc-modificators)
      (spacemacs//space-doc-alternative-tags-look t))))

(when (member 'center-buffer-mode
              spacemacs-space-doc-modificators)
  (add-hook 'spacemacs-centered-buffer-mode-hook
            'spacemacs//space-doc-centered-buffer-mode-hook))

(defun spacemacs//space-doc-org-indent-mode (&optional flag)
  "Enable `org-indent-mode' if flag is non nil, disable it otherwise.

  :group 'space-doc
  (spacemacs//space-doc-centered-buffer-mode-goto-origin space-doc-mode)
  (if (derived-mode-p 'org-mode)
      (let ((inhibit-read-only t))
        (spacemacs//space-doc-set-cache space-doc-mode)
        (dolist (modificator spacemacs-space-doc-modificators-functions)
          (when (member (car modificator)
                        spacemacs-space-doc-modificators)
            (funcall (cdr modificator) space-doc-mode))))
    ;; Force `org-mode' to replace font text properties with the default ones.
    (unless space-doc-mode (org-font-lock-ensure))
    (message (format "space-doc-mode error:%s isn't an org-mode buffer"
                     (buffer-name)))
    (setq space-doc-mode nil)))
