New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Custom list prefixes for AttributedStringVisitor #255
Conversation
Codecov Report
@@ Coverage Diff @@
## master #255 +/- ##
==========================================
+ Coverage 91.29% 91.31% +0.01%
==========================================
Files 60 60
Lines 1057 1059 +2
==========================================
+ Hits 965 967 +2
Misses 92 92
Continue to review full report at Codecov.
|
Hi @johnxnguyen! Not sure who should be reviewing this one :) I've checked the Travis CI build error, seems related to log file length, I cannot see the error. Do you confirm? |
Hey @dloic , thanks for the PR! I'll try to take a look at this tonight and get back to you soon. |
@johnxnguyen thanks a lot! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey 👋🏻 Sorry to keep you waiting, I had quite a busy week.
Generally it looks good to me! I just have a few suggestions to tidy it up a little. Let me know what you think.
@dloic hmm apparently Travis enforces a 4MB log length limit, it's the first time I've seen this issue though. Try to add the |
@johnxnguyen Thanks for the review. Branch updated taking into account all your feedback. Updated usage of the new feature with builder as closure: let visitor = AttributedStringVisitor(
styler: DownStyler(),
options: .default,
listPrefixGeneratorBuilder: { CustomListItemPrefixGenerator(list: $0) }
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍🏻 Thanks @dloic for your contribution!
Thanks to you @johnxnguyen for the review and approval! There is no rush, but I was wondering if you plan to do a new release for the new changes. |
I will draft a new release likely by the end of this week. |
Perfect, thanks a lot! |
FYI @dloic this has been release. Thanks again for the contribution! |
After investigation, I've tried to find the least intrusive way to add the feature of custom list prefixes for AttributedStringVisitor. I've decided to go for ListItemPrefixgenerator changes, as fitting the feature in the styler was not possible.
The PR is not changing the current behavior, but opening a bit the API so one can provide another implementation. See below for an example:
Definition of a custom ListPrefixGenerator:
Usage:
Render: