Skip to content

Commit 7860d73

Browse files
committed
fix #119; add quick links to settings page
1 parent 53bc19f commit 7860d73

File tree

9 files changed

+55
-17
lines changed

9 files changed

+55
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ data.json
2222
.DS_Store
2323

2424
obsidian.css
25+
tmp.txt
2526

2627
!exampleVault/.obsidian
2728

bun.lockb

3.34 KB
Binary file not shown.

exampleVault/View Fields/View Field.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ list:
1111
object:
1212
key: value
1313
file: Example Note with Embeds
14-
image: Other/Images/img_frozen_branch.jpg
14+
image: Other/Images/img_butterfly.webp
1515
---
1616

1717
`INPUT[number:number1]`

exampleVault/examples.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ toggle: false
1111
nested:
1212
object: asd
1313
inlineSelect: 0
14+
こんにちは: hello
1415
---
1516

1617
## In callouts
@@ -32,6 +33,10 @@ inlineSelect: 0
3233
3334
`INPUT[inlineSelect(option(0, 'don\'t do this'), option(1, 'do this \\')):inlineSelect]`
3435
36+
## Unicode
37+
38+
`INPUT[text:こんにちは]`
39+
3540
## Linking to a different note
3641
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sit amet porttitor arcu. Quisque scelerisque dolor augue, et posuere nulla bibendum nec. Curabitur sed rhoncus nisl.
3742

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88
"build": "tsc -noEmit -skipLibCheck && bun run esbuild.config.mjs production",
99
"dev-publish": "bun run esbuild.publish.config.mjs",
1010
"build-publish": "tsc -noEmit -skipLibCheck && node esbuild.publish.config.mjs production",
11+
"tsc": "tsc -noEmit -skipLibCheck",
1112
"test": "bun test",
1213
"format": "prettier --write --plugin prettier-plugin-svelte .",
14+
"format:check": "prettier --check --plugin prettier-plugin-svelte .",
1315
"lint": "eslint --max-warnings=0 src/**",
1416
"lint:fix": "eslint --max-warnings=0 --fix src/**",
15-
"types": "tsc -p \"./tsconfig.types.json\""
17+
"types": "tsc -p \"./tsconfig.types.json\"",
18+
"check": "bun run format:check && bun run lint && bun run tsc && bun run test",
19+
"check:fix": "bun run format && bun run lint:fix && bun run tsc && bun run test"
1620
},
1721
"keywords": [],
1822
"author": "Moritz Jung",
@@ -47,7 +51,7 @@
4751
"typescript": "^5.2.2"
4852
},
4953
"dependencies": {
50-
"@lemons_dev/parsinom": "^0.0.10",
54+
"@lemons_dev/parsinom": "^0.0.11",
5155
"@opd-libs/opd-metadata-lib": "0.0.4",
5256
"@opd-libs/opd-utils-lib": "0.0.2",
5357
"@popperjs/core": "^2.11.8",

src/main.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,20 @@ export default class MetaBindPlugin extends Plugin implements IPlugin {
8787

8888
this.registerEditorExtension(createMarkdownRenderChildWidgetEditorPlugin(this));
8989

90+
// this.addCommand({
91+
// id: 'mb-debugger-command',
92+
// name: 'debugger',
93+
// callback: () => {
94+
// // eslint-disable-next-line no-debugger
95+
// debugger;
96+
// },
97+
// });
98+
9099
this.addCommand({
91-
id: 'mb-debugger-command',
92-
name: 'debugger',
100+
id: 'mb-open-docs',
101+
name: 'Open Meta Bind Docs',
93102
callback: () => {
94-
// eslint-disable-next-line no-debugger
95-
debugger;
103+
window.open('https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/', '_blank');
96104
},
97105
});
98106

src/parsers/nomParsers/GeneralParsers.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@ import { type Parser } from '@lemons_dev/parsinom/lib/Parser';
44
import { type ParsingRange } from '@lemons_dev/parsinom/lib/HelperTypes';
55
import { type UnvalidatedFieldArgument } from '../inputFieldParser/InputFieldDeclaration';
66

7-
export const ident = P.regexp(/^[a-z][a-z0-9_-]*/i)
7+
export const ident: Parser<string> = P.sequence(P_UTILS.unicodeLetter(), P.or(P_UTILS.unicodeAlphanumeric(), P.oneOf('-_')).many())
88
.map(x => {
9-
// console.log('ident', x);
10-
return x;
9+
return x[0] + x[1].join('');
1110
})
1211
.describe('identifier');
1312

14-
export const identWithSpaces = P.sequenceMap(
13+
export const identWithSpaces: Parser<string> = P.sequenceMap(
1514
(a, b) => {
1615
return a + b.map(x => x[0] + x[1]).join('');
1716
},
1817
ident,
1918
P.sequence(P_UTILS.optionalWhitespace(), ident).many(),
2019
).describe('identifier with spaces');
2120

22-
export const escapeCharacter = P.string('\\')
21+
export const escapeCharacter: Parser<string> = P.string('\\')
2322
.then(P_UTILS.any())
2423
.map(escaped => {
2524
if (escaped === "'") {
@@ -31,15 +30,15 @@ export const escapeCharacter = P.string('\\')
3130
}
3231
});
3332

34-
function stringFactory(quotes: string): Parser<string> {
33+
function stringParserFactory(quotes: string): Parser<string> {
3534
return P.or(escapeCharacter, P.noneOf(quotes + '\\'))
3635
.many()
3736
.map(x => x.join(''))
3837
.trim(P.string(quotes));
3938
}
4039

41-
export const singleQuotedString = stringFactory("'");
42-
export const doubleQuotedString = stringFactory('"');
40+
export const singleQuotedString: Parser<string> = stringParserFactory("'");
41+
export const doubleQuotedString: Parser<string> = stringParserFactory('"');
4342

4443
export interface ParsingResultNode {
4544
value: string;

src/settings/SettingsTab.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,26 @@ export class MetaBindSettingTab extends PluginSettingTab {
1717

1818
containerEl.empty();
1919

20-
containerEl.createEl('h2', { text: 'Meta Bind Plugin Settings' });
20+
new Setting(containerEl)
21+
.setName('Quick access')
22+
.addButton(cb => {
23+
cb.setButtonText('Docs');
24+
cb.onClick(() => {
25+
window.open('https://mprojectscode.github.io/obsidian-meta-bind-plugin-docs/', '_blank');
26+
});
27+
})
28+
.addButton(cb => {
29+
cb.setButtonText('GitHub');
30+
cb.onClick(() => {
31+
window.open('https://github.com/mProjectsCode/obsidian-meta-bind-plugin', '_blank');
32+
});
33+
})
34+
.addButton(cb => {
35+
cb.setButtonText('Report Issue');
36+
cb.onClick(() => {
37+
window.open('https://github.com/mProjectsCode/obsidian-meta-bind-plugin/issues', '_blank');
38+
});
39+
});
2140

2241
new Setting(containerEl)
2342
.setName('Sync interval')
@@ -110,7 +129,7 @@ export class MetaBindSettingTab extends PluginSettingTab {
110129
});
111130
});
112131

113-
containerEl.createEl('h3', { text: 'Advanced Settings' });
132+
containerEl.createEl('h2', { text: 'Advanced Settings' });
114133

115134
new Setting(containerEl)
116135
.setName('Dev Mode')

tests/happydom.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import { GlobalRegistrator } from '@happy-dom/global-registrator';
22

3+
const oldConsole = console;
34
GlobalRegistrator.register();
5+
window.console = oldConsole;

0 commit comments

Comments
 (0)