mirror of
https://github.com/kovetskiy/mark.git
synced 2026-03-14 06:07:36 +08:00
chore: clean up over-explanations slightly
This commit is contained in:
parent
9c58c36b46
commit
a0e9594f50
18
README.md
18
README.md
@ -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.:
|
||||||
@ -266,23 +266,23 @@ some long bash code block
|
|||||||
| `linenumbers` | false |
|
| `linenumbers` | false |
|
||||||
| `1` (any number for firstline) | 1 |
|
| `1` (any number for firstline) | 1 |
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
* `bash collapse`
|
* `bash collapse`
|
||||||
If you have long code blocks, you can make them collapsible.
|
If you have long code blocks, you can make them collapsible.
|
||||||
* `bash collapse title Some long long bash function`
|
* `bash collapse title Some long long bash function`
|
||||||
And you can also add a title.
|
And you can also add a title.
|
||||||
* `bash linenumbers collapse title Some long long bash function`
|
* `bash linenumbers collapse title Some long long bash function`
|
||||||
And linenumbers.
|
And linenumbers.
|
||||||
* `bash 1 collapse title Some long long bash function`
|
* `bash 1 collapse title Some long long bash function`
|
||||||
Or directly give a number as firstline number.
|
Or directly give a number as firstline number.
|
||||||
* `bash 1 collapse midnight title Some long long bash function`
|
* `bash 1 collapse midnight title Some long long bash function`
|
||||||
And even themes.
|
And even themes.
|
||||||
* `- 1 collapse midnight title Some long long code`
|
* `- 1 collapse midnight title Some long long code`
|
||||||
Please note that, if you want to have a code block without a language
|
Please note that, if you want to have a code block without a language
|
||||||
use `-` as the first character, if you want to have the other goodies.
|
use `-` as the first character, if you want to have the other goodies.
|
||||||
|
|
||||||
More details at Confluence [Code Block Macro](https://confluence.atlassian.com/doc/code-block-macro-139390.html) doc.
|
More details at Confluence [Code Block Macro](https://confluence.atlassian.com/doc/code-block-macro-139390.html) doc.
|
||||||
|
|
||||||
### Block Quotes
|
### Block Quotes
|
||||||
|
|
||||||
|
|||||||
@ -19,33 +19,29 @@ 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 {
|
||||||
return "center"
|
return "center"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 {
|
||||||
@ -57,8 +53,7 @@ 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