Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a74efb96a | ||
|
|
fae8b68647 |
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
# Obsidian Menus
|
# Monster Menus
|
||||||
Create simple, stylable menus from code blocks. Write links inside a menu code block, and the plugin renders a clean set of clickable items.
|
Create simple, stylable menus from code blocks. Write links inside a menu code block, and the plugin renders a clean set of clickable items.
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
@@ -38,11 +38,11 @@ layout: slate small
|
|||||||
[Resources](https://example.com)
|
[Resources](https://example.com)
|
||||||
```
|
```
|
||||||
|
|
||||||
Without a `layout:` line, the menu uses the default layout chosen in the plugin settings.
|
Without a `layout:` line (or with only modifiers, like `layout: small`), the menu uses the default layout chosen in the plugin settings.
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
Customize any menu with `key: value` lines before the links:
|
Customize any menu with `key: value` lines (put them before the links for readability):
|
||||||
|
|
||||||
| Option | Effect |
|
| Option | Effect |
|
||||||
|---|---|
|
|---|---|
|
||||||
@@ -107,7 +107,7 @@ hover-text: #0af
|
|||||||
|
|
||||||
## Dataview Integration
|
## Dataview Integration
|
||||||
|
|
||||||
Generate links dynamically from Dataview queries. Prefix your query with `dataview:` or `dv:`:
|
Generate links from a Dataview query (requires the Dataview plugin). Start the query with `dataview:` or `dv:`. Everything after that line is part of the query, so put it last:
|
||||||
|
|
||||||
```code
|
```code
|
||||||
layout: default
|
layout: default
|
||||||
@@ -115,7 +115,11 @@ layout: default
|
|||||||
dataview: LIST FROM "Projects"
|
dataview: LIST FROM "Projects"
|
||||||
```
|
```
|
||||||
|
|
||||||
The plugin unwraps Dataview results so links blend seamlessly into your menu layout.
|
Dataview's links join the menu row and take the layout's style. Per-link-type options apply too: note links count as `internal-`, everything else as `external-`.
|
||||||
|
|
||||||
|
## Editing a Menu
|
||||||
|
|
||||||
|
In Live Preview, clicking a menu link follows it instead of opening the code block. The code block's border and `</>` button are hidden; to edit the menu, click the thin strip (0.5rem) on the menu's left edge. The cursor changes to a question mark over it.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ var MenuPluginSettingTab = class extends import_obsidian.PluginSettingTab {
|
|||||||
display() {
|
display() {
|
||||||
const { containerEl } = this;
|
const { containerEl } = this;
|
||||||
containerEl.empty();
|
containerEl.empty();
|
||||||
new import_obsidian.Setting(containerEl).setName("Default layout").setDesc("Layout used when a menu block has no layout: line.").addDropdown((dropdown) => {
|
new import_obsidian.Setting(containerEl).setName("Default layout").setDesc("Layout used when a menu block has no layout: line, or only modifiers (small, grid).").addDropdown((dropdown) => {
|
||||||
for (const layout of LAYOUTS) {
|
for (const layout of LAYOUTS) {
|
||||||
dropdown.addOption(layout, layout.charAt(0).toUpperCase() + layout.slice(1));
|
dropdown.addOption(layout, layout.charAt(0).toUpperCase() + layout.slice(1));
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ var MenuPluginSettingTab = class extends import_obsidian.PluginSettingTab {
|
|||||||
new import_obsidian.Setting(containerEl).setName("Usage guide").setHeading();
|
new import_obsidian.Setting(containerEl).setName("Usage guide").setHeading();
|
||||||
const doc = containerEl.createEl("div", { cls: "menu-settings-docs" });
|
const doc = containerEl.createEl("div", { cls: "menu-settings-docs" });
|
||||||
doc.createEl("p", {
|
doc.createEl("p", {
|
||||||
text: "Put one link per line in a `menu` code block. Options go before the links."
|
text: "Put one link per line in a `menu` code block. Options go before the links. To edit a menu in Live Preview, click the thin strip on its left edge."
|
||||||
});
|
});
|
||||||
doc.createEl("h4", { text: "Example" });
|
doc.createEl("h4", { text: "Example" });
|
||||||
const pre = doc.createEl("pre");
|
const pre = doc.createEl("pre");
|
||||||
@@ -260,10 +260,11 @@ radius: 99px
|
|||||||
tr.createEl("td", { text: syntax, cls: "menu-settings-syntax" });
|
tr.createEl("td", { text: syntax, cls: "menu-settings-syntax" });
|
||||||
tr.createEl("td", { text: description });
|
tr.createEl("td", { text: description });
|
||||||
};
|
};
|
||||||
addRow("[[Note]]", "Opens an Obsidian note (Ctrl-click or middle-click: new tab)");
|
addRow("[[Note]]", "Opens an Obsidian note (Ctrl-click or middle-click: new tab; Ctrl-hover: preview)");
|
||||||
addRow("[[Note|Alias]]", "Obsidian note with custom display text");
|
addRow("[[Note|Alias]]", "Obsidian note with custom display text");
|
||||||
addRow("[Text](https://...)", "Opens URL in your browser");
|
addRow("[Text](https://...)", "Opens URL in your browser");
|
||||||
addRow("[Text](file:///path)", "Opens a local file or folder (desktop only)");
|
addRow("[Text](file:///path)", "Opens a local file or folder (desktop only)");
|
||||||
|
addRow("[Text](<file:///path with spaces>)", "File path containing spaces");
|
||||||
doc.createEl("h4", { text: "Options" });
|
doc.createEl("h4", { text: "Options" });
|
||||||
const propTable = doc.createEl("table", { cls: "menu-settings-table" });
|
const propTable = doc.createEl("table", { cls: "menu-settings-table" });
|
||||||
const addProp = (prop, values, description) => {
|
const addProp = (prop, values, description) => {
|
||||||
@@ -278,7 +279,7 @@ radius: 99px
|
|||||||
addProp("hover-text / hover-bg / hover-border", "any CSS value", "Hover colors");
|
addProp("hover-text / hover-bg / hover-border", "any CSS value", "Hover colors");
|
||||||
addProp("size / gap / radius / padding", "any CSS length", "Font size, spacing, corner rounding");
|
addProp("size / gap / radius / padding", "any CSS length", "Font size, spacing, corner rounding");
|
||||||
addProp("internal-* / external-* / file-*", "any CSS value", "Color or font for one link type");
|
addProp("internal-* / external-* / file-*", "any CSS value", "Color or font for one link type");
|
||||||
addProp("dataview: / dv:", "Dataview query", "Add links from Dataview (rest of block)");
|
addProp("dataview: / dv:", "Dataview query", "Add links from Dataview; the rest of the block is the query (needs Dataview)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Annotate the CommonJS export names for ESM import in node:
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class MenuPluginSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Default layout')
|
.setName('Default layout')
|
||||||
.setDesc('Layout used when a menu block has no layout: line.')
|
.setDesc('Layout used when a menu block has no layout: line, or only modifiers (small, grid).')
|
||||||
.addDropdown(dropdown => {
|
.addDropdown(dropdown => {
|
||||||
for (const layout of LAYOUTS) {
|
for (const layout of LAYOUTS) {
|
||||||
dropdown.addOption(layout, layout.charAt(0).toUpperCase() + layout.slice(1));
|
dropdown.addOption(layout, layout.charAt(0).toUpperCase() + layout.slice(1));
|
||||||
@@ -248,7 +248,8 @@ class MenuPluginSettingTab extends PluginSettingTab {
|
|||||||
const doc = containerEl.createEl('div', { cls: 'menu-settings-docs' });
|
const doc = containerEl.createEl('div', { cls: 'menu-settings-docs' });
|
||||||
|
|
||||||
doc.createEl('p', {
|
doc.createEl('p', {
|
||||||
text: 'Put one link per line in a `menu` code block. Options go before the links.'
|
text: 'Put one link per line in a `menu` code block. Options go before the links. ' +
|
||||||
|
'To edit a menu in Live Preview, click the thin strip on its left edge.'
|
||||||
});
|
});
|
||||||
|
|
||||||
doc.createEl('h4', { text: 'Example' });
|
doc.createEl('h4', { text: 'Example' });
|
||||||
@@ -271,10 +272,11 @@ radius: 99px
|
|||||||
tr.createEl('td', { text: syntax, cls: 'menu-settings-syntax' });
|
tr.createEl('td', { text: syntax, cls: 'menu-settings-syntax' });
|
||||||
tr.createEl('td', { text: description });
|
tr.createEl('td', { text: description });
|
||||||
};
|
};
|
||||||
addRow('[[Note]]', 'Opens an Obsidian note (Ctrl-click or middle-click: new tab)');
|
addRow('[[Note]]', 'Opens an Obsidian note (Ctrl-click or middle-click: new tab; Ctrl-hover: preview)');
|
||||||
addRow('[[Note|Alias]]', 'Obsidian note with custom display text');
|
addRow('[[Note|Alias]]', 'Obsidian note with custom display text');
|
||||||
addRow('[Text](https://...)', 'Opens URL in your browser');
|
addRow('[Text](https://...)', 'Opens URL in your browser');
|
||||||
addRow('[Text](file:///path)', 'Opens a local file or folder (desktop only)');
|
addRow('[Text](file:///path)', 'Opens a local file or folder (desktop only)');
|
||||||
|
addRow('[Text](<file:///path with spaces>)', 'File path containing spaces');
|
||||||
|
|
||||||
doc.createEl('h4', { text: 'Options' });
|
doc.createEl('h4', { text: 'Options' });
|
||||||
const propTable = doc.createEl('table', { cls: 'menu-settings-table' });
|
const propTable = doc.createEl('table', { cls: 'menu-settings-table' });
|
||||||
@@ -290,6 +292,6 @@ radius: 99px
|
|||||||
addProp('hover-text / hover-bg / hover-border', 'any CSS value', 'Hover colors');
|
addProp('hover-text / hover-bg / hover-border', 'any CSS value', 'Hover colors');
|
||||||
addProp('size / gap / radius / padding', 'any CSS length', 'Font size, spacing, corner rounding');
|
addProp('size / gap / radius / padding', 'any CSS length', 'Font size, spacing, corner rounding');
|
||||||
addProp('internal-* / external-* / file-*', 'any CSS value', 'Color or font for one link type');
|
addProp('internal-* / external-* / file-*', 'any CSS value', 'Color or font for one link type');
|
||||||
addProp('dataview: / dv:', 'Dataview query', 'Add links from Dataview (rest of block)');
|
addProp('dataview: / dv:', 'Dataview query', 'Add links from Dataview; the rest of the block is the query (needs Dataview)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "monster-menus",
|
"id": "monster-menus",
|
||||||
"name": "Monster Menus",
|
"name": "Monster Menus",
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"minAppVersion": "0.15.0",
|
"minAppVersion": "0.15.0",
|
||||||
"description": "Create custom menus using code blocks with links and CSS styling.",
|
"description": "Create custom menus using code blocks with links and CSS styling.",
|
||||||
"author": "Olivier Legendre",
|
"author": "Olivier Legendre",
|
||||||
|
|||||||
+4
-5
@@ -1,15 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "menu-plugin",
|
"name": "monster-menus",
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"description": "Create custom menus using code blocks with links and CSS styling.",
|
"description": "Create custom menus using code blocks with links and CSS styling.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node esbuild.config.mjs",
|
"dev": "node esbuild.config.mjs",
|
||||||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production"
|
||||||
"version": "node version-bump.mjs"
|
|
||||||
},
|
},
|
||||||
"keywords": ["obsidian", "plugin", "menu"],
|
"keywords": ["obsidian", "plugin", "menu"],
|
||||||
"author": "Your Name",
|
"author": "Olivier Legendre",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.6",
|
"@types/node": "^16.11.6",
|
||||||
|
|||||||
Reference in new issue
Block a user