Support width and height image attributes #88
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are a few things about this extension that I'm not 100% certain I did right. It appears that in an extension, a class that inherits from
markdown.inlinepatterns.ImageReferencePattern
,self.markdown
points at the extension, not the markdown instance, so things likeself.markdown.references
isn't available. I had to create adict
for references within the extension itself. That's only odd because in a class that inherits frommarkdown.preprocessors.Preprocessor
,self.markdown
does point at the markdown instance, so I had to directly address my extensions referencesdict
as a class property. It's an inconsistent behavior, which I'm not certain is intended.Additionally while I was able to leverage
self.sanitize_url
in my reference pattern class, the fact thatself.markdown
points to the extension meant whensanitize_url
wanted to checkself.markdown.safeMode
, it couldn't unless I added a safeMode property to my extension class. That seemed inappropriate, but to be safe, I hard set it toTrue
.If I went about this all wrong, please let me know. It's got some basic docs, and doctests which pass.