emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Price <moptop99@gmail.com>
To: "Berry, Charles" <ccberry@ucsd.edu>, Org Mode <emacs-orgmode@gnu.org>
Subject: Re: superfluous <code> tags in html src block output
Date: Sat, 14 Sep 2019 15:56:25 -0400	[thread overview]
Message-ID: <CAN_Dec90VtO0jE9ZGWdoYm=XmwDcbeYC01zz3WHAyG2s2CTZEA@mail.gmail.com> (raw)
In-Reply-To: <13D2DFAB-7BCE-4235-9F64-5EDA60982232@ucsd.edu>

[-- Attachment #1: Type: text/plain, Size: 2739 bytes --]

On Sat, Sep 14, 2019 at 1:53 PM Berry, Charles <ccberry@ucsd.edu> wrote:

> This is newer:
>
> ===
> commit ded3d27b1468b878197e5fe55a70c5e13350ea27
> Author: Nik Clayton <nik@ngo.org.uk>
> Date:   Tue Jun 4 11:57:40 2019 +0200
>
>     ox-html: Wrap each line of a source block in a code element
>
>     * lisp/ox-html.el (org-html-do-format-code): Wrap each line of a
> source block
>     in a code element.
>
>     This makes it straightforward to add custom decorations to each line
>     using CSS :before and :after properties.
>
> ===
>
> ah, man, thank you, that's very helpful.   Clearly this is the issue. I'll
have to figure out the best way to make this work with the `highlight.js`
library that reveal.js depends on for code highlighting.

>
>
> HTH,
>
> Chuck
>
>
> > On Sep 14, 2019, at 8:52 AM, Matt Price <moptop99@gmail.com> wrote:
> >
> > I'm seeing something I hadn't noticed before in src block html exports.
> Instead of producing structures like:
> >
> > <pre>
> > <code>
> > <span>...</span>
> > <span>...</span>
> > <span>...</span>
> > </code>
> > </pre>
> >
> > each individual like is wrapped in its own <code> tag.  In regular HTML
> exports this doesn't really affect display, but in exports to reveal using
> the highlight.js plugin, code display gets messed up.
> >
> > From what I can tell these code tags are generated in
> org-html-do-format-code, in this section which starts on line 22459 of my
> pretty recent org:
> >
> > (org-export-format-code
> >      code
> >      (lambda (loc line-num ref)
> >        (setq loc
> >     (concat
> >      ;; Add line number, if needed.
> >      (when num-start
> > (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)
> >      ;; Add label, if needed.
> >      (when (and ref retain-labels) (format " (%s)" ref))))
> >        ;; Mark transcoded line as an anchor, if needed.
> >        (if (not ref) loc
> > (format "<span id=\"coderef-%s\" class=\"coderef-off\">%s</span>"
> > ref loc)))
> >      num-start refs)
> >
> > This code seems to have been around for a while so I don't know whether
> this is new behaviour, but I don't think I've seen line-level <code> tags
> before.  Can anyone confirm?
> >
> > See also a MWE in this bug report, which is probably erroneously filed
> in the org-re-reveal repo:
> >
> > https://gitlab.com/oer/org-re-reveal/issues/27
> >
> > I'd love to know whether this is expected behaviour, or if I've gone
> wrong somewhere!
> > THanks,
> > Matt
> >
>
>
>

[-- Attachment #2: Type: text/html, Size: 4151 bytes --]

      reply	other threads:[~2019-09-14 19:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-14 15:52 superfluous <code> tags in html src block output Matt Price
2019-09-14 17:53 ` Berry, Charles
2019-09-14 19:56   ` Matt Price [this message]

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://www.orgmode.org/

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

  git send-email \
    --in-reply-to='CAN_Dec90VtO0jE9ZGWdoYm=XmwDcbeYC01zz3WHAyG2s2CTZEA@mail.gmail.com' \
    --to=moptop99@gmail.com \
    --cc=ccberry@ucsd.edu \
    --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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).