asciidoctor / atom-asciidoc-preview

⚛ AsciiDoc preview for the Atom editor.
https://atom.io/packages/asciidoc-preview
MIT License
141 stars 42 forks source link

docinfo not supported #239

Open tariano opened 7 years ago

tariano commented 7 years ago

Description

I found no mention for docinfo files in the repository, and in the light of this, as expected, using docinfo file doesn't work in preview:

I successfully created a docinfo file, named docinfo.html in the same location of my-doc.adoc document. In that docinfo.html I put:

<style>
    .gui { background-color : #EFEFEF; }
</style>

I added :docinfo: shared in my-doc.adoc as required.

And after executing asciidoctor my-doc.adoc, any text marked with [gui]#GUI Text# was correctly emitted with the gui class, displaying the right background color.

However using this atom-asciidoc-preview extension in Atom, I noticed that the preview doesn't display the right background color - it doesn't heed docinfo.html whatsoever.

mojavelinux commented 7 years ago

It's important to keep in mind that the preview produces an embeddable document. That means features that rely on a standalone document, such as docinfo, must be implemented by the preview plugin. The preview plugin could honor the docinfo attribute, read the appropriate file, and insert the result into the frame. Where exactly it should be inserted is up to the preview plugin to define.

mojavelinux commented 7 years ago

It's worth noting that the way the Chrome extension handles this is allow extra JavaScript and CSS files to be added. However, those are global, so it's not as nice as being able to have supplemental content per document. (Though I still think the preview needs to have user themes, but that's a separate issue).