Skip to content

Commit bc73cec

Browse files
committed
remove some testing things
1 parent 0b59ff7 commit bc73cec

File tree

3 files changed

+27
-33
lines changed

3 files changed

+27
-33
lines changed

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ This plugin for Obsidian allows you to run JavaScript from within your notes usi
44

55
## Usage
66

7-
Start by creating a code block with the `js-engine` plugin. Inside the code block you can write any JS code and at the end return a value.
7+
Start by creating a code block with the `js-engine` plugin. Inside the code block you can write any JS code and at the end return a value.
88
The plugin will then render the returned value instead of the code block. When you return nothing, the plugin will not render anything and the code block will be invisible.
99

1010
## API Docs
1111

1212
The following variables are available in the code blocks.
1313

1414
| Name | Type |
15-
|-----------|-------------------------------------------------|
15+
| --------- | ----------------------------------------------- |
1616
| app | `App` (Obsidian) |
1717
| engine | `API` (this plugin) |
1818
| context | `ExecutionContext` (this plugin) or `undefined` |
@@ -26,61 +26,63 @@ Documentation for the API and types that are available inside the code block can
2626
### Markdown Builder
2727

2828
```js
29-
let markdownBuilder = engine.markdown.createBuilder()
29+
let markdownBuilder = engine.markdown.createBuilder();
3030

31-
markdownBuilder.createHeading(2, "Test Heading")
32-
markdownBuilder.createParagraph("This is a test paragraph.")
31+
markdownBuilder.createHeading(2, 'Test Heading');
32+
markdownBuilder.createParagraph('This is a test paragraph.');
3333

34-
markdownBuilder.createHeading(3, "This is a sub heading")
35-
markdownBuilder.createHeading(4, "This is a sub sub heading")
36-
markdownBuilder.createParagraph("This is another test paragraph.")
34+
markdownBuilder.createHeading(3, 'This is a sub heading');
35+
markdownBuilder.createHeading(4, 'This is a sub sub heading');
36+
markdownBuilder.createParagraph('This is another test paragraph.');
3737
```
3838

3939
#### Output
4040

4141
> ## Test Heading
42+
>
4243
> This is a test paragraph.
44+
>
4345
> ### This is a sub heading
46+
>
4447
> #### This is a sub sub heading
48+
>
4549
> This is another test paragraph.
4650
4751
### Rendering Strings as Markdown
4852

4953
```js
50-
let str = "*test*";
54+
let str = '*test*';
5155
return str;
5256
```
5357

5458
```js
55-
let str = "*test*";
59+
let str = '*test*';
5660
return engine.markdown.create(str);
5761
```
5862

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

61-
#### Output
65+
#### Output
6266

6367
> \*test\*
6468
65-
> *test*
69+
> _test_
6670
6771
### Importing JS
6872

6973
```js
70-
let lib = await engine.importJs("lib.js");
74+
let lib = await engine.importJs('lib.js');
7175
return lib.getGreeting();
7276
```
7377

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

7680
```js
7781
export function getGreeting() {
78-
return "Hello!";
82+
return 'Hello!';
7983
}
8084
```
8185

8286
#### Output
8387

8488
> Hello!
85-
86-

src/Settings.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import { App, PluginSettingTab } from 'obsidian';
22
import JsEnginePlugin from './main';
33

4-
export interface JsEnginePluginSettings {
5-
mySetting: string;
6-
}
4+
export interface JsEnginePluginSettings {}
75

8-
export const JS_ENGINE_DEFAULT_SETTINGS: JsEnginePluginSettings = {
9-
mySetting: 'default',
10-
};
6+
export const JS_ENGINE_DEFAULT_SETTINGS: JsEnginePluginSettings = {};
117

128
export class JsEnginePluginSettingTab extends PluginSettingTab {
139
plugin: JsEnginePlugin;
@@ -26,6 +22,7 @@ export class JsEnginePluginSettingTab extends PluginSettingTab {
2622
return;
2723
}
2824

29-
containerEl.createEl('h2', { text: 'Settings for my awesome plugin.' });
25+
containerEl.createEl('h2', { text: 'JS Engine Settings' });
26+
containerEl.createEl('p', { text: 'Currently Empty, but there will be stuff here later.' });
3027
}
3128
}

src/main.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,11 @@ export default class JsEnginePlugin extends Plugin {
2828

2929
this.messageManager.initStatusBarItem();
3030

31-
this.api.message.createMessage(MessageType.INFO, 'test', 'test content');
32-
this.api.message.createMessage(MessageType.INFO, 'test', 'test content');
33-
this.api.message.createMessage(MessageType.INFO, 'test', 'test content');
34-
this.api.message.createMessage(MessageType.INFO, 'test', 'test content');
35-
36-
this.addCommand({
37-
id: 'test',
38-
name: 'JS Engine Test Command',
39-
callback: () => {},
40-
});
31+
// this.addCommand({
32+
// id: 'test',
33+
// name: 'JS Engine Test Command',
34+
// callback: () => {},
35+
// });
4136

4237
this.registerMarkdownCodeBlockProcessor('js-engine', (source, el, ctx) => {
4338
const mdrc = new JsMDRC(el, this, source, ctx);

0 commit comments

Comments
 (0)