diff --git a/quartz/plugins/transformers/float-images.ts b/quartz/plugins/transformers/float-images.ts index 23d8449..c541007 100644 --- a/quartz/plugins/transformers/float-images.ts +++ b/quartz/plugins/transformers/float-images.ts @@ -10,22 +10,17 @@ export const FloatImages: QuartzTransformerPlugin = () => { textTransform: (_, src) => { /* my syntax is based on the wiki style + ![[https://example.com/image.png]]{float-center} ![[https://example.com/image.png]]{float-left} ![[https://example.com/image.png]]{float-right 40%} percentage is optional, default is 40% */ - const regex = /!\[\[([^\]]+)\]\]\{(float-left|float-right)(?:\s+(\d+)%?)?\}/g - return src.replace(regex, (_, src, float, width) => { - width = width || "40" // default - const direction = float === "float-left" ? "left" : "right" - const margin = float === "float-left" ? "0 2rem 0 0" : "0 0 0 2rem" - - // TODO YOU CAN MAKE THIS BETTER BY USING AND NOT INLINE STYLES - + const regex = /!\[\[([^\]]+)\]\]\{(float-left|float-right|float-center)(?:\s+(\d+)%?)?\}/g + return src.replace(regex, (_, src, float, width = 40) => { // do NOT try to tab align the following code, otherwise it renders as code instead of html parse return ` -