-
Notifications
You must be signed in to change notification settings - Fork 132
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
Customizing list icons: give a way to apply to current item only #2454
Customizing list icons: give a way to apply to current item only #2454
Conversation
…evinEyo1/markbind into 2384-markbind-template-project
…evinEyo1/markbind into 2384-markbind-template-project
This reverts commit 936dadc.
Co-authored-by: Chan Yu Cheng <[email protected]>
Co-authored-by: Chan Yu Cheng <[email protected]>
cb84513
to
69ec838
Compare
…o1/markbind into 2405-customize-list-icon
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.
Small nits
// If an item has a specified icon, that icon and its attributes will be saved and used | ||
// for it and for subsequent items at that level to prevent duplication of icons | ||
// attribute declarations. | ||
// If an item is once, its icons and/or attributes will only be used for that item. |
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.
// If an item is once, its icons and/or attributes will only be used for that item. | |
// If `once` is true, its icons and/or attributes will only be used for that item. |
if (!iconAttrValue.addIcons) { | ||
return; | ||
} | ||
// for items after first item, if first item is once, no previous icon |
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.
// for items after first item, if first item is once, no previous icon | |
// for subsequent items, if first item is once, there is no previous icon |
if (iconAttrValue.iconAttrs?.icon === undefined && iconAttrValue.iconAttrs?.text === undefined) { | ||
// There is no previous icon and no previous text | ||
const nodeIconAttrs = getIconAttributes(node, renderMdInline); | ||
// Save if current has icon or text, and it is not once |
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.
// Save if current has icon or text, and it is not once | |
// Save if current item has icon or text, and it is not once |
} | ||
} | ||
|
||
// update only if current has icon/text or previous has saved icon/text |
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.
// update only if current has icon/text or previous has saved icon/text | |
// update only if current item has icon/text or previous item has saved icon/text |
return; | ||
} | ||
// for items after first item, if first item is once, no previous icon | ||
// so future items that are not once will need to be saved |
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.
// so future items that are not once will need to be saved | |
// so future attributes that are not once will need to be saved |
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.
LGTM! Thanks for all the work @KevinEyo1
What is the purpose of this pull request?
Overview of changes:
Fixes #2405
Modified
CustomListIconProcessor.ts
to account for newonce
variable.Updated lists UG file to include new feature.
Update testLists to test new feature.
Anything you'd like to highlight/discuss:
Implemented such that it will not overwrite previous icon saved.
Currently once icon being in the first item, AND the next item having no icon, results in a visual issue.
To note that the final item with a new icon is working as intended.
Testing instructions:
Serve the folder at
markbind\packages\cli\test\functional\test_site
and navigate totestList.html
Proposed commit message: (wrap lines at 72 characters)
List icons: icons for specific item only
Unordered list icons are used in subsequent items to avoid
duplication.
MarkBind lacks a way to indicate icons for a specific item
only, limiting the flexibility of icons.
Creating a variable to indicate once icons allow for user
to have greater flexibility while preserving the current nature
of list icons.
Let's add a
once
variable that users can set when addingicons to items in the list, such that future items won't inherit
the icon, and it will also not overwrite previous icons saved.
This approach directly allows users to pick specific icons for
specific items, while keeping the inheritance nature of other icons
intact.
Checklist: ☑️
Reviewer checklist:
Indicate the SEMVER impact of the PR:
At the end of the review, please label the PR with the appropriate label:
r.Major
,r.Minor
,r.Patch
.Breaking change release note preparation (if applicable):