3

I'm trying to embed this real-time chart from a Google Scholar profile in a markdown document for GitHub: enter image description here

Here's the HTML I found by inspecting the source:

<div class="gsc_md_hist_b"><span class="gsc_g_t" style="right:227px">2015</span><span class="gsc_g_t" style="right:195px">2016</span><span class="gsc_g_t" style="right:163px">2017</span><span class="gsc_g_t" style="right:131px">2018</span><span class="gsc_g_t" style="right:99px">2019</span><span class="gsc_g_t" style="right:67px">2020</span><span class="gsc_g_t" style="right:35px">2021</span><span class="gsc_g_t" style="right:3px">2022</span><a href="javascript:void(0)" class="gsc_g_a" style="right:232px;top:149px;height:11px;z-index:8"><span class="gsc_g_al">25</span></a><a href="javascript:void(0)" class="gsc_g_a" style="right:200px;top:143px;height:17px;z-index:7"><span class="gsc_g_al">37</span></a><a href="javascript:void(0)" class="gsc_g_a" style="right:168px;top:138px;height:22px;z-index:6"><span class="gsc_g_al">48</span></a><a href="javascript:void(0)" class="gsc_g_a" style="right:136px;top:120px;height:40px;z-index:5"><span class="gsc_g_al">85</span></a><a href="javascript:void(0)" class="gsc_g_a" style="right:104px;top:104px;height:56px;z-index:4"><span class="gsc_g_al">120</span></a><a href="javascript:void(0)" class="gsc_g_a" style="right:72px;top:40px;height:120px;z-index:3"><span class="gsc_g_al">255</span></a><a href="javascript:void(0)" class="gsc_g_a" style="right:40px;top:9px;height:151px;z-index:2"><span class="gsc_g_al">322</span></a><a href="javascript:void(0)" class="gsc_g_a" style="right:8px;top:22px;height:138px;z-index:1"><span class="gsc_g_al">295</span></a></div>

How can I embed this in a markdown document so it is accessible once the markdown document is rendered on GitHub?

O.rka
  • 29,847
  • 68
  • 194
  • 309
  • this would likely be similar https://stackoverflow.com/questions/2754391/embed-javascript-in-markdown – alilland Sep 15 '22 at 16:08

3 Answers3

1

You can do this, and it would be fairly trivial - but it will require that you have some publicly accessible CGI script hosted somewhere (PHP, Python, GO, Nodejs, etc).

The idea itself is pretty simple though. Your script should.

  1. Scrape the page https://scholar.google.com/citations?user=r9y1tTQAAAAJ&hl=en to get the relevent html, the div with id="gsc_rsb_cit"

  2. You convert that HTML to an image

  3. Make the image file available

  4. Include that image in your markdown

That said the specific implementation would be up to you :)

Fraser
  • 15,275
  • 8
  • 53
  • 104
0

It's a chunk of HTML that is part of a larger document. It isn't embeddable in its own right.

Markdown has only one mechanism for embedding content from a URL, and that is for images, which you aren't dealing with.

You can write raw HTML in a Markdown document, but HTML has no mechanism for embedding part of another HTML document. The closest it comes is the iframe element (for whole documents).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
0

I cannot think of a way to embed dynamic data on a github markdown file (no js).

You may generate an img of the graph and embed it on a markdown file, but it seems that there's no real service to do it for the graph on google scholar (apart from some R scripts & crontabs), so you have to create your script from scratch.

sodimel
  • 864
  • 2
  • 11
  • 24