It’s not directly involved with Jekyll issue but here it relates though, I’m using Markdown format on my Jekyll site. As demonstrated in the above picture, how can we accomplish this using Markdown on Jekyll? I know, Markdown is not the replacement of HTML but can we achieve such result using Markdown?
Kramdown allows for inline attributes. You can apply a CSS class to the image or inline style to float the image to the left so the text wraps on the right.
Yes you can. It really depends on how you want to do it.
You can either add all the styling you want inline like above… just appended more styles to the float. e.g. {: style="float: left; margin-right: 1em;"}
Or better yet, you add as a class which you have CSS in your stylesheet you reference. This is more DRY.
/* add to you stylesheet */
.img-left {
float: left;
margin-right: 1em;
}
Awesome. However, here we get something like below
![image](graph_two.jpg){: style="float: left"; margin-right: 10em; height="25%" width="25%"} ## Some Text On Left!<br>Some Text On Left!<br><br>Some Text On Left!Some Text On Left!Some Text
output:
We can scale the image as you suggested but how to scale text? What sorts of change I require here to achieve above demonstration (Image in Q.)? Or, do you suggest to use the HTML for this instead of the Markdown?
What you’ve written above isn’t valid Markdown that’s why ## Some Text On Left isn’t converting into a <h2>. You need a double line break for that to convert to a headline. Your inline CSS also isn’t valid, you’re mixing HTML attributes with CSS style.
To get this to work you likely need to wrap some things with divs to get the floats right. And at that point you’d have an easier time building this logic directly into a _layout or abstract out to a Jekyll include.
Markdown isn’t meant for doing layout like this.
The basic idea for an include would be:
{% include module.html image_path="graph_two.jpg" title="Some title text" description="Some more text that will appear to the left of the image." %}
Which will give you something like this after the include pulls in the data:
<div style="clear: both;">
<div style="float: left; margin-right 1em;">
<img src="graph_two.jpg" alt="">
</div>
<div>
<h2>Some title text</h2>
<p>Some more text that will appear to the left of the image.</p>
</div>
</div>