Add abbreviation support for image width/height
This commit is contained in:
parent
cf8dae9454
commit
790cf30376
2 changed files with 14 additions and 4 deletions
|
@ -78,9 +78,9 @@
|
|||
{% capture _value %}{{ _attr | split: '=' | last | replace: '"', '' }}{% endcapture %}
|
||||
|
||||
{% case _key %}
|
||||
{% when 'width' %}
|
||||
{% when 'width', 'w' %}
|
||||
{% assign _width = _value %}
|
||||
{% when 'height' %}
|
||||
{% when 'height', 'h' %}
|
||||
{% assign _height = _value %}
|
||||
{% endcase %}
|
||||
|
||||
|
|
|
@ -16,8 +16,18 @@ tail_includes:
|
|||
{% endcapture %}
|
||||
<img src="{{ page.image.src }}" class="preview-img {{ bg | strip }}"
|
||||
alt="{{ page.image.alt | default: "Preview Image" }}"
|
||||
{% if page.image.width %}width="{{ page.image.width }}"{% endif %}
|
||||
{% if page.image.height %}height="{{ page.image.height }}"{% endif %}>
|
||||
|
||||
{% if page.image.width %}
|
||||
width="{{ page.image.width }}"
|
||||
{% elsif page.image.w %}
|
||||
width="{{ page.image.w }}"
|
||||
{% endif %}
|
||||
|
||||
{% if page.image.height %}
|
||||
height="{{ page.image.height }}"
|
||||
{% elsif page.image.h %}
|
||||
height="{{ page.image.h }}"
|
||||
{% endif %}>
|
||||
{% endif %}
|
||||
|
||||
<h1 data-toc-skip>{{ page.title }}</h1>
|
||||
|
|
Loading…
Reference in a new issue