我正在做一个网站,每月发表文章的问题。这很简单,我认为使用Markdown编辑器(如Stack Overflow中的WMD)将是完美的。

然而,他们确实需要在给定的段落中使图像右对齐的能力。

我看不出在目前的体制下有什么办法能做到这一点——有可能吗?


当前回答

<div style="float:left;margin:0 10px 10px 0" markdown="1">
    ![book](/images/book01.jpg)
</div>

markdown内部的属性markdown可能性。

其他回答

如果你用Python实现它,有一个扩展可以让你添加HTML键/值对,以及类/id标签。它的语法是:

![A picture of a cat](cat.png){: style="float:right"}

或者,如果嵌入式样式不能让你的船浮起来,

![A picture of a cat](cat.png){: .floatright}

使用相应的样式表styles .css:

.floatright {
    float: right;
    /* etc. */
}

我认为最简单的解决方案是直接指定align="right":

<img align="right" src=/logo.png" alt="logo" width="100"/>

你可以在Markdown中嵌入HTML,所以你可以这样做:

<img style="float: right;" src="whatever.jpg">

Continue markdown text...

为了使图像稍微缩进一点,只需在img元素中使用一些不间断的空格。例如:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="https://user-images.githubusercontent.com/123456/123456789-3aabedfe-deab-4242-97a0-a6641e675e68.png" />

在警告框内,将图像和文本作为单个块中的段落的一部分并排对齐。

<div class="warning" style='background-color:#EDF2F7; color:#1A2067; border-left: solid #718096 4px; border-radius: 4px;'>
<p style='padding:0.7em; margin-left:0.7em; display: inline-block;'>
<img src="typora_images/image-20211028083121348.png" style="zoom:70%;  float:right; padding:0.7em"/>
<b>isomorphism</b>  &rarr;  In mathematics, an isomorphism is a structure-preserving mapping between two structures of the same type that can be reversed by an inverse mapping.<br>
</p>
</div>

输出: