question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Show Gist In Markdown

See original GitHub issue

Bug Report

hello,I have a problem. I write gist embed link in markdown,but docsify don’t show it.

I want to know how to show gist in docsify

Steps to reproduce

  • index.html
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <link rel="icon" href="_media/favicon.ico">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="description" content="Description">
  <meta name="viewport"
    content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">

  <!-- mermaid -->
  <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.css">
  <script src="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
</head>

<body>
  <div id="app"></div>
  <script>
    mermaid.initialize({ startOnLoad: false });
    window.$docsify = {
      repo: 'haozibi/',
      auto2top: true,
      subMaxLevel: 2,

      executeScript: true,

      loadSidebar: true,
      loadNavbar: true,
      search: 'auto', 
      markdown: {
        renderer: {
          code: function (code, lang) {
            if (lang === "mermaid") {
              return (
                '<div class="mermaid">' + mermaid.render(lang, code) + "</div>"
              );
            }
            return this.origin.code.apply(this, arguments);
          }
        }
      },
    }
  </script>
  <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>

  <script src="//unpkg.com/docsify/lib/plugins/external-script.js"></script>
  <script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
  <script src="//unpkg.com/docsify/lib/plugins/emoji.js"></script>
  <script src="//unpkg.com/docsify/lib/plugins/zoom-image.js"></script>
  <script src="//unpkg.com/docsify-copy-code"></script>

  <script src="//unpkg.com/prismjs/components/prism-go.js"></script>
  <script src="//unpkg.com/prismjs/components/prism-bash.js"></script>
  <script src="//unpkg.com/prismjs/components/prism-python.js"></script>
  <script src="//unpkg.com/prismjs/components/prism-markdown.js"></script>
</body>

</html>
  • markdown
# test

<script src="https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63.js"></script>

What is current behaviour

Chrome console show

Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.

I am not very good at the FrontEnd, so I am confused about the problem. sorry~~

What is the expected behaviour

Other relevant information

  • Bug does still occur when all/other plugins are disabled?

  • Your OS: Mac OS 10.13.6

  • Node.js version:

  • npm/yarn version:

  • Browser version: 79.0.3945.79(64 Bit)

  • Docsify version:

  • Docsify plugins:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
MichaelCurrincommented, Apr 21, 2020

I could not get the gist embed script tag to work on Docsify…

But using Docify’s embed approach and a raw URL, this works great to embed a gist.

For example, I found how to pull in and render markdown content.

[run_docsify_locally.md](//gist.githubusercontent.com/MichaelCurrin/4c8060dcc9d8841f842eeebc7a1436d8/raw/run_docsify_locally.md ':include')

I use that here: https://michaelcurrin.github.io/docsify-js-tutorial/#/?id=_1-install

Corresponding markdown here

Also, I wrote a short tutorial on this here: gist.

1reaction
MichaelCurrincommented, Jun 21, 2020

Added! 🎉 📝

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gist markdown examples · GitHub
A collection of Markdown code and tricks that were tested to work in Gist. This and all public gists in https://gist.github.com/ww9 are Public...
Read more >
Github: How to embed a gist into README.md? - Stack Overflow
Since markdown supports html, one can simply use the <script> tag to embed gist. Simply copy the embed url of the gist provided...
Read more >
Preview the Markdown rendering of gists | GitHub Changelog
You can now preview renderings of Markdown files that you edit in GitHub Gist. It has long been possible to preview the Markdown...
Read more >
Embedding Gist into webpage Markdown - Daren Card, Ph.D.
Turns out it is pretty easy to imbed an existing Gist into a Minimal Mistakes blog post. Simply write a blog post as...
Read more >
Using Gists for General Purpose Web Pages with Markdown
But did you know that Gists also support Markdown? ... files to a single Gist so if you need to show client and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found