Skip to content

Commit

Permalink
Merge pull request #3 from jmbuhr/self-contained
Browse files Browse the repository at this point in the history
Self contained
  • Loading branch information
jmbuhr committed Aug 15, 2022
2 parents 85921ab + a57b0cc commit b73ab10
Show file tree
Hide file tree
Showing 86 changed files with 500 additions and 5,414 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ Likewise, the example rendered as a revealjs presentation (`presentation.qmd`) i

## Limitations

- No self-contained htmls: Molstar viewers for local files are empty when the file is **not** served by a webserver such as `quarto preview` or GitHub pages.
This means it will not display your molecule when you simply open the rendered html with a browser,
even if you set the html to be self-contained.
The reason for this is the [Same-origin Policy](https://developer.mozilla.org/en-US/docs/Glossary/Same-origin_policy), a security measure in web browsers.
It and similar policies prevent that one document can access resources it is not supposed to access.
For example, an html document you downloaded is not allowed to execute code that reads personal files on your computer.
This also prevents it from loading your molecules from local paths.
- revealjs presentations now use iframes instead of a normal div to work around https://github.com/jmbuhr/quarto-molstar/issues/1, which is why you might have to address those differently for custom styling if you plan to use the same source for html and reveal output.
- Self-contained htmls:
Molstar viewers for local files are empty when the file is **not** served by a webserver such as `quarto preview` or GitHub pages.
This means it will not display your molecule when you simply open the rendered html with a browser,
even if you set the html to be self-contained.
The reason for this is the [Same-origin Policy](https://developer.mozilla.org/en-US/docs/Glossary/Same-origin_policy), a security measure in web browsers.
It and similar policies prevent that one document can access resources it is not supposed to access.
For example, an html document you downloaded is not allowed to execute code that reads personal files on your computer.
This also prevents it from loading your molecules from local paths.

For plain text formats in the `mol-url` shortcode, such as `pdb` and `xyz`, you can enable a custom option that circumvents this limitation
by embedding them straight into the html as a string.
Add `molstar: embed` to your yml frontmatter to use this.
- revealjs presentations now use iframes instead of a normal div to work around https://github.com/jmbuhr/quarto-molstar/issues/1,
which is why you might have to address those differently for custom styling if you plan to use the same source for html and revealjs output.

## Update Mol* (extension developement)

Expand Down
3 changes: 3 additions & 0 deletions _extensions/molstar/assets/app-container.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ div .molstar-app {
margin-bottom: 1rem;
}

.msp-plugin .msp-layout-expanded {
z-index: 1;
}
Loading

0 comments on commit b73ab10

Please sign in to comment.