Org-mode mailing list
 help / color / mirror / Atom feed
From: Sameer Rahmani <lxsameer@gnu.org>
To: emacs-orgmode@gnu.org
Cc: Sameer Rahmani <lxsameer@gnu.org>
Subject: [PATCH] ox-html.el: Add HTML_CONTENT_CLASS to support css classes in content tag
Date: Mon,  8 Feb 2021 22:46:51 +0000
Message-ID: <20210208224651.32680-1-lxsameer@gnu.org> (raw)

* ox-html.el (org-html-template): Added the support for a CSS class name
to the content tag which wraps the entire content. The CSS class name
can be set via in buffer HTML_CONTENT_CLASS property or :html-content-class
for org publish.
---
 lisp/ox-html.el | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 11757bb35e8c..766897d0a032 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -113,6 +113,7 @@
   :options-alist
   '((:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
     (:html-container "HTML_CONTAINER" nil org-html-container-element)
+    (:html-content-class "HTML_CONTENT_CLASS" nil org-html-content-class)
     (:description "DESCRIPTION" nil nil newline)
     (:keywords "KEYWORDS" nil nil space)
     (:html-html5-fancy nil "html5-fancy" org-html-html5-fancy)
@@ -1084,6 +1085,16 @@ org-info.js for your website."
   :package-version '(Org . "8.0")
   :type 'string)
 
+(defcustom org-html-content-class "content"
+  "CSS class name to use for the top level content wrapper.
+Can be set with the in-buffer HTML_CONTENT_CLASS property or for
+publishing, with :html-content-class."
+  :group 'org-export-html
+  :version "27.1"
+  :package-version '(Org . "9.3.8")
+  :type 'string)
+
+
 (defcustom org-html-divs
   '((preamble  "div" "preamble")
     (content   "div" "content")
@@ -2120,7 +2131,10 @@ holding export options."
    (org-html--build-pre/postamble 'preamble info)
    ;; Document contents.
    (let ((div (assq 'content (plist-get info :html-divs))))
-     (format "<%s id=\"%s\">\n" (nth 1 div) (nth 2 div)))
+     (format "<%s id=\"%s\" class=\"%s\">\n"
+             (nth 1 div)
+             (nth 2 div)
+             (plist-get info :html-content-class)))
    ;; Document title.
    (when (plist-get info :with-title)
      (let ((title (and (plist-get info :with-title)
-- 
2.26.2



                 reply	other threads:[~2021-02-11 17:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://orgmode.org

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210208224651.32680-1-lxsameer@gnu.org \
    --to=lxsameer@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git