davraamides / todotxt-mode

MIT License
59 stars 12 forks source link

How to apply this extension for specific file #34

Closed hukacode closed 3 years ago

hukacode commented 3 years ago

Hello,

My use case is the decoration apply for all my markdown files, then it highlights text like this (text with colon will be highlighted): image

Then I setting like this to apply the decoration for only todo.md file, but it does not work. image

I read the README.md but I can't figure out how to do it. Could you please take a look on it?

Best regards, Huka

davraamides commented 3 years ago

Hi Huka,

The intent of this extension is to perform formatting per the todo.txt spec for plain text files. I added a special feature to perform selective decorating of regions of a Markdown file because I often create one Markdown file per project with notes, ideas, references and other information in it but I also wanted to maintain a todo list for the project in Markdown. To support this, I include two regular expression patterns that define the beginning and end of a "todo list" region within a Markdown file. The default patterns are:

todotxtmode.markdownDecorationBeginPattern    ^#+\\s+Tasks\\s*$
todotxtmode.markdownDecorationEndPattern      ^$

That is, a file starting with a header with "Tasks" in the header text and ending with a blank line. So something like this:

## Tasks
(A) call mom
(B) take out garbage due:2021-07-15
clean out garage

More text here that is not part of the highlighted region...

You've setup all your todo files as Markdown files so my decorations are going to be conflicting with VS Code's Markdown decorations, I would presume, and they won't be limited to the region defined by those two regular expressions (since you are saying that files like todo.md are to be treated as normal todo files).

Does that make sense?

hukacode commented 3 years ago

OMG, I'm so sorry for wasting your time. I was so dumped. All I need is just rename todo.md to todo.txt and keep the default settings. Then it solved my problem. There is no conflict decoration anymore. I don't know why I made my life difficult. 😅

Thank you.