Insert timestamp

Is it possible to insert a timestamp (ideally with keyboard shortcut) when writing in markdown?

1 Like

Hi Johannes,

Thank you for the question.
Yes, you can do that by adding custom script:

const moment = require('electron').remote.require('moment')

inkdrop.commands.add(document.body, {
  'custom:insert-date': () => {
    moment.locale('en');
    const cm = inkdrop.getActiveEditor().cm;
    cm.replaceSelection(moment().format('LLLL') + "\n");
  }
})

inkdrop.menu.add([
  {
    "label": "Format",
    "submenu": [
      { "label": "Insert Date", "command": "custom:insert-date" }
    ]
  }
])

And bind a command custom:insert-date with preferred keystroke by setting keybindings like so:

'body':
  'shift-ctrl-k': 'custom:insert-date'

Hi Takuya,

thanks a lot for your prompt reply. It works perfectly :slight_smile:

All the best,
Johannes

1 Like