9.10b5 General Purpose Block Feedback #1961
Replies: 18 comments 91 replies
-
This looks great! 👍 I see you have not yet updated the example code which demonstrates how to define config options for the Admonitions and Details extensions. Also, the "Per Block Options" table for each block type still needs to be updated for the The changes to the extension API look great. I think the change to make each block its own standalone extension was the right move. And you implemented the API for that just as I expected. I may have some time over the next few days to play with an idea I have for a block type. I'll report back if/when I get a chance to do so. |
Beta Was this translation helpful? Give feedback.
-
You can find my first attempt at building an extension with this in this Gist. It sort-of works in that it only recognizes some of my test blocks but not others and I don't know why. I eventually gave up. I was making notes as I worked on it and all of those notes are preserved in a separate file in the gist. Some issues I noted I later resolved as I note later on. However, I left the entire set of notes intact to properly convey my entire experience. There seems to be a lot of holes and inconsistencies in the documentation. Eventually I found myself using the source code as a reference and mostly ignoring the docs. I started with the included block types as examples, but eventually went to the underlying parent My general observations of the project (ignoring the documentation issues) is that it is great when it works. It has never been so easy to create support for a new block type in Markdown. However, it appears that something is causing the parser to be way to strict and I can't seem to get consistent results. Work those kinks out and this will be a great tool and asset to the community. |
Beta Was this translation helpful? Give feedback.
-
Functional changes for the next release. When processing |
Beta Was this translation helpful? Give feedback.
-
I released Beta 2 |
Beta Was this translation helpful? Give feedback.
-
Just ran into an interesting hiccup with my experimental Bootstrap Alert block. I added the In my case, I just added a check for a title in I would have actually preferred for the I suppose one could use |
Beta Was this translation helpful? Give feedback.
-
Released a Beta 3 |
Beta Was this translation helpful? Give feedback.
-
I am not sure how to proceed with a new block I am playing with. I am looking to create a block for Bootstrap's Carousel. At first I created a parent block with the idea that child blocks would be the various slides of the carousel. After all, most options are specific to the carousel not the individual slides. In fact, I realized that each slide is nothing more than an image with a few specific classes assigned to it. Therefore, I initially planned on defining the slides as nothing more than Markdown images (
Obviously I can make a choice myself. I'm just curious what you would do here? Regardless, there are a few potential deficiencies in the API for each of the above approaches as outlined below:
|
Beta Was this translation helpful? Give feedback.
-
Beta 4 just released. Will probably be up on PyPi in a few minutes. |
Beta Was this translation helpful? Give feedback.
-
I just encountered a situation where I needed to have a validator accept either a boolean or a known string (for example, one of
Essentially this would combine the functionality of the existing Obviously, I can (and have) create my own validator to do this. But I think this might be common enough to add to the API proper. |
Beta Was this translation helpful? Give feedback.
-
I was playing with the options on one of my blocks and checking the output. I was commenting out some of the options (which is valid YAML) to confirm the default when an the option is not defined for a block. However, I inadvertently commented out all options and that caused it to not be recognized as a block. Presumably, by commenting out the entire YAML section it was considered to not be valid YAML. I'm wondering if that should be considered a bug as technically, it is still valid YAML, albeit, not particularly useful. In the end, not a big deal either way, but I thought I would mention it. I checked and YAML returns >>> import yaml
>>> yaml.safe_load('foo: bar')
{'foo': 'bar'}
>>> yaml.safe_load('#foo: bar')
>>> Looking at your code... pymdown-extensions/pymdownx/blocks/__init__.py Lines 60 to 67 in 5a40bc0 It would seem that returning This fails (it is not recognized as a valid block):
However, this works fine (as does any other random line being uncommented):
Completely removing the YAML also works fine (which I would have expected to match the behavior of commenting all lines out)
BTW, the fact that I am now reporting minor details like this suggests to me that you are getting very close to a release. |
Beta Was this translation helpful? Give feedback.
-
This one is a long-shot and I'm not even sure it is a good idea. I have a block type which would likely contain only an argument in most cases. Like this:
That works fine. However, As there is no need for any additional lines, I am wondering if it would make sense to allow the entire block to be defined on one line. Like this:
I think I find that easier to read, especially if multiple of them occur one right after the other in a document. Obviously, if anything else needed to be defined (options and/or body content) then the existing syntax would still be required. This would only apply to a block which only has an argument defined. Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
I asked this question previously but it was buried in a bigger issue, so I'll ask it separately here. Suppose I have a block type that is only valid as a direct child of a parent block type. How can I validate that from the child block? Of course, the |
Beta Was this translation helpful? Give feedback.
-
I have a block where body content is optional. However, if it is present, I need to wrap it in a wrapping element which is a child of the block's root element. However, that wrapper should not exist if no body content exists. Therefore, I want to conditionally add the wrapper in I suppose I could check the element in For clarity, here is an example:
The above becomes:
However, for this input:
The output should be:
Notice that the |
Beta Was this translation helpful? Give feedback.
-
@facelessuser Hey, I am trying to use the beta version of HTML block to build bootstrapping card view but I have problems with nested divs /// html | div.card.text-white.bg-secondary.mb-3[style="max-width: 50rem;"]
/// html | div.card-header
///
/// html | div.card-title
///
/// This setup in md file produce this: This is not what I expected, there should be one big div and two children div. Am I missing something? |
Beta Was this translation helpful? Give feedback.
-
I'm not sure I understand or agree with your reasoning on how raw is handled. Why does it need to be indented? Except for the fact that you dedent it, I don't see any difference in behavior in my limited testing. Or is the indentation to avoid it being stashed by the raw HTML preprocessor? Or is the issue to do with how you are collecting the body content? Apparently you don't collect it all as a single block. While I understand why that might be (based on how the underlying BlockParser works), I haven't tried to work out how you are actually collecting the parts. So, while I understand that you are likely trying to avoid some weird edge cases, I find the API unintuitive in regards to For example, I was surprised when I used Of course, I realize that my expectations here are based on the fact that I have a very clear understanding of how the Markdown parser works. However, most users do not and the stash is invisible to them. Maybe having the API keep the stash invisible makes more sense. But then those devs who want to pass through some raw HTML will need to manually pull the text from To sum up, because you are calling the mode I suppose maybe one could end up with multiple placeholders in the stash from the preprocessor. To avoid that, your indedent/dedent thing could be useful. However, we can't depend on users to always indent their raw content so I don't see its value. |
Beta Was this translation helpful? Give feedback.
-
As I prepare for the final release, there will be some small changes:
|
Beta Was this translation helpful? Give feedback.
-
Closing this discussing as the official release will be dropped soon. |
Beta Was this translation helpful? Give feedback.
-
#1973 will be the formal thread for any feedback moving forward. |
Beta Was this translation helpful? Give feedback.
-
Beta 5
Documentation: https://facelessuser.github.io/pymdown-extensions/extensions/blocks/
The purpose of this discussion is to allow feedback for the latest iteration of General Purpose Blocks 9.10.b1. It should be noted that any and all feedback is welcome.
Changes in Beta 1:
/// html | div.class#id[name=value]
.attributes
toattrs
.colon_syntax
option and cement that we are using///
format moving forward.Feedback Needed
General feedback is desired. Are there any bugs we missed, or some functionality we overlooked? The next release plans to make this public as a set of experimental extensions. Catching any big issues now is the goal.
Beta Was this translation helpful? Give feedback.
All reactions