Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rexxars/tumblr-to-prosemirror
Convert tumblr blog entries to prosemirror format
https://github.com/rexxars/tumblr-to-prosemirror
Last synced: 11 days ago
JSON representation
Convert tumblr blog entries to prosemirror format
- Host: GitHub
- URL: https://github.com/rexxars/tumblr-to-prosemirror
- Owner: rexxars
- License: mit
- Created: 2016-01-10T23:30:53.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-28T15:52:53.000Z (almost 9 years ago)
- Last Synced: 2024-10-11T07:13:09.816Z (about 1 month ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tumblr-to-prosemirror
Convert tumblr blog entries to prosemirror format
## Installation
```
npm install --save tumblr-to-prosemirror
```## Usage
```js
var convert = require('tumblr-to-prosemirror');convert({
host: 'vaffelfest.tumblr.com', // Some tumblr host. Just hostname, please.
apiKey: 'someApiKey',
json: false // Set to true if you want "plain old javascript objects" instead of actual ProseMirror `Node` instances.
}, function onConverted(err, posts) {
if (err) {
throw err;
}console.log(posts);
});
```Each item in the resulting array passed to the callback contains two keys: `tumblr` and `prosemirror`.
- `tumblr` is the raw object returned by the tumblr API
- `prosemirror` is the "body" field of the post parsed to either a ProseMirror node (default) or a JSON structure, if `json` is set to `true` in the options. Note that the `body` field is only actually used for text posts, and each post type seems to have it's own field containing the HTML. `tumblr-to-prosemirror` will try to resolve that field in the following order:
1. `body`
2. `caption`
3. `text`
4. `description`## License
MIT-licensed, see LICENSE