Markdown and image alignment

前端 未结 14 2393
予麋鹿
予麋鹿 2020-12-02 04:06

I am making a site that publishes articles in issues each month. It is straightforward, and I think using a Markdown editor (like the WMD one here in Stack Overflow) wo

14条回答
  •  半阙折子戏
    2020-12-02 04:49

    As greg said you can embed HTML content in Markdown, but one of the points of Markdown is to avoid having to have extensive (or any, for that matter) CSS/HTML markup knowledge, right? This is what I do:

    In my Markdown file I simply instruct all my wiki editors to embed wrap all images with something that looks like this:

    '
    // Put image here
    `

    (of course.. they don't know what

    means, but that shouldn't matter)

    So the Markdown file looks like this:

    ![optional image description][1]
    [1]: /image/path

    And in the CSS content that wraps the whole page I can do whatever I want with the image tag:

    img {
       float: right;
    }
    

    Of course you can do more with the CSS content... (in this particular case, wrapping the img tag with div prevents other text from wrapping against the image... this is just an example, though), but IMHO the point of Markdown is that you don't want potentially non-technical people getting into the ins and outs of CSS/HTML.. it's up to you as a web developer to make your CSS content that wraps the page as generic and clean as possible, but then again your editors need not know about that.

提交回复
热议问题