Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote gist-block-macro extension #99

Closed
ggrossetie opened this issue Jan 20, 2015 · 6 comments
Closed

Promote gist-block-macro extension #99

ggrossetie opened this issue Jan 20, 2015 · 6 comments

Comments

@ggrossetie
Copy link
Member

No description provided.

@mojavelinux
Copy link
Member

I agree, though I'd also like to have this extension reviewed. It was a super quick hack. Are there things about it we need to add before we make it "live"? I'm really looking for people who like to use gists in blog posts since that's when I imagine it will be used the most.

@ggrossetie
Copy link
Member Author

@mojavelinux Actually we can't use the embed script in the chrome extension because the script use document.write

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.
gist.github.com/mojavelinux/5546622.js?_=1427023194250:2 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.

Instead we could use the json format. For instance https://gist.github.com/mojavelinux/5546622.js gives us the script and https://gist.github.com/mojavelinux/5546622.json gives us the json representation of the Gist.
The extension can then use the div attribute and the stylesheet attribute ? Wdyt ?

Quick implementation in JavaScript:

$.getJSON("https://gist.github.com/mojavelinux/5546622.json", function(data) {
  var gistLink = document.createElement('link');
  gistLink.rel = 'stylesheet';
  gistLink.id = 'gist-style';
  gistLink.href = data.stylesheet;
  document.head.appendChild(gistLink);
  $(".gist-content-script").append(data.div);
});

@mojavelinux
Copy link
Member

Great thinking! I wasn't aware the gist was served as JSON. That makes things a lot simpler (in theory). I'm perfectly happy with the idea of reworking the extension to use this approach instead. As long as the snippet gets into the browser, I don't care how it happens. Perhaps we should have a parallel issue in the extension lab to change the implementation.

@ggrossetie
Copy link
Member Author

Perhaps we should have a parallel issue in the extension lab to change the implementation.

Yes, if you are OK with this change, I will create an issue in the extension lab repository.

@mojavelinux
Copy link
Member

👍

@ggrossetie
Copy link
Member Author

I think this issue is not relevant anymore since Asciidoctor.js does not contains (or promote) extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants