platformer/typst-algorithms

Allow line comment

likern opened this issue · 4 comments

likern commented

It would be nice to have line comments feature.
And ignore strong option of keywords in these comments

Long comments are better to put on a separate line.

Screenshot from 2023-08-14 17-09-31

In my opinion, this seems like the sort of thing that the user can define for themselves as a helper function, though I can be convinced otherwise. Perhaps something like #comment(inline: true)[...] would make sense?

Though at the very least, I have been trying to come up with some sort of escape hatch so you can tell algo to not emphasize a particular word. For now, you can pass a more minimal list of keywords to the keywords parameter, and then use #strong[...] to emphasize words as needed on top of that, but I recognize this is somewhat annoying.

likern commented

In my opinion, this seems like the sort of thing that the user can define for themselves as a helper function, though I can be convinced otherwise. Perhaps something like #comment(inline: true)[...] would make sense?

I think yes, would make sense

In general that's what I did - created separate function. But

  1. Words with strong style in these self-made comments
  2. I can't recreate default styles in comments (don't know their values)
  3. Need override default comment style to match 1-1 with my custom comments

In general I would prefer a more general solution for these cases. In that case I wouldn't need inline comments if could do it myself

I can't recreate default styles in comments (don't know their values)

In retrospect, this is a pretty big oversight on my part. I plan on making the following changes:

  1. Add an inline option to comment to display a comment in place. This will respect comment-styles and be insensitive to strong-keywords.
  2. Create a function to escape a word from being emphasized by strong-keywords. I'll have to do this anyway to implement 1, but I think it's useful enough to expose it as a user-facing function as well. I'll probably call it noemph or something like that.
  3. Update the README to list the default values of every function.

Above three changes have been implemented as of 5a4ee88.