obsidian-tasks-group / obsidian-tasks

Task management for the Obsidian knowledge base.
https://publish.obsidian.md/tasks/
MIT License
2.41k stars 226 forks source link

Add option to display raw characters/markdown in queries #2947

Closed EarthToMooney closed 2 months ago

EarthToMooney commented 2 months ago

⚠️ Please check that this feature request hasn't been suggested before.

πŸ”– Feature description

Allow task query results to show the characters in a task without any formatting (e.g., ==x== won't appear highlighted, and the equal signs are still visible).

βœ”οΈ Solution

Add an option to task queries to display the tasks with markdown formatting or without it.

❓ Alternatives

No response

πŸ“ Additional Context

Tried doing this to see if any tasks were being neglected by my Tasks queries due to some unforeseen formatting mistake (e.g., putting a non-bulleted, non-empty line below the task). Compared the results of Regex queries with a Tasks query on all files in my vault, but found that many of the lines couldn't be compared directly when copy-pasting from the Tasks query since they contained equations/links/etc. that didn't retain their Markdown elements (e.g., highlighting characters) when being pasted.

claremacrae commented 2 months ago

Hi, I’m not at all clear what this is trying to achieve, and what the options are to address it.

There are no exclamation points in your example. And Obsidian source mode shows the raw task lines already.

Please supply as text (not screenshots):

  1. Several example problem task lines
  2. An example Tasks query
  3. Specific information about what changes you want in Tasks behaviour, for the example you gave.
EarthToMooney commented 2 months ago

Sorry for the confusion. I meant to say "equal sign", not "exclamation mark".

As for source mode, that doesn't do what I'm aiming for. While it does show the raw task lines when viewing them in their original locations, it doesn't do so in a query block; instead, the query code itself appears.

Here's what I want: an option within Tasks queries to display the task text how it would appear within Source View. This would help preserve formatting when copying and pasting tasks from queries. This option could be a line added to a task query (e.g., "use source view").

Here are examples of how you'd use it:

Assume file "test.md" contains the following tasks (shown below in code block format for clarity):

- [ ] t\a\s\k 1
- [ ] **another** t\a\s\k
- [ ] __another__ t\a\s\k

Tasks Query A (without added option):

path includes test.md

Currently, copying and pasting its results would return the items in the code block below:

task 1
another task
another task

Tasks Query B (with added option):

path includes test.md
use source view

copying and pasting its results should return the items in the code block below:

- [ ] t\a\s\k 1
- [ ] **another** t\a\s\k
- [ ] __another__ t\a\s\k

Or, if including the task statuses is too difficult, it should return the items in the code block below:

t\a\s\k 1
**another** t\a\s\k
__another__ t\a\s\k
claremacrae commented 2 months ago

Is this an XY Problem?

Is the request really to have the ability to be able to copy text from Tasks search results, and be able to paste them elsewhere with any formatting in the task descriptions retained?

claremacrae commented 2 months ago

Also, why might a task be formatted \t\a\s\k? Is there something else underpinning this request?

claremacrae commented 2 months ago

Tried doing this to see if any tasks were being neglected by my Tasks queries due to some unforeseen formatting mistake

If on the other hand the goal of this is to make description searches more forgiving of the presence of formatting, it's not clear to me how this request solves that problem - as the would already have to be correct enough to find the tasks in order to show them in Tasks query results.

So again, I feel I must be missing something fundamental about the request...

EarthToMooney commented 2 months ago

Is this an XY Problem?

Is the request really to have the ability to be able to copy text from Tasks search results, and be able to paste them elsewhere with any formatting in the task descriptions retained?

That's my request.

EarthToMooney commented 2 months ago

Also, why might a task be formatted \t\a\s\k? Is there something else underpinning this request?

This was just for demonstration purposes, to show how the results pasted from a Tasks query would differ from the actual content of those tasks. I picked backslashes since they would normally be invisible, making this easy to demonstrate with text alone.

claremacrae commented 2 months ago

Is this an XY Problem? Is the request really to have the ability to be able to copy text from Tasks search results, and be able to paste them elsewhere with any formatting in the task descriptions retained?

That's my request.

OK, and why then are you copying the search results, please? In to what software? For what reason?

EarthToMooney commented 2 months ago

Is this an XY Problem?

Is the request really to have the ability to be able to copy text from Tasks search results, and be able to paste them elsewhere with any formatting in the task descriptions retained?

That's my request.

OK, and why then are you copying the search results, please? In to what software? For what reason?

I was copying them into VScode to compare which tasks appeared when querying my whole vault vs. searching for all checkboxes via grep. This was to see if my to-do list - a Tasks query - was neglecting anything I intended to be a task. I would see which lines appeared in the grep results but not in the Tasks query, and fix whatever caused them to be excluded from the query (e.g., too many indents). However, the grep versions had all the formatting characters (brackets for links, equal signs for highlights, etc.) while the Tasks query versions didn't, leading to a lot of lines that appeared to be excluded from the query but actually weren't.

While writing this, I realized I can just copy-paste from Tasks queries into Edge then back into Obsidian to preserve the markdown formatting characters, fixing my problem without adding a new feature. I guess it wouldn't hurt to have this feature, but it's no longer something I need.

claremacrae commented 2 months ago

Thanks, I understand a bit better now.

I don’t think this passes the β€œβ€¦. my requested feature will be generally applicable to other users, not just me: it is not uniquely tied to my personal workflow.” test.