A few thoughts on this:
  1. It seems that you want the full details of the reference as part of the citation. Is that correct?
  2. I think that pulling the information out of the refs div should work, but might not be the optimal approach
  3. I suspect that a better approach may be to adjust the citation style so the citation itself (currently just the citation number in square brackets) contains the desired information (post-citeproc filters should then see this in cite.content)
  4. If you pull all the desired information into the citations then you may want just to set suppress-bibliography=true to suppress the bibliography
I created a very simple CSL style that meets our needs. This specifies the citation:

  <citation>

    <layout delimiter="; ">

      <text variable="title-short" suffix=" "/>

      <group prefix="[" suffix="]">

        <text variable="locator" suffix="/"/>

        <text variable="citation-number"/>

      </group>

    </layout>

  </citation>


and this specifies the bibliography (references):

  <bibliography entry-spacing="0">

    <sort>

      <key variable="citation-number"/>

    </sort>

    <layout>

      <text variable="citation-number" prefix="[" suffix="]"

            display="left-margin"/>

      <group delimiter=", " display="right-inline">

        <text variable="call-number"/>

        <text variable="title" font-style="italic"/>

        <text variable="publisher"/>

        <date date-parts="year" form="text" variable="issued"/>

        <text variable="URL"/>

      </group>

    </layout>

  </bibliography>


I _think_ you could adjust the <citation> layout to include the information that you need, formatted as you want it.

On Fri, 20 Aug 2021 at 19:54, Leena Murgai <leenamurgai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Sorry, I wish I could write this message in an editable markdown window! I'll try again...

Hi Bastien,

Good questions, thx.

As I said I am converting from latex to html5, so no markdown to share.
I shared my filter above but here it is for convenience:
function Cite(el)
  marginnote = pandoc.Span(el.content)
  marginnote.classes[1] = 'marginnote'
  return {pandoc.Span(el.content), marginnote}
end

Here's the reference block html in the references section:
<div id="ref-AmazonSameDayPrime" class="csl-entry" role="doc-biblioentry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">D. Ingold and S. Soper, <span>“Amazon doesn’t consider the race of its customers. Should it?”</span> <em>Bloomberg</em>, 2016.</div>
</div>

I want the following in my marginnote
<span><a href="#ref-AmazonSameDayPrime">[1]</a></span>
<span class="marginnote">
<span id="ref-AmazonSameDayPrime" class="csl-entry" role="doc-biblioentry">
<span class="csl-left-margin">[1] </span><span class="csl-right-inline">D. Ingold and S. Soper, <span>“Amazon doesn’t consider the race of its customers. Should it?”</span> <em>Bloomberg</em>, 2016.</span></span></span>
Note, I want to replace the divs with spans, but just getting the divs for now would be progress.

At the moment all I get in my marginnote is
<span><a href="#ref-AmazonSameDayPrime">[1]</a></span><span class="marginnote"><a href="#ref-AmazonSameDayPrime">[1]</a></span>

I think William's idea is promising so will try that approach. Happy for other suggestions if they come to mind.
On Friday, 20 August 2021 at 11:34:11 UTC-7 Leena Murgai wrote:
Hi Bastien,

All good questions, thx.

As I said I am converting from latex to html5, so no markdown to share.

Here's the reference block html in the references section:
<div id="ref-AmazonSameDayPrime" class="csl-entry" role="doc-biblioentry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">D. Ingold and S. Soper, <span>“Amazon doesn’t consider the race of its customers. Should it?”</span> <em>Bloomberg</em>, 2016.</div>
</div>

I want the following in my marginnote
<span><a href="#ref-AmazonSameDayPrime">[1]</a></span>
<span class="marginnote">
<span id="ref-AmazonSameDayPrime" class="csl-entry" role="doc-biblioentry">
<span class="csl-left-margin">[1] </span><span class="csl-right-inline">D. Ingold and S. Soper, <span>“Amazon doesn’t consider the race of its customers. Should it?”</span> <em>Bloomberg</em>, 2016.</span></span></span>

At the moment all I get in my marginnote is

<span><a href="#ref-AmazonSameDayPrime">[1]</a></span><span class="marginnote"><a href="#ref-AmazonSameDayPrime">[1]</a></span>
On Friday, 20 August 2021 at 11:09:54 UTC-7 Bastien Dumont wrote:
Sorry, but is very difficult to help you efficiently from incomplete descriptions and screenshots. Could you please send the following?

* A very small Markdown chunk with only one citation;
* The corresponding HTML code with the desired output;
* The HTML code you actually get;
* Your CSL stylesheet (if other than the default one);
* The bibliography entry used in your example;
* Your filter.

Without that, nobody can guess what is going on.

Le Friday 20 August 2021 à 10:41:07AM, Leena Murgai a écrit :
> No problem William,
>
> in the example screenshots, the text I'm referring to is specifically
>
> D. Ingold and S. Soper, “Amazon doesn’t consider the race of its customers.
> Should it?” Bloomberg, 2016.
>
> I assume it's a list of inlines in the AST, possibly a block, as I said I don't
> know where it's stored. I assumed in citations, as did you, but I don't know
> how to access it. Anyway, I want that text to be in my marginnote along side
> the (lonely looking) [1].
>
> Actually, I'm not interested in having the references at the end at all, I'd
> rather just have the linked reference in marginnote.
> On Friday, 20 August 2021 at 10:31:57 UTC-7 William Lupton wrote:
>
> Sorry, you've probably already answered this along the way, but I'm
> confused about the "text" that you refer to. Perhaps you could attach a
> JSON AST that includes a citation with all the desired information from a
> run that DOESN'T use your filter? I'm unclear where in the AST to find the
> information that you want (and is missing). I had assumed that it must be
> in cite.citations but apparently not.
>
> On Fri, 20 Aug 2021 at 18:25, Leena Murgai <leena...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> So I've attached some screenshots in case it helps. You can see that
> the marginnote contains only the [linked_item_number] of the citation,
> the rest is missing. Here's the filter I used:
>
> function Cite(el)
>   marginnote = pandoc.Span(el.content)
>   marginnote.classes[1] = 'marginnote'
>   return {pandoc.Span(el.content), marginnote}
> end
>
>
>
> On Friday, 20 August 2021 at 10:06:30 UTC-7 Leena Murgai wrote:
>
> Hello again Bastien,
>
> I just tried your code, it does something similar to mine (but
> clearly you code is nicer :). It's missing the text that makes up
> the citation block in the bibligraphy. To be clear I want the whole
> block (or inline?) that appears in the bibliography in my
> marginnote.
>
> Cheers!
>
> On Friday, 20 August 2021 at 10:00:56 UTC-7 Leena Murgai wrote:
>
> Thanks  William.
>
> These are the filters I'm using:
>
> 1. tex2html/filters/date.lua            # Replace date with
> today's date if it's empty above #
> 2. tex2html/filters/texref.lua          # Cleanup pandoc and
> pandoc-crossref conflicts #
> 3. pandoc-crossref                      # [1]https://github.com
> /lierdakil/pandoc-crossref #
> 4. citeproc                             # If you need control
> over when the citeproc processing #
> 5. pandoc-sidenote                      # [2]https://github.com
> /jez/pandoc-sidenote #
> 6. tex2html/filters/margincitations.lua # put citations in
> marginnotes #
>
> Thanks Pedro.
>
> I'm already using pandoc-sidenote :). What I actually want is a
> marginnote. If I turn them into footnotes before running
> pandoc-sidenote, I end up with a sidenote rather than a
> marginnote which gets a superscript label. This isn't what I
> want. I want to keep the [linked_item_number] (provided by
> citeproc) and put that in the (unnumbered) marginnote (with the
> rest of the ). RawInline let's me do that. I just can't access
> the text.
> On Friday, 20 August 2021 at 09:44:46 UTC-7 pedro....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> wrote:
>
> Jake Zimmerman’s pandoc-sidenote filter just takes every
> footnote as a whole and converts it to a sidenote <span>.
> Unless you want separate streams for regular footnotes and
> citation sidenotes, it might be useful: [3]https://
> github.com/jez/pandoc-sidenote/blob/master/src/Text/Pandoc/
> SideNote.hs
>
> Em sexta-feira, 20 de agosto de 2021 às 17:37:55 UTC+1,
> William Lupton escreveu:
>
> Not sure if this helps, but here's a simple example
> showing a somewhat readable dump of the AST before and
> after citeproc. I think only cite.content has changed.
> I suspect that your problem is something else.
>
>
> % cat cite.md 
>
> @RFC1149
>
>
> % LUA_PATH=../?.lua pandoc -L rep.lua --citeproc -L
> rep.lua cite.md 
>
> (#) meta {}
>
> (#) blocks {
>
>   [1] content: Para {
>
>     [1] Cite {
>
>       citations: {
>
>         [1] {
>
>           hash: 0
>
>           id: "RFC1149"
>
>           mode: "AuthorInText"
>
>           note_num: 1
>
>           prefix: {}
>
>           suffix: {}
>
>         }
>
>       }
>
>       content: {
>
>         [1] Str text: "@RFC1149"
>
>       }
>
>     }
>
>   }
>
> }
>
> [WARNING] Citeproc: citation RFC1149 not found
>
> (#) meta {}
>
> (#) blocks {
>
>   [1] content: Para {
>
>     [1] Cite {
>
>       citations: {
>
>         [1] {
>
>           hash: 0
>
>           id: "RFC1149"
>
>           mode: "AuthorInText"
>
>           note_num: 1
>
>           prefix: {}
>
>           suffix: {}
>
>         }
>
>       }
>
>       content: {
>
>         [1] Str text: "("
>
>         [2] content: Strong {
>
>           [1] Str text: "RFC1149?"
>
>         }
>
>         [3] Str text: ")"
>
>       }
>
>     }
>
>   }
>
> }
>
> <p><span class="citation" data-cites="RFC1149">
> (<strong>RFC1149?</strong>)</span></p>
>
>
> On Fri, 20 Aug 2021 at 17:14, Leena Murgai <
> leena...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> I'm running it after citeproc since I need the
> citation values.
>
> On Friday, 20 August 2021 at 09:12:06 UTC-7 Leena
> Murgai wrote:
>
> Maybe the order I run the filters in matters?
>
> On Friday, 20 August 2021 at 09:07:24 UTC-7
> Leena Murgai wrote:
>
> Yeah, I tried looking there, I couldn't
> find what I wanted. I'm sure I'm missing
> something.
>
> The question is how to access it? As in
> what's the code? For example, each citation
> ([4]https://pandoc.org/lua-filters.html#
> type-citation) has the fields id, mode, 
> prefix, suffix, note_num, hash. Which one
> contains the text I want? What's the code
> to get the list of inlines I want
> (corresponding to the text in the
> citation)?
> On Friday, 20 August 2021 at 08:59:52 UTC-7
> William Lupton wrote:
>
> Do you mean the citations themselves?
> These are in el.citations. See [5]
> https://pandoc.org/lua-filters.html#
> type-cite and [6]https://pandoc.org/
> lua-filters.html#type-citation.
>
> On Fri, 20 Aug 2021 at 16:36, Leena
> Murgai <leena...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> So far I have the following, which puts
> the [linked_item_number] in the passage
> and in the marginnote but I'm missing
> the rest of the
> text_that_goes_in_the_bibliography.
>
> function Cite(el)
>   return { 
>     pandoc.Span(el.content),
>     pandoc.RawInline('html5', ' <span
> class = "marginnote">'),
>     pandoc.Span(el.content),
>     pandoc.RawInline('html5', ' </span>
> ')
>     }
> end
>
> On Thursday, 19 August 2021 at 20:32:11
> UTC-7 Leena Murgai wrote:
>
> Hi there,
>
> I'm converting from LaTeX to HTML5. I'd
> like to put my citations in 'sidenote's
> rather than at the end of the doc. In
> practice, this just means I want the
> output html: to look like
>
> [linked_item_number] <span class=
> marginnote>
> text_that_goes_in_the_bibliography</
> span>
>
> How do I access the element that goes
> into the citation, i.e.
> text_that_goes_in_the_bibliography?
>
> Any advice appreciated.
>
>
>
> --
> You received this message because you
> are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop
> receiving emails from it, send an email
> to pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To view this discussion on the web
> visit [7]https://groups.google.com/d/
> msgid/pandoc-discuss/
> eda3d7b4-befd-4f42-9455-8a37373d33a6n%40googlegroups.com
> .
>
> --
> You received this message because you are
> subscribed to the Google Groups "pandoc-discuss"
> group.
> To unsubscribe from this group and stop receiving
> emails from it, send an email to
> pandoc-discus...@googlegroups.com.
>
> To view this discussion on the web visit [8]https:/
> /groups.google.com/d/msgid/pandoc-discuss/
> 3106cf1d-5ae3-411f-b92a-c14153d58e49n%40googlegroups.com
> .
>
> --
> You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to pandoc-discus...@googlegroups.com.
>
> To view this discussion on the web visit [9]https://groups.google.com/d
> /msgid/pandoc-discuss/
> eb59834b-d3e8-4dc4-9a66-0eb8c0f3e225n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to [10]pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To view this discussion on the web visit [11]https://groups.google.com/d/msgid/
> pandoc-discuss/b548772c-269e-45c7-9ff6-9aec6014f024n%40googlegroups.com.
>
> References:
>
> [1] https://github.com/lierdakil/pandoc-crossref
> [2] https://github.com/jez/pandoc-sidenote
> [3] https://github.com/jez/pandoc-sidenote/blob/master/src/Text/Pandoc/SideNote.hs
> [4] https://pandoc.org/lua-filters.html#type-citation
> [5] https://pandoc.org/lua-filters.html#type-cite
> [6] https://pandoc.org/lua-filters.html#type-citation
> [7] https://groups.google.com/d/msgid/pandoc-discuss/eda3d7b4-befd-4f42-9455-8a37373d33a6n%40googlegroups.com?utm_medium=email&utm_source=footer
> [8] https://groups.google.com/d/msgid/pandoc-discuss/3106cf1d-5ae3-411f-b92a-c14153d58e49n%40googlegroups.com?utm_medium=email&utm_source=footer
> [9] https://groups.google.com/d/msgid/pandoc-discuss/eb59834b-d3e8-4dc4-9a66-0eb8c0f3e225n%40googlegroups.com?utm_medium=email&utm_source=footer
> [10] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [11] https://groups.google.com/d/msgid/pandoc-discuss/b548772c-269e-45c7-9ff6-9aec6014f024n%40googlegroups.com?utm_medium=email&utm_source=footer

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/4c177bdf-f369-4e9b-bdc6-36e0e38cf496n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xximr2LB2Lue-K8Vi3jDkTZ%2BDLp81N5KaLZtOva5_v2AYw%40mail.gmail.com.