npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

joplin-plugin-slash-commands

v1.4.0

Published

This plugin is a collection of utility commands that can be executed by typing corresponding keywords, which start with a slash. Current version supports three type of commands but more may be added in the future.

Downloads

16

Readme

Slash Commands: Datetime & More

This plugin is a collection of utility commands that can be executed by typing corresponding keywords, which start with a slash. Current version supports three type of commands but more may be added in the future.

screencap

Usage

String Command

  • String commands simply replace a keyword with one of the predefined strings.
  • Built-in: /greet, /task, /todotxt
  • Definition: [ "string" , "<keyword>", ["<string1>", "<string2>" ] ]

Datetime Command

  • Datetime commands print out the current time using a predefined datestring format. Optionally you can offset the time by day, hour, and minutes or query a specific weekday.
  • Built-in: /now, /date, /time, /todoa, /todob, /todoc, /todod, /todoe
  • Offset examples: adding /now+d-H:M, subtracting /now-d-H:M
  • Offset formats: d-H:M, d-H, H:M, d
  • Weekday examples: next monday /date@mon (exclude today), last monday (or today if today is Monday) /date@mon-1
  • Weekday keywords: @1 or @sun for Sunday, @2 or @mon for Monday, @3 or @tue for Tuesday, @4 or @wed for Wednesday, @5 or @thu for Thursday, @6 or @fri for Friday, @7 or @sat for Saturday
  • Definition: [ "datetime" , "<keyword>", ["<format1>", "<format2>" ] ]
  • Definition with international day and month names: [ "datetime" , "<keyword>", ["<format1>", "<format2>" ], {"dayNames": ["<Sun>", "<Mon>", "<Tue>", "<Wed>", "<Thu>", "<Fri>", "<Sat>", "<Sunday>", "<Monday>", "<Tuesday>", "<Wednesday>", "<Thursday>", "<Friday>", "<Saturday>"], "monthNames": ["<Jan>", "<Feb>", "<Mar>", "<Apr>", "<May>", "<Jun>", "<Jul>", "<Aug>", "<Sep>", "<Oct>", "<Nov>", "<Dec>", "<January>", "<February>", "<March>", "<April>", "<May>", "<June>", "<July>", "<August>", "<September>", "<October>", "<November>", "<December>"] } ]
  • This command uses Javascript Date Format to parse datestring. You can check the original library on how to form your own format.

Calendar Command

  • Calendar commands print out an ascii calendar of the current month or a specified month.
  • Built-in: /calendar
  • Examples: current month /calendar, specified month of the current year /calendar-3, specified month /calendar-1-2022
  • Definition: ["calendar", "<keyword>", ["<locale1>", "<locale2>"] ]
  • Locales are string such as en-US or ja-JP. Locale can also be null which force the plugin to use system locale.
      December 2021       
Su  Mo  Tu  We  Th  Fr  Sa
             1   2   3   4
 5   6   7   8   9  10  11
12  13  14  15  16  17  18
19  20  21  22  23  24  25
26  27  28  29  30  31

Customization

Even though there is only several types of commands, you can create many commands by set the command definitions in the plugin setting by yourself. The commands definitions is an array of array but due to some awkwardness with Javascript and JSON string parse you need to carefully escape it.

[
  ["datetime", "now", [ "dd/mm/yyyy HH:MM", "yyyy-mm-dd\"T\"HH:MM:ss" ] ],
  ["datetime", "date", [ "dd/mm/yyyy", "yyyy-mm-dd" ] ],
  ["datetime", "time", [ "HH:MM", "HH:MM:ss" ] ],
  ["datetime", "jdate", [ "yyyy年mm月dd日(ddd)"], { "dayNames": ["日", "月", "火", "水", "木", "金", "土", "日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"], "monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月", "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]}],
  ["string", "greet", [ "Hello", "你好", "Bonjour", "Hallo", "नमस्ते", "こんにちは", "안녕하세요", "Hola", "Xin chào" ] ],
  ["string", "task", [ "- [ ] " ] ],
  ["string", "todotxt", [ "```todotxt sort:default\n\n```" ] ],
  ["datetime", "todoa", [ "\"(A)\" yyyy-mm-dd " ] ],
  ["datetime", "todob", [ "\"(B)\" yyyy-mm-dd " ] ],
  ["datetime", "todoc", [ "\"(C)\" yyyy-mm-dd " ] ],
  ["datetime", "todod", [ "\"(D)\" yyyy-mm-dd " ] ],
  ["datetime", "todoe", [ "\"(E)\" yyyy-mm-dd " ] ],
  ["calendar", "calendar", [null,"en-US","ja-JP"] ]
]

There is another awkwardness with Joplin Plugin Setting that only accept a single line value so you need to minify it like this.

[ ["datetime", "now", [ "dd/mm/yyyy HH:MM", "yyyy-mm-dd\"T\"HH:MM:ss" ] ], ["datetime", "date", [ "dd/mm/yyyy", "yyyy-mm-dd" ] ], ["datetime", "time", [ "HH:MM", "HH:MM:ss" ] ], ["datetime", "jdate", [ "yyyy年mm月dd日(ddd)"], { "dayNames": ["日", "月", "火", "水", "木", "金", "土", "日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"], "monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月", "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]}], ["string", "greet", [ "Hello", "你好", "Bonjour", "Hallo", "नमस्ते", "こんにちは", "안녕하세요", "Hola", "Xin chào" ] ], ["string", "task", [ "- [ ] " ] ], ["string", "todotxt", [ "```todotxt sort:default\n\n```" ] ], ["datetime", "todoa", [ "\"(A)\" yyyy-mm-dd " ] ], ["datetime", "todob", [ "\"(B)\" yyyy-mm-dd " ] ], ["datetime", "todoc", [ "\"(C)\" yyyy-mm-dd " ] ], ["datetime", "todod", [ "\"(D)\" yyyy-mm-dd " ] ], ["datetime", "todoe", [ "\"(E)\" yyyy-mm-dd " ] ], ["calendar", "calendar", [null,"en-US","ja-JP"]] ]

I will try to improve the configuration process when I find a better solution. If you messed with the setting and the plugin is no longer work, try paste the above definitions to your setting or just leave the setting BLANK the plugin will automatically revert it back to the DEFAULT definition.

Acknowledgements

License

MIT