2

我在我的博客文章的文本中添加图像。

我有 BlogImage 模型:

class BlogImage < ActiveRecord::Base
  attr_accessible :blog_id, :caption, :image

  belongs_to :blog

  has_attached_file :image, styles: { big: "1200X630>", medium: "300x300>", thumb: "300x300>" }, default_url: "/images/:style/missing.png"

  validates_attachment_presence :image
  validates_attachment_size :image, :less_than => 3.megabytes
  validates_attachment_content_type :image, :content_type => ['image/jpeg', 'image/png']
end

我的文章正文呈现为:

    :markdown
      #{blog.body}

降价由 gem 处理rdiscount

我希望能够在我的降价中写一个标签(例如[image_name]或类似的),以便在使用正确的图像标签呈现时自动转换。

我不知道从哪里开始。

谢谢。

4

1 回答 1

1

您可以使用如下语法插入带有 RDiscount 的图像:

![GitHub Favicon](https://github.com/favicon.ico =16x16)

标题是必需的(但可以为空)。尺寸是可选的。

于 2014-05-22T03:33:57.120 回答