Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Extensions. #30

Open
octalmage opened this issue Oct 1, 2014 · 5 comments
Open

Extensions. #30

octalmage opened this issue Oct 1, 2014 · 5 comments

Comments

@octalmage
Copy link
Owner

Allowing JavaScript in notes has opened up some amazing possibilities. For example you can now automate note creation, modify a notes content, switch notes, you can automate anything!

I want to take this a step further and have a separate editor (in the settings) where you can input JavaScript that runs in the background. This way your "extension" runs independent of your note.

One example of what could be achieved with this is encryption! You'll be able to hook the loading of a note and decrypt it, then encrypt it when the user saves.

Another possibility is extending markdown. You could again hook note loading and use regex to add syntax for YouTube embeds, for example.

This will be a great start but I'd love for the user to be able to add GitHub projects, then Marknote will download and load the JavaScript automatically.

@ValerieDittmar
Copy link
Contributor

What I think we could do is have a directory with autoloaded JS and have Marknote dynamically import those guys into the document that way.

Currently I'm having a dedicated note for scripts that need to be global which is pretty cool but I don't like it cluttering up with a random note.

@octalmage
Copy link
Owner Author

That sounds like a pretty good idea! I also plan on adding custom events for note changes and other actions so they can be hooked easier.

octalmage added a commit that referenced this issue Feb 2, 2015
Basis plugin interface implemented. #30
@octalmage
Copy link
Owner Author

Added some documentation to the wiki:

https://github.com/octalmage/Marknote/wiki/Plugin-API

Still need to document internal functions.

I'm also going to add more complex hooks, like rendering, so plugins can modify the rendered HTML before it's displayed. I'll use async waterfall to pass the HTML from plugin to plugin.

@octalmage
Copy link
Owner Author

Implemented hooks in the hooks branch, currently works like this:

addHook("render", function (content)
{
    return content.replace("cloud", "butt");
});

It's insanely powerful.

@octalmage
Copy link
Owner Author

hooks branch was merged, I don't think this issue is completely closed though. I'll review the API this week to find any missing functionality. #38 also related.

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

No branches or pull requests

2 participants