Skip to content

Commit

Permalink
Initial commit, version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
necauqua committed Mar 21, 2023
0 parents commit f163358
Show file tree
Hide file tree
Showing 20 changed files with 2,989 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
tab_width = 4
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/

main.js
23 changes: 23 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
}
}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# vscode
.vscode

# Intellij
*.iml
.idea

# npm
node_modules

# Don't include the compiled main.js file in the repo.
main.js

# Exclude sourcemaps
*.map

# Plugin settings
data.json

# Exclude macOS Finder (System Explorer) View States
.DS_Store

# Exclude the direnv cache
.direnv

# In case you ever run nix build
result
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tag-version-prefix=""
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2023 Anton Bulakh <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Obsidian Page Properties

This is a plugin for [Obsidian](https://obsidian.md) which adds page properties similar to those present in Logseq.

![demo-1.png](https://user-images.githubusercontent.com/33968278/226478801-b8e9122d-78ff-4b1b-b4c0-6c6d25d57e9e.png)
![demo-2.png](https://user-images.githubusercontent.com/33968278/226478803-4ca621ba-cdce-4bd9-a408-4214d869f98d.png)

The main two things it does are:
- Adds pretty tag-like styles for full-line inline fields from [Dataview](https://github.com/blacksmithgu/obsidian-dataview) - note that while Dataview is not a dependency they're not that useful without it.
- Makes the field name into an inner link - a cute little feature from Logseq.

Another couple of features, that are *missing* in Logseq are:
- For certain fields the value is converted into a link by a specified pattern - this is configurable.
- This is useful when the tag already describes what the host should be, for example a relevant GitHub repository, or a wiki page - instead of the full link you only set the username/repository part or the wiki page name.
- Works really well with the [Surfing](https://obsidian.md/plugins?id=surfing) plugin :)
- Some fields can be hidden from the reader view - also configurable.

## Installation
- Currently awaiting approval on the [Obsidian Plugin Marketplace](https://obsidian.md/plugins?id=page-properties), so use one of the methods below.
- You can use the [Brat](https://github.com/TfTHacker/obsidian42-brat) plugin.
- You can download the `main.js`, `styles.css` and `manifest.json` files manually from the [releases](https://github.com/necauqua/obsidian-page-properties/releases) page and put them into the `$VAULT/.obsidian/plugins/page-properties` folder.
- For Nix users, you can do this too:
```bash
nix profile install github:necauqua/obsidian-page-properties
ln -s ~/.nix-profile/share/obsidian/plugins/page-properties $VAULT/.obsidian/plugins/page-properties
```
48 changes: 48 additions & 0 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";

const banner =
`/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;

const prod = (process.argv[2] === "production");

const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ["src/main.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/search",
"@codemirror/state",
"@codemirror/view",
"@lezer/common",
"@lezer/highlight",
"@lezer/lr",
...builtins],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
});

if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}
40 changes: 40 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
in {
devShell = pkgs.mkShell {
buildInputs = [ pkgs.nodejs ];
};
packages.default = pkgs.buildNpmPackage {
name = "obsidian-page-properties";
src = ./.;
packageJson = ./package.json;
packageLockJson = ./package-lock.json;
npmDepsHash = "sha256-bMzD0478ysBjLB97CRdM9cBHonHTVrlONR+X3h47p4c=";
installPhase = ''
mkdir -p $out/share/obsidian/plugins/page-properties
npm run build
cp main.js styles.css manifest.json $out/share/obsidian/plugins/page-properties
'';
};
}
);
}
15 changes: 15 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"id": "page-properties",
"name": "Page Properties",
"version": "1.0.0",
"minAppVersion": "0.15.0",
"description": "Render page properties similar to Logseq",
"author": "Anton Bulakh <[email protected]>",
"authorUrl": "https://necauqua.dev",
"fundingUrl": {
"Patreon": "https://www.patreon.com/necauqua",
"Ko-Fi": "https://ko-fi.com/necauqua",
"Buy Me a Coffee": "https://buymeacoffee.com/necauqua"
},
"isDesktopOnly": false
}
Loading

0 comments on commit f163358

Please sign in to comment.