Git Product home page Git Product logo

obsidian-js-engine-plugin's Introduction

Obsidian JS Engine Plugin

This plugin for Obsidian allows you to run JavaScript from within your notes using special code blocks.

Usage

Start by creating a code block with the js-engine plugin. Inside the code block you can write what ever JavaScript code that you want. The plugin will run the JavaScript and render the returned value in place of the code block.

API Docs

Docs are available here.

Examples

Markdown Builder

let markdownBuilder = engine.markdown.createBuilder();

markdownBuilder.createHeading(2, 'Test Heading');
markdownBuilder.createParagraph('This is a test paragraph.');

markdownBuilder.createHeading(3, 'This is a sub heading');
markdownBuilder.createHeading(4, 'This is a sub sub heading');
markdownBuilder.createParagraph('This is another test paragraph.');

return markdownBuilder;

Output

Test Heading

This is a test paragraph.

This is a sub heading

This is a sub sub heading

This is another test paragraph.

Rendering Strings as Markdown

let str = '*test*';
return str;
let str = '*test*';
return engine.markdown.create(str);

The top example renders the string as plain text and the second one renders the text as markdown.

Output

*test*

test

Importing JS

let lib = await engine.importJs('lib.js');
return lib.getGreeting();

With a file named lib.js in the root of the vault.

export function getGreeting() {
	return 'Hello!';
}

Output

Hello!

obsidian-js-engine-plugin's People

Contributors

mprojectscode avatar krakor92 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.