So, this is something I have been prototyping on the v2 branch today:
Import
There is now a generic Import: URL
command that will ask you for a URL. This is a generic mechanism that plugs or Space Lua can plug into. For now there are two importers implemented:
- A Github Gist importer, which will attempt to pull any markdown files from a Gist
- A markdown import (for URLs that end with
.md
) that will simply import the content from that URL
Future importers I envision:
- A generic importer that can take any URL and somehow converts the pulled HTML to clean markdown you can pull into your space
- Github importer for .md on github
- Perhaps a community.silverbullet.md importer that can pull markdown from a topic post
Every importer ought to set frontmatter for imported content leading back to the source, so that potentially (not implemented yet) in the future content can be “refreshed” from the source.
Use cases
- A way to (more easily) distribute libraries. In v1 one we had the concept of a Library, but there was only really the Library/Core and Library/Journal one. Distribution of these required deploying a read-only SB server somewhere. Supporting this import mechanism should make distribution way easier, because people can just send you a URL to import. I think passing around Github gists will be nice and easy.
- Read later: A way to just pull in content in your space to read later or to save for other reasons (especially useful when the generic importer for HTML will be implemented).
Export
The new Export: Page Or Selection
command allows you to export a page (this replaces the old Share plug). Just like import, this mechanism is extensible. This is effectively the inverse of import.
By default there are three exporters:
- Copy to clipboard as (expanded) markdown, so all Lua directives, queries etc. are automatically expanded and you end up with clean markdown
- Copy to clipboard as rich text: same as the markdown one, but then also converts it to rich text (HTML) that you can e.g. paste into Google Docs or Word
- Export as Gist: if you configure your Github token, you can export right to Github gists (to be imported by others). Once a first publish happens, frontmatter keys will be set so that future exports update the gist rather than create a new one.
In the future I’d like to port the Ghost plug to also build on this infrastructure, and of course you can imagine integrations with other tools, e.g. Wordpress.
Use cases
- Library distribution
- Sharing content outside your space in general (copy into google docs, some other markdown tool)
Have a play with it and tell me what you think.
These features are all 100% implemented in Space Lua are (for now) are part of the Library/Std library that is distributed with SB, you can find the implementation in your space, or here: