Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support for templates #44

Open
philiprein opened this issue Jul 5, 2021 · 4 comments
Open

Feature Request: Support for templates #44

philiprein opened this issue Jul 5, 2021 · 4 comments

Comments

@philiprein
Copy link

Hey, I just discovered your workflow, thank you so much for sharing this. It made my life working with Bear a lot easier.

There is only one thing I am missing, which is the ability to use templates when creating notes with bn or bcs. I found a workaround by modifying the X-callback-url‘s text-parameter, however this makes adding tags or the content of the clipboard impossible (I suppose appending the X-callback-url‘s text-parameter after {query} simply overrides the tags + contents of clipboard).

I would love if there was some way to create notes according to some custom template using your workflow (maybe using a markdown-file with {placeholders}?) Thanks again for sharing!

@philiprein philiprein changed the title Support for templates Feature Request: Support for templates Jul 5, 2021
@drgrib
Copy link
Owner

drgrib commented Jul 6, 2021

Hey @philiprein. Glad you are enjoying the workflow.

I actually use many templates for Bear myself but not through the workflow. While templates would be great in theory, I don't see a clean way they could be added to an Alfred workflow.

For example, one of my personal template programs checks the URL of my current tab and based on the domain will scrape content from the webpage and fill the template with it. This requires me to have in-depth understanding of the structure of the webpage and write goquery code to parse it and then format it. Such a complicated system would never make sense in an Alfred workflow.

So that's a big part of the question: how could someone cleanly define what even goes into the template? I'm not seeing it so I can't grant a feature request for which I don't see a clear design. But I'm open to suggestions.

@philiprein
Copy link
Author

Hey, thanks for the reply.

I agree, implementing templates the way you describe it would be too complicated for an Alfred workflow.

I was thinking of something more lightweight, e.g. being able to create an .md-file that contains the content/structure of your template and some pre-defined placeholders like {tags} or {content} for where tags and the content of the clipboard goes respectively. Then, when creating a new note via bn or bcs, there is an option to create a note according to that .md-file and parse the query-content to their respective places defined by the position of the placeholders in the template.

Maybe have a look at this workflow from Paul Ryley for The Archive. It is Python-based and in many ways provides the same functionality as your workflow for a different app. However, The Archive is simply an editor that works on top of a folder with .md-files, so maybe with Bear its a little more difficult.

@drgrib
Copy link
Owner

drgrib commented Jul 6, 2021

Hmm. The design you suggest sounds redundant with features already present in the workflow. Every note creation option in the workflow already adds autocompleted tags to a new note and you can create it with clipboard content by holding down command while using bn as shown here:

https://github.com/drgrib/alfred-bear#new-notes

Aside from the option of adding the date, I'm not seeing much extra in Paul Ryley's workflow. I'm not seeing much advantage in having a boiler plate of static text surrounding things like tags and clipboard content.

Perhaps it would be helpful if you gave the example of what you manually added to the workflow if it is different from current features.

@philiprein
Copy link
Author

I know about the option to add tags and the content of the clipboard, and this works like a charm.

I'm not seeing much advantage in having a boiler plate of static text surrounding things like tags and clipboard content.

This is basically what I meant. If you create a new note with bn and add an autocomplete tag/content from the clipboard (via CMD), they simply get pasted into the empty note and then have to be manually copied to the correct spot in the template.

My workaround was to modify the X-callback-url in the workflow's 'Create Note'-Action triggered by bn. I added the text-parameter with an url-encoded form of my template.

open "bear://x-callback-url/create?{query}&text=Tags%3A%20%0A%0A%0A%0A%0A---%0A%23%20Resources%0A*%20&new_window=yes&show_window=yes&edit=yes"

Using this obviously does not place tags behind the "Tags: "-part of the template, and pasting the clipboard does not work anymore.

However, I completely understand if you're hesitant to implement something you see no value in. I would suggest an implementation myself, but I haven't written code in Go at all, haha. I'll try to fiddle with it myself a bit and see if I can find a better workaround. Thank you for considering though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants