You reach your goal quite simple if you use source blocks instead of special blocks.
Define your own major mode, say mypar-mode
with the help of define-generic-mode
or define-derived-mode
and setup the fontification for that major mode like you want it.
Make sure that org-src-fontify-natively
and org-src-preserve-indentation
are both set to t such that the mypar
source blocks in the Org buffer look as much as possible like the fontified source buffers.
If you have htmlize
installed you get most of the wanted formatting in the HTML export for free.
A code example that I have tested with Emacs 27.1 and Org 9.3.7:
(require 'org)
(require 'cl-lib)
(define-generic-mode mypar-mode
nil ;; comment-list
nil ;; keyword-list
;; font-lock-list:
'(("^.*$"
;; match-highlight:
(0 ;; subexpression
;; facename:
`(face (:inherit default :foreground "orange" :height 1.5 :weight bold) ;; we use an anonymous face
;; indent:
line-prefix "\t"
wrap-prefix "\t")
)))
nil ;; auto-mode-list
'((lambda ()
"Make `line-prefix' and `wrap-prefix' work in the source fontification buffer."
(setq-local font-lock-extra-managed-props '(line-prefix wrap-prefix))
));; function-list
"Formatting MYPAR blocks.")
(defun org+-hack-org-fontification ()
"Make `wrap-prefix' and `line-prefix' text properties work in Org buffers."
(setq-local font-lock-extra-managed-props (cl-union
'(line-prefix wrap-prefix)
font-lock-extra-managed-props)))
(add-hook 'org-mode-hook #'org+-hack-org-fontification)
(setq org-src-fontify-natively t
org-src-preserve-indentation t)
At last an image how a mypar
source block looks like in Org:

defblock
macro from alhassy.github.io/org-special-block-extras ;-) ---There's a#+begin_orange
block ready for use, which can be adapted for your needs.