712 Commits

Author SHA1 Message Date
Manuel Rüger
664a99cd00 test: restore global log level after each SetLogLevel subtest
SetLogLevel mutates a process-global logger, leaking state into
subsequent tests and causing order-dependent failures. Save the
current level before each subtest and restore it via t.Cleanup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 01:05:32 +01:00
Manuel Rüger
5e1d40d910 fix: remove no-op log.GetLevel() call in SetLogLevel
The return value was unused and had no effect on logger state,
misleading readers into thinking it was needed for initialization.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 01:05:32 +01:00
Manuel Rüger
d68f8c3bb3 fix: use api.BaseURL instead of config.BaseURL for page URL output
confluence.NewAPI trims trailing slashes from the base URL into
api.BaseURL. Using config.BaseURL directly could produce double
slashes in the logged/printed URL when the caller passes a
trailing-slash BaseURL.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 01:05:32 +01:00
Manuel Rüger
1fc553f102 style: fix indentation in Test_setLogLevel
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 01:05:32 +01:00
Manuel Rüger
aa16e7ae26 fix: check error return from fmt.Fprintln
errcheck lint requires all error return values to be handled.
Propagate write errors from both Fprintln call sites.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 01:05:32 +01:00
Manuel Rüger
66120b937e fix: handle nil meta in dry-run mode when PageID is set
page.ResolvePage requires non-nil metadata and would error immediately
when called with meta == nil (e.g. when --page-id is used and the file
has no metadata header, or when metadata is intentionally suppressed).

Guard the call: when meta != nil use ResolvePage as before; when meta
is nil but PageID is provided, validate the page exists via
api.GetPageByID instead; when neither is set the earlier mandatory-
field check already returns an error, so no further action is needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 01:05:32 +01:00
Manuel Rüger
4e3b90c03c fix: route result output through Config.Output, not os.Stdout
mark.Run and ProcessFile were writing directly to os.Stdout via
fmt.Println, which is a surprising side-effect for library callers.

Add Config.Output io.Writer for callers to provide their own sink.
When nil the helper falls back to io.Discard, so library embedders
that do not set Output receive no implicit stdout writes. The CLI
layer sets Output: os.Stdout to preserve existing behaviour.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 01:05:32 +01:00
Manuel Rüger
06c3afef25 fix: skip label sync when metadata is absent
When PageID mode is used (meta == nil), labels is nil and calling
updateLabels unconditionally treats that as an empty desired set,
silently removing all existing global labels from the page. Guard
the call so label syncing only runs when metadata is present.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 01:05:32 +01:00
Manuel Rüger
e68a9f64ff Refactor CLI to be a thin adapter over the library
- util/cli.go: RunMark() now maps CLI flags into mark.Config and
  delegates to mark.Run(); all core processing logic removed
- util/cli_test.go: absorb Test_setLogLevel from deleted main_test.go
- main.go, main_test.go: removed (entry point is now cmd/mark/main.go)
- Makefile: update build target to ./cmd/mark with -o mark

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 01:05:32 +01:00
Manuel Rüger
9e4c4bde30 Add root library package with Config, Run and ProcessFile
Expose the core mark functionality as an importable Go library.
Library users can now import github.com/kovetskiy/mark and call:

  err := mark.Run(mark.Config{
      BaseURL:  "https://confluence.example.com",
      Username: "user",
      Password: "token",
      Files:    "docs/**/*.md",
      Features: []string{"mermaid", "mention"},
  })

The new package provides:
- Config struct: all options decoupled from the CLI framework
- Run(config Config) error: process all files matching Config.Files
- ProcessFile(file, api, config): process a single markdown file

Also moves the CLI entry point to cmd/mark/main.go following standard
Go convention for projects that serve as both a library and a binary.

Fixes a pre-existing nil-pointer dereference on meta.Attachments,
meta.Layout and related fields when using --target-url with a pageId
(meta was nil in that code path).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-13 01:05:32 +01:00
dependabot[bot]
2ae4601a02 build(deps): bump golang.org/x/text from 0.34.0 to 0.35.0
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.34.0 to 0.35.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.34.0...v0.35.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
v15.4.0
2026-03-11 19:38:34 +01:00
Manuel Rüger
76c4dfa16b Bump to go 1.26.1 2026-03-11 19:35:02 +01:00
Manuel Rüger
de71225164 fix d2 test
Co-Authored-By: mnowotnik <michal@mnowotnik.com>
2026-03-11 19:28:48 +01:00
mnowotnik
b8decd954b fix mermaid test 2026-03-11 18:43:18 +01:00
Johan Fagerberg
ab2c456851 chore: fix comment referring to wrong class 2026-03-11 12:49:22 +01:00
Johan Fagerberg
8e613c5e70 style: run gofmt on image_test.go 2026-03-11 12:49:22 +01:00
Johan Fagerberg
d264648916 test: update expected testdata output 2026-03-11 12:49:22 +01:00
Johan Fagerberg
9795f74f0f feat: only attempt to parse image attachments 2026-03-11 12:49:22 +01:00
Johan Fagerberg
6f18a47ed0 feat: don't add redundant 'height' to images 2026-03-11 12:49:22 +01:00
Johan Fagerberg
ec6a718c76 feat: throw errors instead of passing unknown aligns through 2026-03-11 12:49:22 +01:00
Johan Fagerberg
99dbcd9383 chore: clean up README changes a little bit 2026-03-11 12:49:22 +01:00
Johan Fagerberg
a0e9594f50 chore: clean up over-explanations slightly 2026-03-11 12:49:22 +01:00
Johan Fagerberg
9c58c36b46 feat: use 'center' for image widths 760<x<1800 2026-03-11 12:49:22 +01:00
Johan Fagerberg
cbc7400f92 feat: align image rendering with Confluence default 2026-03-11 12:49:22 +01:00
Johan Fagerberg
4d887bde74 feat: add support for image dimensions 2026-03-11 12:49:22 +01:00
Johan Fagerberg
c32cd79dc8 feat: add support for '--image-align' 2026-03-11 12:49:22 +01:00
Johan Fagerberg
875723da90 fix: trim whitespace when parsing 'content-appearance' flag 2026-03-11 12:47:35 +01:00
Johan Fagerberg
dcd28068f3 Update README.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-11 12:47:35 +01:00
Johan Fagerberg
9516939c7d feat: add support for --content-appearance 2026-03-11 12:47:35 +01:00
Manuel Rüger
d2717f031d Add Confluence task list renderer for GFM task lists
Convert GFM task list items (- [x] / - [ ]) to Confluence
ac:task-list XML format instead of HTML checkboxes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-09 23:37:36 +01:00
dependabot[bot]
529aa63d9f build(deps): bump docker/setup-buildx-action from 3 to 4
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3 to 4.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-09 21:01:17 +01:00
dependabot[bot]
3337dfd0cd build(deps): bump docker/setup-qemu-action from 3 to 4
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 3 to 4.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-09 21:01:02 +01:00
dependabot[bot]
2498b83dee build(deps): bump docker/build-push-action from 6 to 7
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6 to 7.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v6...v7)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-09 21:00:52 +01:00
dependabot[bot]
541e743d42 build(deps): bump docker/login-action from 3 to 4
Bumps [docker/login-action](https://github.com/docker/login-action) from 3 to 4.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-09 21:00:43 +01:00
dependabot[bot]
fbb0302bf5 build(deps): bump golang from 1.26.0 to 1.26.1
Bumps golang from 1.26.0 to 1.26.1.

---
updated-dependencies:
- dependency-name: golang
  dependency-version: 1.26.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-09 21:00:31 +01:00
dependabot[bot]
945cb9b978 build(deps): bump github.com/urfave/cli/v3 from 3.6.2 to 3.7.0
Bumps [github.com/urfave/cli/v3](https://github.com/urfave/cli) from 3.6.2 to 3.7.0.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v3.6.2...v3.7.0)

---
updated-dependencies:
- dependency-name: github.com/urfave/cli/v3
  dependency-version: 3.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-02 19:35:23 +01:00
dependabot[bot]
8118314dea build(deps): bump goreleaser/goreleaser-action from 6 to 7
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 6 to 7.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](https://github.com/goreleaser/goreleaser-action/compare/v6...v7)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-23 19:44:15 +01:00
dependabot[bot]
816add2709 build(deps): bump golang from 1.25.7 to 1.26.0
Bumps golang from 1.25.7 to 1.26.0.

---
updated-dependencies:
- dependency-name: golang
  dependency-version: 1.26.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-16 20:31:27 +01:00
dependabot[bot]
ca96113ec1 build(deps): bump golang from 1.25.6 to 1.25.7
Bumps golang from 1.25.6 to 1.25.7.

---
updated-dependencies:
- dependency-name: golang
  dependency-version: 1.25.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-10 11:34:53 +01:00
dependabot[bot]
597854fd37 build(deps): bump golang.org/x/text from 0.33.0 to 0.34.0
---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-version: 0.34.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-10 11:32:13 +01:00
dependabot[bot]
d2f18483bc build(deps): bump github.com/bmatcuk/doublestar/v4 from 4.9.2 to 4.10.0
Bumps [github.com/bmatcuk/doublestar/v4](https://github.com/bmatcuk/doublestar) from 4.9.2 to 4.10.0.
- [Release notes](https://github.com/bmatcuk/doublestar/releases)
- [Commits](https://github.com/bmatcuk/doublestar/compare/v4.9.2...v4.10.0)

---
updated-dependencies:
- dependency-name: github.com/bmatcuk/doublestar/v4
  dependency-version: 4.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-08 01:51:57 +01:00
Manuel Rüger
8d83ec00c0 chore: Switch to maintained yaml 2026-02-08 01:51:43 +01:00
Manuel Rüger
e294a7317e Move mention macro into a goldmark-parser/renderer 2026-02-08 00:59:43 +01:00
Manuel Rüger
b85e40402c Fix lint v15.3.0 2026-01-19 11:06:06 +01:00
Manuel Rüger
1433900a29 Bump to go 1.25 2026-01-19 11:04:39 +01:00
Manuel Rüger
517a3c76a2 Add missed template to README 2026-01-19 11:03:15 +01:00
dependabot[bot]
311c10af2f build(deps): bump github.com/urfave/cli/v3 from 3.6.1 to 3.6.2
Bumps [github.com/urfave/cli/v3](https://github.com/urfave/cli) from 3.6.1 to 3.6.2.
- [Release notes](https://github.com/urfave/cli/releases)
- [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/urfave/cli/compare/v3.6.1...v3.6.2)

---
updated-dependencies:
- dependency-name: github.com/urfave/cli/v3
  dependency-version: 3.6.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-19 10:09:26 +01:00
hypengw
c1c9a13391 parse "linenumbers" in code block 2026-01-15 12:18:28 +01:00
hypengw
5bb400cf51 add view-file template 2026-01-15 12:17:05 +01:00
dependabot[bot]
5270864d7c build(deps): bump golang.org/x/text from 0.32.0 to 0.33.0
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.32.0 to 0.33.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.32.0...v0.33.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-12 13:14:11 +01:00