dsrkafuu / hugo-theme-fuji

A minimal Hugo theme with nice theme color. | 一个主题色极简 Hugo 主题。
https://github.dsrkafuu.net/hugo-theme-fuji/
Apache License 2.0
367 stars 97 forks source link

Align picture to center #103

Open Mighten opened 1 year ago

Mighten commented 1 year ago

Hi, @dsrkafuu, first I want to thank you for providing this wonderful theme!

Recently, I cannot arrange a pictures to the center of a paragraph, by the following Markdown syntax:

![alt text](/path/to/file.svg)

Is there a possible way to align a picture to the center of a paragraph, by Markdown Syntax (Not <img> tag)?

Thank you!


F.Y.I., the Mermaid can align a diagram to the center, configurations shown below:

in /layouts/partials/mermaid.html:

<script defer src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>

<script>
    // Replace mermaid pre.code to div
    Array.from(document.getElementsByClassName("language-mermaid")).forEach(
      (el) => {
        el.parentElement.outerHTML = `<div class="mermaid">${el.innerText}</div>`;
      }
    );
</script>
<style>
/* Set svg to center */
.mermaid svg {
    display: block;
    margin: auto;
    background-color: rgba(255, 255, 255, 0.5);
}
</style>