thombruce / toodles

✅ A super simple todo app
https://toodles.thombruce.com/
GNU General Public License v3.0
0 stars 0 forks source link

[Feature]: Consider Official Markdown Support #114

Open thombruce opened 1 month ago

thombruce commented 1 month ago

Feature request

I recently added loose support for Markdown to my own site here: b023b6e2c45affe077c876d15422402428bb131c

The CSS is a mess, but that wouldn't necessarily be an issue for the VSCode package.

Consider adjusting the VSCode package so that it explicitly supports inline Markdown:

Most of this is already implicitly fine. The main issue is the colon in a link: [link](https://example.com). http://... conflicts with out current regex for tag:example.

Consider not matching tags if the word characters preceding : are themselves preceded by ]( and/or if the colon is followed by // (though check the official specs for URL form before committing to this).

Here's an illustration of valid URI formats:

As shown, the authority part (which is delimited by //) can be skipped. Therefore, the most basic acceptable URL is something like:

example:path

This is identical to our most basic tag.

We cannot even check ahead for the closing ) appearing before any space character because this too is a valid markdown link:

[An Example Website](https://example.com "For when you just need a dummy link")

And strictly something like this should also be valid:

[An Example Link](example:path "That looks just like a tag to me!")

One very simple option is to just say... your tags should be preceded by a space character... but this would mean the user couldn't ever put tags in parentheses, perhaps for grouping them...

Not matching a tag if it's preceded by ]( is really looking like the best option. We know that that's probably a markdown link - it's a good indicator. It isn't guaranteed, but we should be safe except for extreme edge cases.

Alternatively, we could not treat the \w+:\S+ pattern as a tag if it matched... https?:// - this would essentially be special treatment for "standard" links, and would ignore link kinds like ftp, mailto, file, etc. That said, mailto stands out as a very reasonable kind of link to permit in a todo list. You can imagine a todo like:

! (A) Send job spec to [Alan](mailto:alan@example.com)

So yes... give it some more thought, but I think I'd be quite happy moving forwards with just the approach of ignoring tags that are preceded by ]( (strong indication of being a markdown link) or indeed by < which is again indicative of a markdown link (e.g. <mailto:alan@example.com>).


Also keep in mind that there are plans to expand the capabilities of tags in the future with formats similar to:

The idea being that these are dynamic tags which Toodles (and other third party applications) could add interactive timers/tally systems to, and the like.

Code of Conduct

thombruce commented 1 month ago

Toodles VSCode should also feature decorations for inline Markdown styles:

Ideally we might import some other third-party decorator logic to handle this, rather than handling it all with our own regexes... which could get messy.

thombruce commented 1 month ago

This is done for packages/app.

Not yet implemented for packages/vscode.