-
Notifications
You must be signed in to change notification settings - Fork 53
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
remark-custom-blocks nested sections and custom properties #256
Comments
For your first question, I manage to get a proper result with : [[q]]
| # title
| [[q]]
| | bla the html is <div class="custom-block custom-block-question">
<div class="custom-block-body">
<h3 id="title">title<a aria-hidden="true" href="#title"><span class="icon icon-link"></span></a></h3>
<div class="custom-block custom-block-question">
<div class="custom-block-body"><p>bla</p></div>
</div>
</div>
</div> Here I used "q", to perform that, we configured the plugin like this : {
q: {
classes: 'custom-block-question',
title: 'optional',
},
} |
Thanks a lot @artragis, good point. Would you also be able to contribute to my second question? |
In fact I don't know. I think it is possible to develop it. @vhf do you agree with that? We could specify it as : when we configure the plugin like :
with this configuration, we can parse
when styles are provided, it just add a css Are you ok with that @vhf ? Or do you think it's not a good thing for remark-custom-blocks? |
I think adding this feature is interesting. I'm not sure what would be the best way of configuring this feature though, for instance I think I'd prefer a whitelist approach where we first parse all key/values over the suggested regexp capture. IIRC @arobase-che developed something similar to this. Could you please show us what you did? |
Hi ! 😄 Ty @vhf, yes i developed a plugin remark-attr to add custom attributes to markdown elements. It uses md-attr-parser to parse the common syntax for attributes : The goal of remark-attr is to add attributes syntax after the usual syntax. So the syntax will be : [[blockName]]
| foo
{attribute1="value"} That may suits your needs. But i never use it on plugins. To use a syntax like : [[blockName width=50px bgColor=25]]
| block with custome style but without title Since it's a custom plugin, you have to extract the string I hope it helped. In any case, it needs little development, but still development. |
Thanks @arobase-che , we'll need to think about it a bit more. @aiwatko Could you please expand on your needs (2nd point: properties)? How would you want We don't have a use case for this at the moment and since we use this plugin in a setup where we don't trust the user, we need to make sure it stays secure -- users should not be able to add arbitrary properties/values (think of XSS/CSRF, things like |
I'm trying to attempt these two things with no success fo far:
Nested sections:
i.e.
[[section]]
| # title
| [[nestedSection]]
Properties passed to the section:
i.e.
[[section bgColor="blue" width="1024"]]
which would result in:
This approach would allow more flexibility with section, i.e. there would be just one section instead of creating:
Is any of those possible? Thanks in advance!
The text was updated successfully, but these errors were encountered: