kjdev / hoextdown

Hoextdown is an extension to Hoedown
MIT License
23 stars 15 forks source link

Adding support for radio buttons. #64

Closed andrewla closed 3 years ago

andrewla commented 3 years ago

Will use ( ) and (x) inside of a list, similar to checkboxes. The HTML renderer will emit a name tag unique for each list.

andrewla commented 3 years ago

I tried to match the formatting and style of existing code; please let me know if there's anything I should fix on that front.

There are a couple of things that I think are fair critiques:

  1. The "buffer_copy_with_replace" function is very ugly and special-purpose. Moving it to buffer.h/c seems wrong because the behavior is so special-case. But it might be worth having a hoedown_buffer_scan function that uses strnstr under the covers there to simplify the logic slightly.

  2. The string used for the name="radio-list-00000000" attribute is not configurable or escaped, so if there are multiple markdown chunks rendered within a single document there will be conflicts. It might be better to use a random string, but that makes it slightly harder to test.

  3. The code in rndr_listitem, between the task list and the radio button blocks, is very redundant, but it's not clear it would be an easy fix because they differ in functionality in small ways throughout the block.

If any of these issues (or others) are too problematic please let me know and I'll address.

kjdev commented 3 years ago

Great.

Thanks.