-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
Is your feature request related to a problem? Please describe.
Methods of MdUtils have ambiguous and inconsistant return values, here are some examples:
new_table,new_reference_image,writereturn lines in md format;new_paragraph,new_linereturn whole file;new_listandnew_checkbox_listreturns nothing;new_inline_*do not write anything into the file, but just return strings.
Describe the solution you'd like
Apply no. 1 for all except new_inline_*.
Describe alternatives you've considered
I think no. 2 is by mistake, it contradicts the method's docstring. For no. 4, I don't have a good solution on it, maybe just write it explicitly in the documentation. It is a pain to users, I have to read the source code to debug my code...
Additional context
More suggestions:
- Update
MdUtils.new_header's docstring,:return:is not stated; - readthedocs is outdated, feed README to sphinx will do;
new_inline_linkcould be a static method, just likenew_inline_image(one isMdUtils.new_inline_image(...)and another ismdfile.new_inline_link, it's bizzare);- Escape characters e.g.
],), simple string concat won't work every time, mentioned in Escape "|" in Table.create_table #63; - For
place_text_using_marker, do you meanreplace_text_using_marker? I don't know about the marker, my editor does not support that, but would it be overkilling to just usestr.replace? - Annoying
wrap_width, I suggest making its default value to0. It is not commonly used, I have to set it whenever I want to callnew_lineetc. I was ??? when I saw those \n appeared out of thin air, again, debugging it spent me some time; rowsparameter ofnew_tableis not that necessary, append blanks at the end oftextlist will do.
Enhancements:
- For
new_table, would it be better if we supports dict typetext? Maybe we should discuss this. - It would be better if these params are in lists:
text_alignofnew_table: Customize each column;marked_withofnew_list: The nested list(s) must not follow the marker of the root list, what I mean is, an ordered list can have an unordered list in it, just like what I am using right now.checkedofnew_checked_list: In most of the time, we don't check/uncheck the whole list at a time, a list of bools would be way better, or else I have to write the list manually in md (although I am using a lib that is doing markdown lol).
Thanks.
Metadata
Metadata
Assignees
Labels
No labels