tag:support.markedapp.com,2011-09-11:/discussions/questions/8250-adding-style-elements-to-imagesMarked: Discussion 2015-03-10T14:07:18Ztag:support.markedapp.com,2011-09-11:Comment/362292882015-03-09T05:27:20Z2015-03-09T05:27:20ZAdding style elements to images<div><p>I have inline images that I want to have styles applied (most
importantly float attributes). In my markdown I'm using this type
of syntax:</p>
<p>[<img src="image_url" alt="">{: style="float:right"}</p>
<p>However, marked doesn't recognize the style part. Is there a
supported way to add CSS styling to images that will work?</p></div>graham wheelertag:support.markedapp.com,2011-09-11:Comment/362292882015-03-09T11:52:10Z2015-03-09T11:52:10ZAdding style elements to images<div><p>The syntax you're using is Kramdown. You can use Kramdown as a
custom processor, or you can use MultiMarkdown reference
syntax.</p>
<p><img title="title" style="float:left" alt="" src=
"image.jpg"></p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/362292882015-03-10T04:37:57Z2015-03-10T04:37:59ZAdding style elements to images<div><p>Thanks for the fast response, Brett. Actually this is Python
markdown, as I'm writing for the Pelican static site generator.</p>
<p>I tried adding it as a custom processor:</p>
<p>Path: /usr/local/bin/python<br>
Args: -m markdown -x markdown.extensions.attr_list</p>
<p>but it still doesn't work; I see the {:style="float:right"} as
text in the result. However:</p>
<pre>
<code>cat <file> | python -m markdown -x markdown.extensions.attr_list</code>
</pre>
<p>works fine, so my command line seems right.</p></div>graham wheelertag:support.markedapp.com,2011-09-11:Comment/362292882015-03-10T13:44:13Z2015-03-10T13:44:13ZAdding style elements to images<div><p>Your custom processor works for me as you describe it.</p>
<ol>
<li>Are you certain it's running based on the green indicator at
the<br>
bottom of the preview window?<br></li>
<li>Which version of Marked are you using?</li>
</ol>
<p>-Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/362292882015-03-10T14:00:55Z2015-03-10T14:00:56ZAdding style elements to images<div><p>The green indicator was on. I toggled it off, then on again, and
I got a prompt about granting permissions. After clicking on allow
it started working. :-)</p>
<p>This is with 2.4.9.</p></div>graham wheelertag:support.markedapp.com,2011-09-11:Comment/362292882015-03-10T14:07:18Z2015-03-10T14:07:18ZAdding style elements to images<div><p>Glad to hear it. The sandboxing in the MAS version causes a lot
of issues with custom processors, but the version in review should
improve the situation. Also note there's a cheat in Advanced prefs
titled Update Permissions that allows you to grant access to your
entire drive.</p></div>Brett