platformer / typst-algorithms

MIT License
141 stars 4 forks source link

Allow line comment #6

Closed likern closed 1 year ago

likern commented 1 year ago

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

platformer commented 1 year ago

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 1 year ago

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

platformer commented 1 year ago

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.
platformer commented 1 year ago

Above three changes have been implemented as of 5a4ee88affc979b5c8fddd83661f550ee1208443.