Skip to content
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

Adds optional list attributes #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

nicofranzp
Copy link

Would close #58

Copy link
Owner

@cmaas cmaas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to create a pull request. A bunch of things:

  1. No tests.
  2. If options.listAttrs is empty, the HTML output would be <ul > for every element (unnecessary whitespace).
  3. tocItemToHtml is called recursively. Does it make sense that the same list of attributes is applied to sublists as well? I have no opinion on this, but we should be clear about it.
  4. Would a general purpose transformListElement() function possibly solve the job in a better way?

I also had in mind to create a function that lets users rewrite the container class. If someone wants to use <nav> instead of <div> or something like <details><summary>..., the plugin would be a lot more flexible. But then it makes sense to have all customization in a similar format (custom formatting functions?).

What do you think?

@nicofranzp
Copy link
Author

Hi, thanks for the reply!

  1. I don't know how to provide a test 😬. Sorry! (literally my first PR)
  2. I see the unnecessary whitespace...
  3. I also understand why it might not be desirable to pass the same attributes to sublists and
  4. yes, a transformListElemet() would have solved all my problems if it allows me to add specific classes to the first ul.

As my Wishlist and experience is no too big, I would add a couple of if statements to get rid of the white space and avoid adding the attributes into sublists... I know is not the most general way of doing things, but it is within my reach. I don't know if this would cause trouble ahed either.

Maybe a discussion of a what to expect from and how to implement a custom formatting functions might inspire people to jump in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add attributes to the TOC list
2 participants