-
Notifications
You must be signed in to change notification settings - Fork 862
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
attr_list on ul/ol elements? #227
Comments
If that results in the class being assigned to the The fact is, the markdown syntax has no concept of a So to answer your question: no, it is not possible to assign attributes to the list itself. Granted, being able to do so would certainly make for a better hook for CSS and Javascript. I just don't see a clear way to do so that will not veer too far from Markdown's philosophy. The basic syntax was inspired by Maruku's Attribute List feature. How does that implementation handle lists? It isn't documented and I don't recall offhand, but that might shed some light on things. |
Intuitively, I would expect the attribute to reside on the
However, this could conflict with inline syntax, and it does get ambiguous with nested Another idea is to leave the
Notice the extra blank line after the last
I agree this is a tricky problem. However, the inability to style |
Exactly. The syntax rules state that block level attributes must be on a new line. This breaks that model and would be non-obvious and confusing to newcomers.
Actually it does. The syntax states that block level attributes must not have a blank line before them. See Maruku's docs.
And if you wanted to only set attributes on the
I agree. But then again, it may help to remember what it says in the Markdown syntax rules. Specifically, the first few paragraphs under Inline HTML. Like this: "For any markup that is not covered by Markdown’s syntax, you simply use HTML itself." |
This functionality for me is really important so I played around with attribute list extension a bit and quickly added it if anyone is interested. For syntax I chose the use of a caret in place of the colon to signify that the parent is being targeted. I also made the colon required for normal usage. I did a fair bit of testing, but I'm sure I didn't cover everything. If anyone runs into any issues with it, please let me know. + foo
+ bar
{: .baz }
{^ .qux } <ul class="qux">
<li>foo</li>
<li class="baz">bar</li>
</ul> |
@Anomareh hey, tell me please, how add this extantion in my project? How use this? |
Duplicate count here sure speaks for itself. Kramdown, the full-featured alternative GitHub Pages use and Maruku's obsoletion notice points to, given our example:
adds https://johnmacfarlane.net/babelmark2/?text=*+Item+1%0A*+Item+2%0A%7B%3A+.some_list+%7D I don't understand the .1% ambiguous case you two agreed on. Who in their right mind enables |
Just to add a bit of extra information around the problems with attr_lists on list elements, you also can't apply the attributes to the Kramdown allows the following syntax:
Using Python Markdown, if you place the The leading attributes before the list itself I can see is more awkward, and doesn't obviously follow the style of |
Not at all. The documentation clearly states:
Therefore, an Admittedly, our syntax does not match Kramdown. In fact, we didn't base our syntax on Kramdown, but on the first iteration of Maruku's syntax. Of course, if anyone would like to have support for Kramdown's syntax, then you are free to create your own third-party extension. However, I have no interest in making any changes to behavior of the existing extension. |
I'm not sure if this is a bug, or just a lack of documentation, but it seems impossible to get att_list to apply to
<ul>
or<ol>
elements. It can only be applied to individual<li>
elements.Results in:
I would have expected:
Is there a way to get an attribute to apply to the whole list?
The text was updated successfully, but these errors were encountered: