Your favourite feature? - Neuron

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Sridhar Ratnakumar

Survey: If there is one feature that should go in the next release of Neuron, what would you like that to be?

felko

idea: template zettels

felko

maybe using an already existing template format like <https://github.com/joaotavora/yasnippet>
(that is for emacs but it says that one can import templates from textmate, from which the syntax is inspired)

A template system for Emacs. Contribute to joaotavora/yasnippet development by creating an account on GitHub.
felko

not sure if this is really editor independent

felko

but otherwise just plain text is good enough, one would still be able to use an existing template language and write some glue code in their editor config to make it work nicely

felko

and you generally have much less templates than zettels, so migrating from one template language to another isn't a problem i think

felko

btw is there a way to remove embeds in zulip markdown?

TheMatten

What about dhall text?

TheMatten

I imagine there could be ./templates dir, from which I could instantiate template using neuron new <template>, plus there would be special names like footer.dhall that would get embedded into every note (which e.g. doesn't have footer: false attribute

TheMatten

btw is there a way to remove embeds in zulip markdown?

Not that I know of

Sridhar Ratnakumar

@felko Not familiar with yasnippet, but I imagine we don't need a very flexible template system. Just have ./templates/daily.md which looks like this:

---
date: __DATE__
tags:
  - journal
---

# __TITLE__

## Agenda today

-

## Achieved today

Today I achieved, ...
Sridhar Ratnakumar

Then neuron new --template=daily

Sridhar Ratnakumar

Templates are a nice feature. They can work on Cerveau too.

Sridhar Ratnakumar

We can even go one step ahead and support arbitrary key value pairs (neuron new --template=daily --data="key1=123"), with __KEY1__ somewhere in the template body.

Sridhar Ratnakumar

@TheMatten I don't understand. How does dhall gets used, say, in the above example?

Sridhar Ratnakumar

https://github.com/srid/neuron/issues/328

I imagine we don't need a very flexible template system. Initial proposal, to be refined: Templates can be added to a subdirectory, eg: ./templates/daily.md Template vars are simple strings wra...
EyebrowHairs

I forget what I was waiting for haha, maybe theme-support? I guess one thing could be to figure out the alternative links situation?

Sridhar Ratnakumar

The alternative links proposal here? https://github.com/srid/neuron/issues/312

Proposal I propose the following linking syntax (retaining the underlying link URI): This is current style, and will continue to be supported: <foo> Proposed default: [[foo]] Flexible link, t...
felko

Sridhar Ratnakumar said:

We can even go one step ahead and support arbitrary key value pairs (neuron new --template=daily --data="key1=123"), with __KEY1__ somewhere in the template body.

not sure if that would be really convenient from the editor perspective, it's more intuitive to fill in the values visually
but again nothing prevents me from configuring my editor to work with yasnippet or whatever template language i want, without needing it to be implemented in neuron

TheMatten

@Sridhar Ratnakumar

> cat answer.dhall
let a = 42 in "Answer is ${Natural/show a}"
> dhall text --file answer.dhall
Answer is 42
TheMatten

Now, instead of just reusing dhall text command, we could evaluate loaded expression using custom special variables in scope (like stuff in Markdown header and arguments to neuron new)

TheMatten

So we would have full power of (total) programming language for templating

Sridhar Ratnakumar

@TheMatten About the templates / function thing we talked about ... what's a good name for it? Just call it 'templates'? Or 'functions'? Or ...

Sridhar Ratnakumar

{{ <name> | <args ...> }}

Sridhar Ratnakumar

btw, here's another potential function to support: https://github.com/srid/neuron/issues/291#issuecomment-660075467

I think at would be good to have the possibility, to set a flag to automatically generate a table of contents at the beginning of the zettel based on the headings in the zettel. Alternative suggest...
TheMatten

I guess they could be called functions, or "template functions" :big_smile: