tutts/google-sites-markdown

Retrieve MD File Contents

Closed this issue · 1 comments

How could I use this to call markdown function on a URL that points to a md file? We have a repo of markdown and trying to embed them in the Google sites page without having to copy the contents of each page.

tutts commented

Hi, you would need to fetch the file contents asynchronously first, and then pass that to the markdown function. I've not tested it, but something like this using native fetch:

<script src="https://github.com/tutts/google-sites-markdown/blob/master/index.js"></script>

<script>
  fetch('https://link.to/your-markdown.md')
    .then(res => res.text())
    .then(contents => markdown(contents))
</script>