Compare commits

...

4 Commits

Author SHA1 Message Date
dependabot[bot]
0948790f9a build(deps): bump github.com/rs/zerolog from 1.35.0 to 1.35.1
Bumps [github.com/rs/zerolog](https://github.com/rs/zerolog) from 1.35.0 to 1.35.1.
- [Commits](https://github.com/rs/zerolog/compare/v1.35.0...v1.35.1)

---
updated-dependencies:
- dependency-name: github.com/rs/zerolog
  dependency-version: 1.35.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-28 06:50:55 +09:00
Mamut3D
68de8de09a UPD attachment.go: optimize checksum computation skipping when already set 2026-04-25 08:05:07 +09:00
moia-sven-ole
7fab1755d6 feat: add 'default' as valid Content-Appearance value 2026-04-24 21:22:49 +09:00
dependabot[bot]
13e7b496ee build(deps): bump golang.org/x/text from 0.35.0 to 0.36.0
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.35.0 to 0.36.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.35.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-version: 0.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-14 03:09:49 +09:00
7 changed files with 48 additions and 15 deletions

View File

@ -56,11 +56,12 @@ Also, optional following headers are supported:
* blogpost: [Blog post](https://confluence.atlassian.com/doc/blog-posts-834222533.html) in `Space`. Cannot have `Parent`(s) * blogpost: [Blog post](https://confluence.atlassian.com/doc/blog-posts-834222533.html) in `Space`. Cannot have `Parent`(s)
```markdown ```markdown
<!-- Content-Appearance: (full-width|fixed) --> <!-- Content-Appearance: (full-width|fixed|default) -->
``` ```
* (default) full-width: content will fill the full page width * (default) full-width: content will fill the full page width
* fixed: content will be rendered in a fixed narrow view * fixed: content will be rendered in a fixed narrow view
* default: sets the Confluence property value to `"default"`, which is the narrow layout as set by the Confluence UI. Note: `fixed` maps to a different Confluence property value and can cause misaligned page title and body content — use `default` instead for the narrow layout.
```markdown ```markdown
<!-- Sidebar: <h2>Test</h2> --> <!-- Sidebar: <h2>Test</h2> -->
@ -876,7 +877,7 @@ GLOBAL OPTIONS:
--space string use specified space key. If the space key is not specified, it must be set in the page metadata. [$MARK_SPACE] --space string use specified space key. If the space key is not specified, it must be set in the page metadata. [$MARK_SPACE]
--parents string A list containing the parents of the document separated by parents-delimiter (default: '/'). These will be prepended to the ones defined in the document itself. [$MARK_PARENTS] --parents string A list containing the parents of the document separated by parents-delimiter (default: '/'). These will be prepended to the ones defined in the document itself. [$MARK_PARENTS]
--parents-delimiter string The delimiter used for the parents list (default: "/") [$MARK_PARENTS_DELIMITER] --parents-delimiter string The delimiter used for the parents list (default: "/") [$MARK_PARENTS_DELIMITER]
--content-appearance string default content appearance for pages without a Content-Appearance header. Possible values: full-width, fixed. [$MARK_CONTENT_APPEARANCE] --content-appearance string default content appearance for pages without a Content-Appearance header. Possible values: full-width, fixed, default. [$MARK_CONTENT_APPEARANCE]
--mermaid-scale float defines the scaling factor for mermaid renderings. (default: 1) [$MARK_MERMAID_SCALE] --mermaid-scale float defines the scaling factor for mermaid renderings. (default: 1) [$MARK_MERMAID_SCALE]
--include-path string Path for shared includes, used as a fallback if the include doesn't exist in the current directory. [$MARK_INCLUDE_PATH] --include-path string Path for shared includes, used as a fallback if the include doesn't exist in the current directory. [$MARK_INCLUDE_PATH]
--changes-only Avoids re-uploading pages that haven't changed since the last run. [$MARK_CHANGES_ONLY] --changes-only Avoids re-uploading pages that haven't changed since the last run. [$MARK_CHANGES_ONLY]

View File

@ -49,6 +49,13 @@ func ResolveAttachments(
attachments []Attachment, attachments []Attachment,
) ([]Attachment, error) { ) ([]Attachment, error) {
for i := range attachments { for i := range attachments {
// Skip checksum computation if already set (e.g. by mermaid/d2 renderers
// which use the source content as the stable checksum rather than the
// rendered PNG bytes, which may be non-deterministic across environments).
if attachments[i].Checksum != "" {
continue
}
checksum, err := GetChecksum(bytes.NewReader(attachments[i].FileBytes)) checksum, err := GetChecksum(bytes.NewReader(attachments[i].FileBytes))
if err != nil { if err != nil {
return nil, fmt.Errorf("unable to get checksum for attachment %q: %w", attachments[i].Name, err) return nil, fmt.Errorf("unable to get checksum for attachment %q: %w", attachments[i].Name, err)

4
go.mod
View File

@ -8,14 +8,14 @@ require (
github.com/chromedp/chromedp v0.15.1 github.com/chromedp/chromedp v0.15.1
github.com/dreampuf/mermaid.go v0.2.0 github.com/dreampuf/mermaid.go v0.2.0
github.com/kovetskiy/gopencils v0.0.0-20250404051442-0b776066936a github.com/kovetskiy/gopencils v0.0.0-20250404051442-0b776066936a
github.com/rs/zerolog v1.35.0 github.com/rs/zerolog v1.35.1
github.com/stefanfritsch/goldmark-admonitions v1.1.1 github.com/stefanfritsch/goldmark-admonitions v1.1.1
github.com/stretchr/testify v1.11.1 github.com/stretchr/testify v1.11.1
github.com/urfave/cli-altsrc/v3 v3.1.0 github.com/urfave/cli-altsrc/v3 v3.1.0
github.com/urfave/cli/v3 v3.8.0 github.com/urfave/cli/v3 v3.8.0
github.com/yuin/goldmark v1.8.2 github.com/yuin/goldmark v1.8.2
go.yaml.in/yaml/v3 v3.0.4 go.yaml.in/yaml/v3 v3.0.4
golang.org/x/text v0.35.0 golang.org/x/text v0.36.0
oss.terrastruct.com/d2 v0.7.1 oss.terrastruct.com/d2 v0.7.1
oss.terrastruct.com/util-go v0.0.0-20250213174338-243d8661088a oss.terrastruct.com/util-go v0.0.0-20250213174338-243d8661088a
) )

8
go.sum
View File

@ -78,8 +78,8 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/rs/zerolog v1.35.0 h1:VD0ykx7HMiMJytqINBsKcbLS+BJ4WYjz+05us+LRTdI= github.com/rs/zerolog v1.35.1 h1:m7xQeoiLIiV0BCEY4Hs+j2NG4Gp2o2KPKmhnnLiazKI=
github.com/rs/zerolog v1.35.0/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw= github.com/rs/zerolog v1.35.1/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw=
github.com/stefanfritsch/goldmark-admonitions v1.1.1 h1:SncsICdQrIYYaq02Ta+zyc9gNmMfYqQH2qwLSCJYxA4= github.com/stefanfritsch/goldmark-admonitions v1.1.1 h1:SncsICdQrIYYaq02Ta+zyc9gNmMfYqQH2qwLSCJYxA4=
github.com/stefanfritsch/goldmark-admonitions v1.1.1/go.mod h1:cOZK5O0gE6eWfpxTdjGUmeONW2IL9j3Zujv3KlZWlLo= github.com/stefanfritsch/goldmark-admonitions v1.1.1/go.mod h1:cOZK5O0gE6eWfpxTdjGUmeONW2IL9j3Zujv3KlZWlLo=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
@ -134,8 +134,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=

View File

@ -46,6 +46,7 @@ type Meta struct {
const ( const (
FullWidthContentAppearance = "full-width" FullWidthContentAppearance = "full-width"
FixedContentAppearance = "fixed" FixedContentAppearance = "fixed"
DefaultContentAppearance = "default"
) )
var ( var (
@ -122,9 +123,12 @@ func ExtractMeta(data []byte, spaceFromCli string, titleFromH1 bool, titleFromFi
continue continue
case ContentAppearance: case ContentAppearance:
if strings.TrimSpace(value) == FixedContentAppearance { switch strings.TrimSpace(value) {
case FixedContentAppearance:
meta.ContentAppearance = FixedContentAppearance meta.ContentAppearance = FixedContentAppearance
} else { case DefaultContentAppearance:
meta.ContentAppearance = DefaultContentAppearance
default:
meta.ContentAppearance = FullWidthContentAppearance meta.ContentAppearance = FullWidthContentAppearance
} }
@ -166,9 +170,12 @@ func ExtractMeta(data []byte, spaceFromCli string, titleFromH1 bool, titleFromFi
// Use the global content appearance flag if the header is not set in the document // Use the global content appearance flag if the header is not set in the document
if meta != nil && defaultContentAppearance != "" && meta.ContentAppearance == "" { if meta != nil && defaultContentAppearance != "" && meta.ContentAppearance == "" {
if strings.TrimSpace(defaultContentAppearance) == FixedContentAppearance { switch strings.TrimSpace(defaultContentAppearance) {
case FixedContentAppearance:
meta.ContentAppearance = FixedContentAppearance meta.ContentAppearance = FixedContentAppearance
} else { case DefaultContentAppearance:
meta.ContentAppearance = DefaultContentAppearance
default:
meta.ContentAppearance = FullWidthContentAppearance meta.ContentAppearance = FullWidthContentAppearance
} }
} else if meta != nil && meta.ContentAppearance == "" { } else if meta != nil && meta.ContentAppearance == "" {

View File

@ -88,4 +88,22 @@ func TestExtractMetaContentAppearance(t *testing.T) {
assert.NotNil(t, meta) assert.NotNil(t, meta)
assert.Equal(t, FullWidthContentAppearance, meta.ContentAppearance) assert.Equal(t, FullWidthContentAppearance, meta.ContentAppearance)
}) })
t.Run("default appearance via cli flag", func(t *testing.T) {
data := []byte("<!-- Space: DOC -->\n<!-- Title: Example -->\n\nbody\n")
meta, _, err := ExtractMeta(data, "", false, false, "", nil, false, DefaultContentAppearance)
assert.NoError(t, err)
assert.NotNil(t, meta)
assert.Equal(t, DefaultContentAppearance, meta.ContentAppearance)
})
t.Run("default appearance via header", func(t *testing.T) {
data := []byte("<!-- Space: DOC -->\n<!-- Title: Example -->\n<!-- Content-Appearance: default -->\n\nbody\n")
meta, _, err := ExtractMeta(data, "", false, false, "", nil, false, "")
assert.NoError(t, err)
assert.NotNil(t, meta)
assert.Equal(t, DefaultContentAppearance, meta.ContentAppearance)
})
} }

View File

@ -169,7 +169,7 @@ var Flags = []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "content-appearance", Name: "content-appearance",
Value: "", Value: "",
Usage: "default content appearance for pages without a Content-Appearance header. Possible values: full-width, fixed.", Usage: "default content appearance for pages without a Content-Appearance header. Possible values: full-width, fixed, default.",
Sources: cli.NewValueSourceChain( Sources: cli.NewValueSourceChain(
cli.EnvVar("MARK_CONTENT_APPEARANCE"), cli.EnvVar("MARK_CONTENT_APPEARANCE"),
altsrctoml.TOML("content-appearance", altsrc.NewStringPtrSourcer(&filename)), altsrctoml.TOML("content-appearance", altsrc.NewStringPtrSourcer(&filename)),
@ -236,11 +236,11 @@ func CheckFlags(context context.Context, command *cli.Command) (context.Context,
contentAppearance := strings.TrimSpace(command.String("content-appearance")) contentAppearance := strings.TrimSpace(command.String("content-appearance"))
if contentAppearance != "" { if contentAppearance != "" {
switch contentAppearance { switch contentAppearance {
case "full-width", "fixed": case "full-width", "fixed", "default":
// ok // ok
default: default:
return context, fmt.Errorf( return context, fmt.Errorf(
"invalid value for --content-appearance: %q (expected: full-width or fixed)", "invalid value for --content-appearance: %q (expected: full-width, fixed, or default)",
contentAppearance, contentAppearance,
) )
} }