initial release
10
.editorconfig
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
3
.eslintignore
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
node_modules/
|
||||
|
||||
main.js
|
||||
23
.eslintrc
Normal file
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
25
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# vscode
|
||||
.vscode
|
||||
|
||||
# Intellij
|
||||
*.iml
|
||||
.idea
|
||||
|
||||
# npm
|
||||
node_modules
|
||||
|
||||
# Don't include the compiled main.js file in the repo.
|
||||
# They should be uploaded to GitHub releases instead.
|
||||
main.js
|
||||
|
||||
# Exclude sourcemaps
|
||||
*.map
|
||||
|
||||
# obsidian
|
||||
data.json
|
||||
|
||||
# Exclude macOS Finder (System Explorer) View States
|
||||
.DS_Store
|
||||
|
||||
.hotreload
|
||||
package-lock.json
|
||||
1
.npmrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
tag-version-prefix=""
|
||||
95
README.md
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# Obsidian Sample Plugin
|
||||
|
||||
This is a sample plugin for Obsidian (https://obsidian.md).
|
||||
|
||||
This project uses Typescript to provide type checking and documentation.
|
||||
The repo depends on the latest plugin API (obsidian.d.ts) in Typescript Definition format, which contains TSDoc comments describing what it does.
|
||||
|
||||
**Note:** The Obsidian API is still in early alpha and is subject to change at any time!
|
||||
|
||||
This sample plugin demonstrates some of the basic functionality the plugin API can do.
|
||||
- Adds a ribbon icon, which shows a Notice when clicked.
|
||||
- Adds a command "Open Sample Modal" which opens a Modal.
|
||||
- Adds a plugin setting tab to the settings page.
|
||||
- Registers a global click event and output 'click' to the console.
|
||||
- Registers a global interval which logs 'setInterval' to the console.
|
||||
|
||||
## First time developing plugins?
|
||||
|
||||
Quick starting guide for new plugin devs:
|
||||
|
||||
- Check if [someone already developed a plugin for what you want](https://obsidian.md/plugins)! There might be an existing plugin similar enough that you can partner up with.
|
||||
- Make a copy of this repo as a template with the "Use this template" button (login to GitHub if you don't see it).
|
||||
- Clone your repo to a local development folder. For convenience, you can place this folder in your `.obsidian/plugins/your-plugin-name` folder.
|
||||
- Install NodeJS, then run `npm i` in the command line under your repo folder.
|
||||
- Run `npm run dev` to compile your plugin from `main.ts` to `main.js`.
|
||||
- Make changes to `main.ts` (or create new `.ts` files). Those changes should be automatically compiled into `main.js`.
|
||||
- Reload Obsidian to load the new version of your plugin.
|
||||
- Enable plugin in settings window.
|
||||
- For updates to the Obsidian API run `npm update` in the command line under your repo folder.
|
||||
|
||||
## Releasing new releases
|
||||
|
||||
- Update your `manifest.json` with your new version number, such as `1.0.1`, and the minimum Obsidian version required for your latest release.
|
||||
- Update your `versions.json` file with `"new-plugin-version": "minimum-obsidian-version"` so older versions of Obsidian can download an older version of your plugin that's compatible.
|
||||
- Create new GitHub release using your new version number as the "Tag version". Use the exact version number, don't include a prefix `v`. See here for an example: https://github.com/obsidianmd/obsidian-sample-plugin/releases
|
||||
- Upload the files `manifest.json`, `main.js`, `styles.css` as binary attachments. Note: The manifest.json file must be in two places, first the root path of your repository and also in the release.
|
||||
- Publish the release.
|
||||
|
||||
> You can simplify the version bump process by running `npm version patch`, `npm version minor` or `npm version major` after updating `minAppVersion` manually in `manifest.json`.
|
||||
> The command will bump version in `manifest.json` and `package.json`, and add the entry for the new version to `versions.json`
|
||||
|
||||
## Adding your plugin to the community plugin list
|
||||
|
||||
- Check https://github.com/obsidianmd/obsidian-releases/blob/master/plugin-review.md
|
||||
- Publish an initial version.
|
||||
- Make sure you have a `README.md` file in the root of your repo.
|
||||
- Make a pull request at https://github.com/obsidianmd/obsidian-releases to add your plugin.
|
||||
|
||||
## How to use
|
||||
|
||||
- Clone this repo.
|
||||
- `npm i` or `yarn` to install dependencies
|
||||
- `npm run dev` to start compilation in watch mode.
|
||||
|
||||
## Manually installing the plugin
|
||||
|
||||
- Copy over `main.js`, `styles.css`, `manifest.json` to your vault `VaultFolder/.obsidian/plugins/your-plugin-id/`.
|
||||
|
||||
## Improve code quality with eslint (optional)
|
||||
- [ESLint](https://eslint.org/) is a tool that analyzes your code to quickly find problems. You can run ESLint against your plugin to find common bugs and ways to improve your code.
|
||||
- To use eslint with this project, make sure to install eslint from terminal:
|
||||
- `npm install -g eslint`
|
||||
- To use eslint to analyze this project use this command:
|
||||
- `eslint main.ts`
|
||||
- eslint will then create a report with suggestions for code improvement by file and line number.
|
||||
- If your source code is in a folder, such as `src`, you can use eslint with this command to analyze all files in that folder:
|
||||
- `eslint .\src\`
|
||||
|
||||
## Funding URL
|
||||
|
||||
You can include funding URLs where people who use your plugin can financially support it.
|
||||
|
||||
The simple way is to set the `fundingUrl` field to your link in your `manifest.json` file:
|
||||
|
||||
```json
|
||||
{
|
||||
"fundingUrl": "https://buymeacoffee.com"
|
||||
}
|
||||
```
|
||||
|
||||
If you have multiple URLs, you can also do:
|
||||
|
||||
```json
|
||||
{
|
||||
"fundingUrl": {
|
||||
"Buy Me a Coffee": "https://buymeacoffee.com",
|
||||
"GitHub Sponsor": "https://github.com/sponsors",
|
||||
"Patreon": "https://www.patreon.com/"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## API Documentation
|
||||
|
||||
See https://github.com/obsidianmd/obsidian-api
|
||||
BIN
assets/Badges-demo-Obsidian-v1.3.7-20230709144540.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
assets/Badges-demo-Obsidian-v1.3.7-20230709144545.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
assets/Badges-demo-Obsidian-v1.3.7-20230709170943.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
assets/Badges-demo-Obsidian-v1.3.7-20230709170950.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
assets/Badges-demo-Obsidian-v1.3.7-20230709171043.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
assets/Badges-demo-Obsidian-v1.3.7-20230709171053.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
assets/Badges-demo-Obsidian-v1.3.7-20230709171534.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/Badges-demo-Obsidian-v1.3.7-20230709171541.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
assets/Badges-demo-Obsidian-v1.3.7-20230709171707.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
assets/Badges-demo-Obsidian-v1.3.7-20230709171713.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
96
assets/badges-dataview.md
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
#### Example regex
|
||||
|
||||
```js
|
||||
let regex = /`\[!!info\:(.+?)\]`/gm
|
||||
let regex = /`\[!!\|ghb>(.+?)\]`/gm
|
||||
let regex = /`\[!!\|ghs>(.+?)\]`/gm
|
||||
let regex = /`\[!!\|plus\-square(.+?)\]`/gm
|
||||
```
|
||||
|
||||
#### info
|
||||
|
||||
````
|
||||
```dataviewjs
|
||||
const pages = dv.pages();
|
||||
let regex = /`\[!!info\:(.+?)\]`/gm
|
||||
const rows = []
|
||||
for (const page of pages) {
|
||||
const file = app.vault.getAbstractFileByPath(page.file.path)
|
||||
if (file.extension == "md") {
|
||||
const contents = await app.vault.read(file)
|
||||
for (const badge of contents.match(new RegExp(regex, 'g')) || []) {
|
||||
const match = badge.match(new RegExp(regex, 's'))
|
||||
rows.push([match[1], page.file.link])
|
||||
}
|
||||
}
|
||||
}
|
||||
dv.table(['Badge', 'Link'], rows)
|
||||
```
|
||||
````
|
||||
|
||||
#### github
|
||||
|
||||
````
|
||||
```dataviewjs
|
||||
const pages = dv.pages();
|
||||
let regex = /`\[!!\|ghb>(.+?)\]`/gm
|
||||
const rows = []
|
||||
for (const page of pages) {
|
||||
const file = app.vault.getAbstractFileByPath(page.file.path)
|
||||
if (file.extension == "md") {
|
||||
const contents = await app.vault.read(file)
|
||||
for (const badge of contents.match(new RegExp(regex, 'g')) || []) {
|
||||
const match = badge.match(new RegExp(regex, 's'))
|
||||
rows.push([match[1], page.file.link])
|
||||
}
|
||||
}
|
||||
}
|
||||
dv.table(['Badge', 'Link'], rows)
|
||||
```
|
||||
````
|
||||
|
||||
#### github success
|
||||
|
||||
````
|
||||
```dataviewjs
|
||||
const pages = dv.pages();
|
||||
let regex = /`\[!!\|ghs>(.+?)\]`/gm
|
||||
const rows = []
|
||||
for (const page of pages) {
|
||||
const file = app.vault.getAbstractFileByPath(page.file.path)
|
||||
if (file.extension == "md") {
|
||||
const contents = await app.vault.read(file)
|
||||
for (const badge of contents.match(new RegExp(regex, 'g')) || []) {
|
||||
const match = badge.match(new RegExp(regex, 's'))
|
||||
rows.push([match[1], page.file.link])
|
||||
}
|
||||
}
|
||||
}
|
||||
dv.table(['Badge', 'Link'], rows)
|
||||
```
|
||||
````
|
||||
|
||||
#### custom
|
||||
|
||||
````
|
||||
```dataviewjs
|
||||
const pages = dv.pages();
|
||||
let regex = /`\[!!\|plus\-square(.+?)\]`/gm
|
||||
const rows = []
|
||||
for (const page of pages) {
|
||||
const file = app.vault.getAbstractFileByPath(page.file.path)
|
||||
if (file.extension == "md") {
|
||||
const contents = await app.vault.read(file)
|
||||
for (const badge of contents.match(new RegExp(regex, 'g')) || []) {
|
||||
const match = badge.match(new RegExp(regex, 's'))
|
||||
rows.push([
|
||||
match[1].split("|")[1].split(":")[0],
|
||||
match[1].split("|")[1].split(":")[1],
|
||||
page.file.link
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
dv.table(['Key', 'Value', 'Link'], rows)
|
||||
```
|
||||
````
|
||||
22
assets/badges-demo.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Example
|
||||
|
||||
###### Default
|
||||
|
||||
`[!!note:note]` `[!!info:info]` `[!!todo:todo]` `[!!abstract:abstract]` `[!!summary:summary]` `[!!tldr:tldr]` `[!!tip:tip]` `[!!hint:hint]` `[!!important:important]` `[!!success:success]` `[!!check:check]` `[!!done:done]` `[!!question:question]` `[!!help:help]` `[!!faq:faq]` `[!!warning:warning]` `[!!caution:caution]` `[!!attention:attention]` `[!!failure:failure]` `[!!fail:fail]` `[!!missing:missing]` `[!!danger:danger]` `[!!error:error]` `[!!bug:bug]` `[!!example:example]` `[!!quote:quote]` `[!!cite:cite]`
|
||||
|
||||
|
||||
###### …more
|
||||
|
||||
`[!!emergency: emergency]` `[!!prohibit: prohibit]` `[!!stop:stop]` `[!!bomb: bomb]` `[!!magnet: magnet]` `[!!lock: lock]` `[!!flag: flag]` `[!!claim: claim]` `[!!highlight: highlight]` `[!!clue: clue]` `[!!profile: profile]` `[!!snippet: snippet]` `[!!branch: branch]` `[!!hat-tip: hat-tip]` `[!!dig: dig]` `[!!notice: notice]` `[!!witness: witness]` `[!!attachment: attachment]` `[!!lightbulb: lightbulb]` `[!!exclaim: exclaim]` `[!!hold: hold]` `[!!charge:charge]` `[!!sprout: sprout]` `[!!extract: extract]` `[!!power: power]` `[!!verse:verse]` `[!!complete:complete]` `[!!milestone:milestone]` `[!!component:component]` `[!!polish:polish]` `[!!point:point]` `[!!dream:dream]` `[!!process:process]` `[!!refine:refine]` `[!!image:image]` `[!!party:party]` `[!!crystallize:crystallize]` `[!!definition:definition]` `[!!mention:mention]` `[!!meta:meta]` `[!!compute:compute]` `[!!compass:compass]` `[!!map: map]` `[!!expedition: expedition]` `[!!knowledge: knowledge]` `[!!home: home]` `[!!account: account]` `[!!judgment: judgment]` `[!!balance: balance]` `[!!feast: feast]` `[!!gift: gift]` `[!!love: love]` `[!!specimen: specimen]` `[!!command: command]` `[!!deed: deed]` `[!!honor: honor]` `[!!reward: reward]` `[!!vault: vault]`
|
||||
|
||||
###### Github
|
||||
|
||||
`[!!|ghb>release:1.2.1]` `[!!|ghb>issues:2]` `[!!|ghb>open issues:0]` `[!!|ghb>closed issues:2]` `[!!|ghb>contributors:3]` `[!!|ghb>license:MIT]` `[!!|ghs>checks:success]` `[!!|ghs>build:success]`
|
||||
|
||||
###### Text-only
|
||||
|
||||
`[!!|foo:bar]`
|
||||
|
||||
###### Custom
|
||||
|
||||
`[!!|message-square|comment:edited by j.d.|var(--color-cyan-rgb)]` `[!!|dice|roll:eleven|120,82,238]` `[!!|gem|mineral:emerald|var(--my-custom-rgb)]` `[!!|apple|fruit:snack|var(--color-red-rgb)]` `[!!|brain|brain:2nd-brain|var(--color-purple-rgb)]` `[!!|sun|weather:sunny|var(--color-yellow-rgb)]` `[!!|cloudy|weather:cloudy|var(--mono-rgb-100)]` `[!!|sunset|weather:8.44pm|var(--color-orange-rgb)]` `[!!|dumbbell|reps:3 sets of 50|var(--mono-rgb-00)]` `[!!|gift|event:wedding|var(--color-blue-rgb)]` `[!!|plus-square|credit:$100|var(--color-green-rgb)]` `[!!|minus-square|debit:$10|var(--color-pink-rgb)]`
|
||||
91
assets/badges-search.md
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
#### Example search links
|
||||
|
||||
```markdown
|
||||
- search for: [key](obsidian://search?query=content:"!!key")
|
||||
```
|
||||
|
||||
- search for: [!!abstract](obsidian://search?query=content:"!!abstract")
|
||||
- search for: [!!account](obsidian://search?query=content:"!!account")
|
||||
- search for: [!!attachment](obsidian://search?query=content:"!!attachment")
|
||||
- search for: [!!attention](obsidian://search?query=content:"!!attention")
|
||||
- search for: [!!balance](obsidian://search?query=content:"!!balance")
|
||||
- search for: [!!bomb](obsidian://search?query=content:"!!bomb")
|
||||
- search for: [!!branch](obsidian://search?query=content:"!!branch")
|
||||
- search for: [!!bug](obsidian://search?query=content:"!!bug")
|
||||
- search for: [!!caution](obsidian://search?query=content:"!!caution")
|
||||
- search for: [!!charge](obsidian://search?query=content:"!!charge")
|
||||
- search for: [!!check](obsidian://search?query=content:"!!check")
|
||||
- search for: [!!cite](obsidian://search?query=content:"!!cite")
|
||||
- search for: [!!claim](obsidian://search?query=content:"!!claim")
|
||||
- search for: [!!clue](obsidian://search?query=content:"!!clue")
|
||||
- search for: [!!command](obsidian://search?query=content:"!!command")
|
||||
- search for: [!!compass](obsidian://search?query=content:"!!compass")
|
||||
- search for: [!!complete](obsidian://search?query=content:"!!complete")
|
||||
- search for: [!!component](obsidian://search?query=content:"!!component")
|
||||
- search for: [!!compute](obsidian://search?query=content:"!!compute")
|
||||
- search for: [!!crystallize](obsidian://search?query=content:"!!crystallize")
|
||||
- search for: [!!danger](obsidian://search?query=content:"!!danger")
|
||||
- search for: [!!deed](obsidian://search?query=content:"!!deed")
|
||||
- search for: [!!definition](obsidian://search?query=content:"!!definition")
|
||||
- search for: [!!dig](obsidian://search?query=content:"!!dig")
|
||||
- search for: [!!done](obsidian://search?query=content:"!!done")
|
||||
- search for: [!!dream](obsidian://search?query=content:"!!dream")
|
||||
- search for: [!!emergency](obsidian://search?query=content:"!!emergency")
|
||||
- search for: [!!error](obsidian://search?query=content:"!!error")
|
||||
- search for: [!!example](obsidian://search?query=content:"!!example")
|
||||
- search for: [!!exclaim](obsidian://search?query=content:"!!exclaim")
|
||||
- search for: [!!expedition](obsidian://search?query=content:"!!expedition")
|
||||
- search for: [!!extract](obsidian://search?query=content:"!!extract")
|
||||
- search for: [!!fail](obsidian://search?query=content:"!!fail")
|
||||
- search for: [!!failure](obsidian://search?query=content:"!!failure")
|
||||
- search for: [!!faq](obsidian://search?query=content:"!!faq")
|
||||
- search for: [!!feast](obsidian://search?query=content:"!!feast")
|
||||
- search for: [!!flag](obsidian://search?query=content:"!!flag")
|
||||
- search for: [!!gift](obsidian://search?query=content:"!!gift")
|
||||
- search for: [!!hat-tip](obsidian://search?query=content:"!!hat-tip")
|
||||
- search for: [!!help](obsidian://search?query=content:"!!help")
|
||||
- search for: [!!highlight](obsidian://search?query=content:"!!highlight")
|
||||
- search for: [!!hint](obsidian://search?query=content:"!!hint")
|
||||
- search for: [!!hold](obsidian://search?query=content:"!!hold")
|
||||
- search for: [!!home](obsidian://search?query=content:"!!home")
|
||||
- search for: [!!honor](obsidian://search?query=content:"!!honor")
|
||||
- search for: [!!image](obsidian://search?query=content:"!!image")
|
||||
- search for: [!!important](obsidian://search?query=content:"!!important")
|
||||
- search for: [!!info](obsidian://search?query=content:"!!info")
|
||||
- search for: [!!judgment](obsidian://search?query=content:"!!judgment")
|
||||
- search for: [!!knowledge](obsidian://search?query=content:"!!knowledge")
|
||||
- search for: [!!lightbulb](obsidian://search?query=content:"!!lightbulb")
|
||||
- search for: [!!lock](obsidian://search?query=content:"!!lock")
|
||||
- search for: [!!love](obsidian://search?query=content:"!!love")
|
||||
- search for: [!!magnet](obsidian://search?query=content:"!!magnet")
|
||||
- search for: [!!map](obsidian://search?query=content:"!!map")
|
||||
- search for: [!!mention](obsidian://search?query=content:"!!mention")
|
||||
- search for: [!!meta](obsidian://search?query=content:"!!meta")
|
||||
- search for: [!!milestone](obsidian://search?query=content:"!!milestone")
|
||||
- search for: [!!missing](obsidian://search?query=content:"!!missing")
|
||||
- search for: [!!note](obsidian://search?query=content:"!!note")
|
||||
- search for: [!!notice](obsidian://search?query=content:"!!notice")
|
||||
- search for: [!!party](obsidian://search?query=content:"!!party")
|
||||
- search for: [!!point](obsidian://search?query=content:"!!point")
|
||||
- search for: [!!polish](obsidian://search?query=content:"!!polish")
|
||||
- search for: [!!power](obsidian://search?query=content:"!!power")
|
||||
- search for: [!!process](obsidian://search?query=content:"!!process")
|
||||
- search for: [!!profile](obsidian://search?query=content:"!!profile")
|
||||
- search for: [!!prohibit](obsidian://search?query=content:"!!prohibit")
|
||||
- search for: [!!question](obsidian://search?query=content:"!!question")
|
||||
- search for: [!!quote](obsidian://search?query=content:"!!quote")
|
||||
- search for: [!!refine](obsidian://search?query=content:"!!refine")
|
||||
- search for: [!!reward](obsidian://search?query=content:"!!reward")
|
||||
- search for: [!!snippet](obsidian://search?query=content:"!!snippet")
|
||||
- search for: [!!specimen](obsidian://search?query=content:"!!specimen")
|
||||
- search for: [!!sprout](obsidian://search?query=content:"!!sprout")
|
||||
- search for: [!!stop](obsidian://search?query=content:"!!stop")
|
||||
- search for: [!!success](obsidian://search?query=content:"!!success")
|
||||
- search for: [!!summary](obsidian://search?query=content:"!!summary")
|
||||
- search for: [!!tip](obsidian://search?query=content:"!!tip")
|
||||
- search for: [!!tldr](obsidian://search?query=content:"!!tldr")
|
||||
- search for: [!!todo](obsidian://search?query=content:"!!todo")
|
||||
- search for: [!!vault](obsidian://search?query=content:"!!vault")
|
||||
- search for: [!!verse](obsidian://search?query=content:"!!verse")
|
||||
- search for: [!!warning](obsidian://search?query=content:"!!warning")
|
||||
- search for: [!!witness](obsidian://search?query=content:"!!witness")
|
||||
48
esbuild.config.mjs
Normal file
|
|
@ -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: false,
|
||||
treeShaking: true,
|
||||
outfile: "main.js",
|
||||
});
|
||||
|
||||
if (prod) {
|
||||
await context.rebuild();
|
||||
process.exit(0);
|
||||
} else {
|
||||
await context.watch();
|
||||
}
|
||||
10
manifest.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"id": "badges",
|
||||
"name": "Badges",
|
||||
"version": "1.0.0",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Add inline badges/callouts to notes.",
|
||||
"author": "@gapmiss",
|
||||
"authorUrl": "https://github.com/gapmiss",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
24
package.json
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"name": "badges",
|
||||
"version": "1.0.0",
|
||||
"description": "Badges for Obsidian (https://obsidian.md)",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"dev": "node esbuild.config.mjs",
|
||||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
||||
"version": "node version-bump.mjs && git add manifest.json versions.json"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.11.6",
|
||||
"@typescript-eslint/eslint-plugin": "5.29.0",
|
||||
"@typescript-eslint/parser": "5.29.0",
|
||||
"builtin-modules": "3.3.0",
|
||||
"esbuild": "0.17.3",
|
||||
"obsidian": "latest",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "4.7.4"
|
||||
}
|
||||
}
|
||||
88
src/constants.ts
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
export const BADGE_TYPES:any[] = [
|
||||
["note", 'Note', 'lucide-pencil'],
|
||||
["info", 'Info', 'lucide-info'],
|
||||
["todo", 'Todo', 'lucide-check-circle-2'],
|
||||
["abstract", 'Abstract', 'lucide-clipboard-list'],
|
||||
["summary", 'Summary', 'lucide-clipboard-list'],
|
||||
["tldr", 'TLDR', 'lucide-clipboard-list'],
|
||||
["tip", 'Tip', 'lucide-flame'],
|
||||
["hint", 'Hint', 'lucide-flame'],
|
||||
["important", 'Important', 'lucide-flame'],
|
||||
["success", 'Success', 'lucide-check'],
|
||||
["check", 'Check', 'lucide-check'],
|
||||
["done", 'Done', 'lucide-check'],
|
||||
["question", 'Question', 'help-circle'],
|
||||
["help", 'Help', 'help-circle'],
|
||||
["faq", 'FAQ', 'help-circle'],
|
||||
["warning", 'Warning', 'lucide-alert-triangle'],
|
||||
["caution", 'Caution', 'lucide-alert-triangle'],
|
||||
["attention", 'Attention', 'lucide-alert-triangle'],
|
||||
["failure", 'Failure', 'lucide-x'],
|
||||
["fail", 'Fail', 'lucide-x'],
|
||||
["missing", 'Missing', 'lucide-x'],
|
||||
["danger", 'Danger', 'lucide-zap'],
|
||||
["error", 'Error', 'lucide-zap'],
|
||||
["bug", 'Bug', 'lucide-bug'],
|
||||
["example", 'Example', 'lucide-list'],
|
||||
["quote", 'Quote', 'quote-glyph'],
|
||||
["cite", 'Cite', 'quote-glyph'],
|
||||
["power", 'Power', 'lucide-power'],
|
||||
["verse", 'Verse', 'lucide-music'],
|
||||
["complete", 'Complete', 'lucide-check-circle'],
|
||||
["milestone", 'Milestone', 'lucide-milestone'],
|
||||
["component", 'Component', 'lucide-toy-brick'],
|
||||
["polish", 'Polish', 'lucide-car'],
|
||||
["point", 'point', 'lucide-pointer'],
|
||||
["dream", 'Dream', 'lucide-moon'],
|
||||
["process", 'Process', 'lucide-clock'],
|
||||
["refine", 'Refine', 'lucide-axe'],
|
||||
["image", 'Image', 'lucide-image'],
|
||||
["party", 'Party', 'lucide-party-popper'],
|
||||
["crystallize", 'Crystallize', 'lucide-diamond'],
|
||||
["definition", 'Definition', 'lucide-key'],
|
||||
["mention", 'Mention', 'lucide-at-sign'],
|
||||
["exclaim", 'Exclaim', 'lucide-megaphone'],
|
||||
["meta", 'Meta', 'lucide-filter'],
|
||||
["compute", 'Compute', 'lucide-hourglass'],
|
||||
["emergency", 'Emergency', 'lucide-siren'],
|
||||
["magnet", 'Magnet', 'lucide-magnet'],
|
||||
["flag", 'Flag', 'flag'],
|
||||
["branch", 'Branch', 'network'],
|
||||
["snippet", 'Snippet', 'scissors'],
|
||||
["lock", 'Lock', 'lock'],
|
||||
["highlight", 'Highlight', 'highlighter'],
|
||||
["clue", 'Clue', 'puzzle'],
|
||||
["claim", 'Claim', 'anchor'],
|
||||
["profile", 'Profile', 'lucide-user'],
|
||||
["hat-tip", 'Hat-tip', 'hard-hat'],
|
||||
["dig", 'Dig', 'shovel'],
|
||||
["witness", 'Witness', 'edit-3'],
|
||||
["notice", 'Notice', 'pen-tool'],
|
||||
["attachment", 'Attachment', 'paperclip'],
|
||||
["lightbulb", 'Lightbulb', 'lightbulb'],
|
||||
["prohibit", 'Prohibit', 'ban'],
|
||||
["stop", 'Stop', 'lucide-alert-octagon'],
|
||||
["bomb", 'Bomb', 'lucide-bomb'],
|
||||
["hold", 'Hold', 'lucide-hand'],
|
||||
["charge", 'Charge', 'lucide-zap'],
|
||||
["sprout", 'Sprout', 'lucide-sprout'],
|
||||
["extract", 'Extract', 'lucide-hammer'],
|
||||
["compass", 'Compass', 'lucide-compass'],
|
||||
["map", 'Map', 'lucide-map'],
|
||||
["expedition", 'Expedition', 'lucide-mountain-snow'],
|
||||
["home", 'Home', 'lucide-home'],
|
||||
["knowledge", 'Knowledge', 'lucide-book'],
|
||||
["account", 'Account', 'open-vault'],
|
||||
["judgment", 'Judgment', 'lucide-gavel'],
|
||||
["balance", 'Balance', 'lucide-scale'],
|
||||
["feast", 'Feast', 'lucide-grape'],
|
||||
["gift", 'Gift', 'lucide-gift'],
|
||||
["love", 'Love', 'lucide-heart'],
|
||||
["specimen", 'Specimen', 'lucide-gem'],
|
||||
["command", 'Command', 'lucide-swords'],
|
||||
["deed", 'Deed', 'lucide-scroll'],
|
||||
["honor", 'Honor', 'lucide-sword'],
|
||||
["reward", 'Reward', 'lucide-crown'],
|
||||
["customized", 'Customized', 'hash'],
|
||||
["vault", 'Vault', 'vault'],
|
||||
];
|
||||
123
src/main.ts
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
import { MarkdownPostProcessor, Plugin, setIcon, PluginManifest } from 'obsidian';
|
||||
import { BADGE_TYPES } from './constants';
|
||||
|
||||
export default class BadgesPlugin extends Plugin {
|
||||
plugin: Plugin;
|
||||
manifest: PluginManifest;
|
||||
|
||||
async onload() {
|
||||
this.registerMarkdownPostProcessor(
|
||||
buildPostProcessor()
|
||||
);
|
||||
console.log("Badges plugin loaded");
|
||||
}
|
||||
|
||||
onunload() {
|
||||
console.log("Badges plugin unloaded");
|
||||
}
|
||||
}
|
||||
|
||||
export function buildPostProcessor(): MarkdownPostProcessor {
|
||||
return (el) => {
|
||||
el.findAll("code").forEach(
|
||||
(code) => {
|
||||
let text:string|undefined = code.innerText.trim();
|
||||
// matches
|
||||
if (text !== undefined && text.startsWith('[!!') && text.endsWith(']')) {
|
||||
// trim syntax chars from text
|
||||
let part:string = text.substring(2);
|
||||
let content:string = part.substring(part.length-1,1).trim();
|
||||
// split on ":"
|
||||
let parts:any[] = content.split(':');
|
||||
// return if NO CONTENT
|
||||
if (parts.length < 2) {
|
||||
return;
|
||||
}
|
||||
// define type of badge
|
||||
let badgeType:string = parts[0].trim();
|
||||
// build and check for extras
|
||||
let extras:any[] = badgeType.split("|");
|
||||
let hasExtra:boolean = extras.length > 1;
|
||||
// title value for badge
|
||||
let badgeContent:string = parts[1].trim();
|
||||
// HTML Elements
|
||||
let newEl:HTMLElement = document.createElement("span");
|
||||
let iconEl:HTMLElement = document.createElement("span");
|
||||
let titleEl:HTMLElement = document.createElement("span");
|
||||
let textEl:HTMLElement = document.createElement("span");
|
||||
let attrType:any = "";
|
||||
// custom badge
|
||||
if (extras.length == 3) {
|
||||
// icon
|
||||
iconEl.addClass("inline-badge-icon");
|
||||
attrType = 'customized';
|
||||
setIcon(iconEl, extras[1]);
|
||||
iconEl.setAttr("aria-label", extras[2]);
|
||||
// title/color
|
||||
let styles:any[] = parts[1].split("|");
|
||||
let title:string = styles[0].trim();
|
||||
let color:string = styles[1].trim();
|
||||
// title
|
||||
titleEl.addClass("inline-badge-title-inner");
|
||||
titleEl.setText(title);
|
||||
newEl.addClass('inline-badge');
|
||||
newEl.setAttr("data-inline-badge", attrType.toLowerCase());
|
||||
// color
|
||||
newEl.setAttr("style", "--customize-badge-color: "+color+";");
|
||||
// render
|
||||
newEl.appendChild(iconEl);
|
||||
if (textEl.getText() != "") {
|
||||
newEl.appendChild(textEl);
|
||||
}
|
||||
newEl.appendChild(titleEl);
|
||||
// set attrType to custom "key"
|
||||
attrType = extras.join("|");
|
||||
} else {
|
||||
if (hasExtra) {
|
||||
// Github badges
|
||||
if (extras[1].startsWith('ghb>') || extras[1].startsWith('ghs>')) {
|
||||
let ghType:string = extras[1].split('>')[1].trim();
|
||||
setIcon(iconEl, "github");
|
||||
iconEl.addClass("inline-badge-icon");
|
||||
iconEl.setAttr("aria-label", "Github");
|
||||
textEl.addClass("gh-type");
|
||||
textEl.setText(ghType);
|
||||
iconEl.appendChild(textEl);
|
||||
attrType = (extras[1].startsWith('ghb>')) ? 'github' : 'github-success';
|
||||
badgeType = (extras[1].startsWith('ghb>')) ? 'github' : 'github-success';
|
||||
// NO icon, text-only
|
||||
} else {
|
||||
iconEl.addClass("inline-badge-extra");
|
||||
iconEl.setText(badgeType.split("|")[1].trim());
|
||||
attrType = 'text';
|
||||
badgeType = 'text';
|
||||
}
|
||||
// non-Github
|
||||
} else {
|
||||
iconEl.addClass("inline-badge-icon");
|
||||
attrType = badgeType.trim();
|
||||
BADGE_TYPES.forEach((el) => {
|
||||
if (el.indexOf(badgeType.toLowerCase()) === 0 && el[2].length > 0) {
|
||||
setIcon(iconEl, el[2]);
|
||||
iconEl.setAttr("aria-label", badgeType.trim());
|
||||
}
|
||||
});
|
||||
}
|
||||
// render
|
||||
titleEl.addClass("inline-badge-title-inner");
|
||||
titleEl.setText(badgeContent);
|
||||
newEl.addClass('inline-badge');
|
||||
newEl.setAttr("data-inline-badge", attrType.toLowerCase());
|
||||
newEl.appendChild(iconEl);
|
||||
if (textEl.getText() != "") {
|
||||
newEl.appendChild(textEl);
|
||||
}
|
||||
newEl.appendChild(titleEl);
|
||||
}
|
||||
// replace code with newEl
|
||||
code.replaceWith(newEl);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
420
styles.css
Normal file
|
|
@ -0,0 +1,420 @@
|
|||
body {
|
||||
--inline-badge-border-color: transparent;
|
||||
--inline-badge-border-radius: var(--radius-s);
|
||||
--inline-badge-border: 1px solid var(--inline-badge-border-color);
|
||||
--my-custom-rgb: var(--color-green-rgb);
|
||||
}
|
||||
.inline-badge {
|
||||
display: inline-flex;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: middle;
|
||||
border-radius: var(--inline-badge-border-radius);
|
||||
font-weight: 500;
|
||||
border: var(--inline-badge-border);
|
||||
cursor: default;
|
||||
}
|
||||
.inline-badge .inline-badge-extra::after {
|
||||
content: ':';
|
||||
}
|
||||
.inline-badge .gh-type {
|
||||
display: inline-block !important;
|
||||
font-size: .8em;
|
||||
padding-right: .5em;
|
||||
padding-top: .15em;
|
||||
color: var(--color-blue);
|
||||
}
|
||||
.inline-badge .inline-badge-extra {
|
||||
display: inline-block !important;
|
||||
font-size: .8em;
|
||||
padding-inline: .5em;
|
||||
padding-top: .15em;
|
||||
font-family: inherit;
|
||||
}
|
||||
.inline-badge .inline-badge-icon {
|
||||
padding: 3px;
|
||||
}
|
||||
.inline-badge .inline-badge-icon svg{
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
.inline-badge .inline-badge-extra,
|
||||
.inline-badge .inline-badge-icon {
|
||||
display: inline-flex !important;
|
||||
}
|
||||
.inline-badge .inline-badge-title-inner {
|
||||
display: inline-block !important;
|
||||
font-size: .8em;
|
||||
font-weight: inherit;
|
||||
padding-right: 5px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
.inline-badge[data-inline-badge="info"],
|
||||
.inline-badge[data-inline-badge="todo"],
|
||||
.inline-badge[data-inline-badge="note"] {
|
||||
color: rgba(var(--color-blue-rgb),1);
|
||||
background-color: rgba(var(--color-blue-rgb),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge="example"] {
|
||||
color: rgba(var(--color-purple-rgb),1);
|
||||
background-color: rgba(var(--color-purple-rgb),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge="abstract"],
|
||||
.inline-badge[data-inline-badge="summary"],
|
||||
.inline-badge[data-inline-badge="tldr"],
|
||||
.inline-badge[data-inline-badge="tip"],
|
||||
.inline-badge[data-inline-badge="hint"],
|
||||
.inline-badge[data-inline-badge="important"] {
|
||||
color: rgba(var(--color-cyan-rgb), 1);
|
||||
background-color: rgba(var(--color-cyan-rgb), .133);
|
||||
}
|
||||
.inline-badge[data-inline-badge="success"],
|
||||
.inline-badge[data-inline-badge="check"],
|
||||
.inline-badge[data-inline-badge="done"] {
|
||||
color: rgba(var(--color-green-rgb), 1);
|
||||
background-color: rgba(var(--color-green-rgb), .123);
|
||||
}
|
||||
.inline-badge[data-inline-badge="question"],
|
||||
.inline-badge[data-inline-badge="help"],
|
||||
.inline-badge[data-inline-badge="faq"] {
|
||||
color: rgba(var(--color-yellow-rgb), 1);
|
||||
background-color: rgba(var(--color-yellow-rgb), .123);
|
||||
}
|
||||
.inline-badge[data-inline-badge="warning"],
|
||||
.inline-badge[data-inline-badge="caution"],
|
||||
.inline-badge[data-inline-badge="attention"] {
|
||||
color: rgba(var(--color-orange-rgb),1);
|
||||
background-color: rgba(var(--color-orange-rgb),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge="failure"],
|
||||
.inline-badge[data-inline-badge="fail"],
|
||||
.inline-badge[data-inline-badge="missing"],
|
||||
.inline-badge[data-inline-badge="bug"],
|
||||
.inline-badge[data-inline-badge="error"],
|
||||
.inline-badge[data-inline-badge="danger"] {
|
||||
color: rgba(var(--color-red-rgb),1);
|
||||
background-color: rgba(var(--color-red-rgb),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="power"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 70,164,115;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="verse"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 80,181,132;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="complete"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 78,182,127;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="milestone"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 70,164,115;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="component"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 22,195,221;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="polish"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 26,194,225;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="refine"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 0,177,206;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="process"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 0,176,210;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="dream"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 0,179,194;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="point"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 0,196,215;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="crystallize"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 0,160,190;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="party"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 0,160,186;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="image"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 0,162,175;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="compute"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
--badge-color: 97,163,230;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="meta"] {
|
||||
--badge-color: 100,141,213;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.168);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="definition"] {
|
||||
--badge-color: 122,155,236;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="expedition"] {
|
||||
--badge-color: 100,141,213;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="map"] {
|
||||
--badge-color: 140,150,236;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="compass"] {
|
||||
--badge-color: 140,150,236;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="knowledge"] {
|
||||
--badge-color: 97,163,230;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="home"] {
|
||||
--badge-color: 182,156,246;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="account"] {
|
||||
--badge-color: 204,148,230;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="judgment"] {
|
||||
--badge-color: 148,129,204;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="balance"] {
|
||||
--badge-color: 164,143,225;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="feast"] {
|
||||
--badge-color: 182,156,246;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="gift"] {
|
||||
--badge-color: 204,148,230;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="love"] {
|
||||
--badge-color: 208,128,182;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="specimen"] {
|
||||
--badge-color: 208,126,186;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="command"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
--badge-color: 189,114,168;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="deed"] {
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
--badge-color: 229,140,197;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="honor"] {
|
||||
--badge-color: 229,140,197;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="reward"] {
|
||||
--badge-color: 164,143,225;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge="customized"] {
|
||||
color: rgba(var(--customize-badge-color), 1);
|
||||
background-color: rgba(var(--customize-badge-color),.177);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="claim"] {
|
||||
--badge-color: 214,139,71;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="clue"] {
|
||||
--badge-color: 206,144,66;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="highlight"] {
|
||||
--badge-color: 186,130,58;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="lock"] {
|
||||
--badge-color: 223,124,142;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="snippet"] {
|
||||
--badge-color: 186,130,58;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="branch"] {
|
||||
--badge-color: 186,130,58;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="flag"] {
|
||||
--badge-color: 241,138,161;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="dig"] {
|
||||
--badge-color: 163,143,45;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="profile"] {
|
||||
--badge-color: 224,159,71;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="notice"] {
|
||||
--badge-color: 199,173,64;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="witness"] {
|
||||
--badge-color: 146,150,58;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="attachment"] {
|
||||
--badge-color: 146,150,58;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="lightbulb"] {
|
||||
--badge-color: 180,180,74;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="hat-tip"] {
|
||||
--badge-color: 180,158,51;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="magnet"] {
|
||||
--badge-color: 225,129,99;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="emergency"] {
|
||||
--badge-color: 202,112,129;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="prohibit"] {
|
||||
--badge-color: 245,140,129;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="stop"] {
|
||||
--badge-color: 245,140,129;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="bomb"] {
|
||||
--badge-color: 223,127,120;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="extract"] {
|
||||
--badge-color: 78,182,127;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="sprout"] {
|
||||
--badge-color: 97,198,138;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="charge"] {
|
||||
--badge-color: 84,199,148;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="hold"] {
|
||||
--badge-color: 88,199,146;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="mention"] {
|
||||
--badge-color: var(--color-blue-rgb);
|
||||
color: rgba(var(--badge-color), .8);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="exclaim"] {
|
||||
--badge-color: var(--color-green-rgb);
|
||||
color: rgba(var(--badge-color), .8);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="vault"] {
|
||||
--badge-color: var(--color-purple-rgb);
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
/* Github */
|
||||
.inline-badge[data-inline-badge="github"] .gh-type {
|
||||
color: var(--color-blue-rgb) !important;
|
||||
}
|
||||
.inline-badge[data-inline-badge="github"] .inline-badge-title-inner {
|
||||
color:var(--text-normal);
|
||||
}
|
||||
.inline-badge[data-inline-badge="github"] {
|
||||
--badge-color: var(--color-blue-rgb);
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
/* Github SUCCESS */
|
||||
.inline-badge[data-inline-badge^="github-success"] .gh-type {
|
||||
color: var(--color-green-rgb) !important;
|
||||
}
|
||||
.inline-badge[data-inline-badge^="github-success"] .inline-badge-title-inner {
|
||||
color:var(--text-normal);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="github-success"] {
|
||||
--badge-color: var(--color-green-rgb);
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.144);
|
||||
}
|
||||
.inline-badge[data-inline-badge^="brain"] {
|
||||
--badge-color: 206,144,66;
|
||||
color: rgba(var(--badge-color), 1);
|
||||
background-color: rgba(var(--badge-color),.123);
|
||||
}
|
||||
25
tsconfig.json
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"inlineSourceMap": true,
|
||||
"inlineSources": true,
|
||||
"module": "ESNext",
|
||||
"target": "ES6",
|
||||
"allowJs": true,
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"isolatedModules": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strictNullChecks": true,
|
||||
"lib": [
|
||||
"DOM",
|
||||
"ES5",
|
||||
"ES6",
|
||||
"ES7"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts"
|
||||
]
|
||||
}
|
||||
14
version-bump.mjs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { readFileSync, writeFileSync } from "fs";
|
||||
|
||||
const targetVersion = process.env.npm_package_version;
|
||||
|
||||
// read minAppVersion from manifest.json and bump version to target version
|
||||
let manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
|
||||
const { minAppVersion } = manifest;
|
||||
manifest.version = targetVersion;
|
||||
writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t"));
|
||||
|
||||
// update versions.json with target version and minAppVersion from manifest.json
|
||||
let versions = JSON.parse(readFileSync("versions.json", "utf8"));
|
||||
versions[targetVersion] = minAppVersion;
|
||||
writeFileSync("versions.json", JSON.stringify(versions, null, "\t"));
|
||||
3
versions.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"1.0.0": "0.15.0"
|
||||
}
|
||||