Templater icon indicating copy to clipboard operation
Templater copied to clipboard

Can't print multiples lines in dynamic commands

Open sineptic opened this issue 2 years ago • 5 comments

Plugin information (please complete the following information):

  • OS: Arch Linux
  • Templater version: 2.1.4
  • Obsidian version: 1.5.3
  • Templater settings: default

Describe the bug in all dynamic templates(<%+ ... %>) no new lines added. As I can see it replaced to white spaces.

Example dynamic: __ <- not printed, it's for you <%+ "hello \n \n something" %> __ hello something __

but static: __ <% "hello \n \n something" %> __ hello

something __

Expected behavior new line as new line

Screenshots edit_mode_before_repalce_templates preview_mode_before_replace_templates edit_mode_after_replace_templates

Additional context I need to use it for displaying my tasks in kanban(plugin). It's require tasks in markdown format, but templater don't add new line and I have this:

  • [ ] Sit placeat unde minus quo - [ ] molestias cupiditate repellat - [ ] Porro sunt quis error vel - [ ] Aut assumenda facere - [ ] Nihil non eligendi sed

sineptic avatar Feb 11 '24 08:02 sineptic

Dynamic commands is a feature that I won't be working on anymore (see #913).

If you really need it to be dynamic, please use Dataview instead.

Zachatoo avatar Feb 11 '24 17:02 Zachatoo

If you really need it to be dynamic, please use Dataview instead.

I can't do this, because dataview only render text, but templater insert text to note. It's required to use result after (render using kanban). 'Tasks' plugin don't work too(only render).

I don't find alternatives for using markdownTaskList(from dataview; returns plain text) in dynamic templater.

sineptic avatar Feb 11 '24 17:02 sineptic

I think it's easy to fix, but i don't know javascript(but know other laguages). If you say where dynamic commands render(in code), I try to fix it myself.

sineptic avatar Feb 11 '24 17:02 sineptic

Dynamic commands do not insert text into a note, but if you say they seem to for your needs then I believe it.

Just search for dynamic in the codebase and you'll find where it's at, there might be a few places. I'm not very familiar with that code, I ignore it. If you fix it and it doesn't cause issues with non-dynamic commands then I'll happily merge it!

Zachatoo avatar Feb 11 '24 18:02 Zachatoo

I think it's not that repository issue. Mb bug in https://github.com/SilentVoid13/rusty_engine (created for this project). Bug may contains in Parser::parse_whitespace in first argument "i", that's whitespace chars. I can't fix it because all in one file and names are one letter.

sineptic avatar Feb 18 '24 10:02 sineptic