Skip to content

Instantly share code, notes, and snippets.

@takaxp
Last active September 24, 2019 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takaxp/979f36cdb92891d75b37b3e185c98e0d to your computer and use it in GitHub Desktop.
Save takaxp/979f36cdb92891d75b37b3e185c98e0d to your computer and use it in GitHub Desktop.
A patch for ox-html to use CUTOM_IDs on id tags.
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 757006321..0286317e5 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2256,11 +2256,10 @@ line of code."
(format "<span class=\"linenr\">%s</span>"
(format num-fmt line-num)))
;; Transcoded src line.
- (format "<code%s>%s</code>"
- (if num-start
- (format " data-ox-html-linenr=\"%s\"" line-num)
- "")
- loc)
+ (if num-start
+ (format "<code data-ox-html-linenr=\"%s\">%s</code>"
+ line-num loc)
+ loc)
;; Add label, if needed.
(when (and ref retain-labels) (format " (%s)" ref))))
;; Mark transcoded line as an anchor, if needed.
@@ -2635,7 +2634,8 @@ holding contextual information."
(format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n"
(org-html--container headline info)
(concat "outline-container-"
- (org-export-get-reference headline info))
+ (or (org-element-property :CUSTOM_ID headline)
+ (org-export-get-reference headline info)))
(concat (format "outline-%d" level)
(and extra-class " ")
extra-class)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment