mirror of
https://github.com/kovetskiy/mark.git
synced 2026-03-14 14:17:37 +08:00
chore: clean up over-explanations slightly
This commit is contained in:
parent
9c58c36b46
commit
a0e9594f50
@ -85,7 +85,7 @@ You can set the alignment for all images in the page. Common values are `left`,
|
|||||||
|
|
||||||
**Note**: Images with width >= 760px automatically use `ac:align="wide"` with `ac:layout="center"` instead of the configured alignment, as Confluence requires this for wide images.
|
**Note**: Images with width >= 760px automatically use `ac:align="wide"` with `ac:layout="center"` instead of the configured alignment, as Confluence requires this for wide images.
|
||||||
|
|
||||||
Custom values are passed through as-is with only the `ac:align` attribute. Can also be set globally via the `--image-align` CLI option (per-page header takes precedence).
|
Can also be set globally via the `--image-align` CLI option (per-page header takes precedence).
|
||||||
|
|
||||||
Mark supports Go templates, which can be included into article by using path
|
Mark supports Go templates, which can be included into article by using path
|
||||||
to the template relative to current working dir, e.g.:
|
to the template relative to current working dir, e.g.:
|
||||||
|
|||||||
@ -19,12 +19,10 @@ import (
|
|||||||
// calculateAlign determines the appropriate ac:align value
|
// calculateAlign determines the appropriate ac:align value
|
||||||
// Images >= 760px must use "center" alignment, smaller images can use configured alignment
|
// Images >= 760px must use "center" alignment, smaller images can use configured alignment
|
||||||
func calculateAlign(configuredAlign string, width string) string {
|
func calculateAlign(configuredAlign string, width string) string {
|
||||||
// No alignment configured
|
|
||||||
if configuredAlign == "" {
|
if configuredAlign == "" {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if image is wide enough to require center alignment
|
|
||||||
if width != "" {
|
if width != "" {
|
||||||
widthInt, err := strconv.Atoi(width)
|
widthInt, err := strconv.Atoi(width)
|
||||||
if err == nil && widthInt >= 760 {
|
if err == nil && widthInt >= 760 {
|
||||||
@ -32,20 +30,18 @@ func calculateAlign(configuredAlign string, width string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For images < 760px, use configured alignment
|
|
||||||
return configuredAlign
|
return configuredAlign
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculateLayout determines the appropriate ac:layout value based on width and alignment
|
// calculateLayout determines the appropriate ac:layout value based on width and alignment
|
||||||
// Images >= 1800px use "full-width", images >= 760px use "wide", otherwise based on alignment
|
// Images >= 1800px use "full-width", images >= 760px use "wide", otherwise based on alignment
|
||||||
|
// These thresholds are based on Confluence's behavior as of 2026-02, but may need adjustment in the future
|
||||||
// Returns empty string if no alignment is configured
|
// Returns empty string if no alignment is configured
|
||||||
func calculateLayout(align string, width string) string {
|
func calculateLayout(align string, width string) string {
|
||||||
// If no alignment configured, don't set layout
|
|
||||||
if align == "" {
|
if align == "" {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check width thresholds first
|
|
||||||
if width != "" {
|
if width != "" {
|
||||||
widthInt, err := strconv.Atoi(width)
|
widthInt, err := strconv.Atoi(width)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -58,7 +54,6 @@ func calculateLayout(align string, width string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For images < 760px, use layout based on alignment
|
|
||||||
switch align {
|
switch align {
|
||||||
case "left":
|
case "left":
|
||||||
return "align-start"
|
return "align-start"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user