/assets/shot.png",
+ "source": "assets/shot.png"
}
],
"broken": [],
- "html": "Image Properties
\nA JSON title sets title/width/height/align attributes:
\n
\nA plain-string title becomes a tooltip (ac:title):
\n
\nInvalid width/align values are dropped with warnings:
\n
\n",
+ "html": "Image Properties
\nA JSON title sets title/width/height/align attributes:
\n
\nA plain-string title becomes a tooltip (ac:title):
\n
\nInvalid width/align values are dropped with warnings:
\n
\n",
"warnings": [
"assets/shot.png: ignoring width='wide' (must be a number)",
"assets/shot.png: ignoring align='middle' (must be left, center, or right)"
diff --git a/internal/convert/testdata/regression/images-broken/main.md b/internal/convert/testdata/regression/images-broken/main.md
index 1c6f85c..4877b14 100644
--- a/internal/convert/testdata/regression/images-broken/main.md
+++ b/internal/convert/testdata/regression/images-broken/main.md
@@ -7,3 +7,7 @@ A reference to a file that isn't there:
A reference to a file with an unsupported extension:

+
+A reference to a file above the documentation root:
+
+
diff --git a/internal/convert/testdata/regression/images-broken/test.output b/internal/convert/testdata/regression/images-broken/test.output
index fb6dd3f..b012a92 100644
--- a/internal/convert/testdata/regression/images-broken/test.output
+++ b/internal/convert/testdata/regression/images-broken/test.output
@@ -2,8 +2,9 @@
"attachments": [],
"broken": [
"IMAGE BROKEN: assets/missing.png (not found)",
- "IMAGE BROKEN: notes.pdf (unsupported type)"
+ "IMAGE BROKEN: notes.pdf (unsupported type)",
+ "IMAGE BROKEN: ../../../../../../../../etc/passwd.png (outside the documentation root)"
],
- "html": "Broken Images
\nA reference to a file that isn't there:
\nIMAGE BROKEN: assets/missing.png (not found)
\nA reference to a file with an unsupported extension:
\nIMAGE BROKEN: notes.pdf (unsupported type)
\n",
+ "html": "Broken Images
\nA reference to a file that isn't there:
\nIMAGE BROKEN: assets/missing.png (not found)
\nA reference to a file with an unsupported extension:
\nIMAGE BROKEN: notes.pdf (unsupported type)
\nA reference to a file above the documentation root:
\nIMAGE BROKEN: ../../../../../../../../etc/passwd.png (outside the documentation root)
\n",
"warnings": []
}
diff --git a/internal/convert/testdata/regression/images-local/test.output b/internal/convert/testdata/regression/images-local/test.output
index eb8238f..cc5d07a 100644
--- a/internal/convert/testdata/regression/images-local/test.output
+++ b/internal/convert/testdata/regression/images-local/test.output
@@ -1,11 +1,12 @@
{
"attachments": [
{
- "filename": "assets_diagram.png",
- "path": "/assets/diagram.png"
+ "filename": "assets%2Fdiagram.png",
+ "path": "/assets/diagram.png",
+ "source": "assets/diagram.png"
}
],
"broken": [],
- "html": "Local Image
\nA local image becomes an ri:attachment and is collected for upload:
\n
\n",
+ "html": "Local Image
\nA local image becomes an ri:attachment and is collected for upload:
\n
\n",
"warnings": []
}
diff --git a/internal/convert/testdata/regression/images-shared-parent/assets/logo.png b/internal/convert/testdata/regression/images-shared-parent/assets/logo.png
new file mode 100644
index 0000000..9b9a92c
--- /dev/null
+++ b/internal/convert/testdata/regression/images-shared-parent/assets/logo.png
@@ -0,0 +1 @@
+stub image content (never read by md_to_confluence)
diff --git a/internal/convert/testdata/regression/images-shared-parent/sub/main.md b/internal/convert/testdata/regression/images-shared-parent/sub/main.md
new file mode 100644
index 0000000..f8fdcc2
--- /dev/null
+++ b/internal/convert/testdata/regression/images-shared-parent/sub/main.md
@@ -0,0 +1,7 @@
+# Shared Assets
+
+A page in a subdirectory referencing an asset directory above it -- the layout
+GitHub renders too -- is published, with the path preserved in the attachment
+name:
+
+
diff --git a/internal/convert/testdata/regression/images-shared-parent/test.input b/internal/convert/testdata/regression/images-shared-parent/test.input
new file mode 100644
index 0000000..e72fb1d
--- /dev/null
+++ b/internal/convert/testdata/regression/images-shared-parent/test.input
@@ -0,0 +1,4 @@
+{
+ "filename": "sub/main.md",
+ "files": ["sub/main.md", "assets/logo.png"]
+}
diff --git a/internal/convert/testdata/regression/images-shared-parent/test.output b/internal/convert/testdata/regression/images-shared-parent/test.output
new file mode 100644
index 0000000..11c8486
--- /dev/null
+++ b/internal/convert/testdata/regression/images-shared-parent/test.output
@@ -0,0 +1,12 @@
+{
+ "attachments": [
+ {
+ "filename": "..%2Fassets%2Flogo.png",
+ "path": "/assets/logo.png",
+ "source": "../assets/logo.png"
+ }
+ ],
+ "broken": [],
+ "html": "Shared Assets
\nA page in a subdirectory referencing an asset directory above it -- the layout GitHub renders too -- is published, with the path preserved in the attachment name:
\n
\n",
+ "warnings": []
+}
diff --git a/internal/convert/testdata/regression/kitchen-sink/test.output b/internal/convert/testdata/regression/kitchen-sink/test.output
index a289b1f..69cfa6c 100644
--- a/internal/convert/testdata/regression/kitchen-sink/test.output
+++ b/internal/convert/testdata/regression/kitchen-sink/test.output
@@ -1,11 +1,12 @@
{
"attachments": [
{
- "filename": "assets_logo.png",
- "path": "/assets/logo.png"
+ "filename": "assets%2Flogo.png",
+ "path": "/assets/logo.png",
+ "source": "assets/logo.png"
}
],
"broken": [],
- "html": "Release Notes
\n\nSee the upgrade guide before starting.
\nBack up your data before upgrading.
\nWhat's New
\nA soft-wrapped paragraph describing the release across multiple source lines that collapse into one.
\n
\nConfiguration
\n\n\n\n| Setting | \nDefault | \n
\n\n\n\n| retries | \n3 | \n
\n\n| timeout | \n30s | \n
\n\n
\npythonA pasted status macro: Stable
\n",
+ "html": "Release Notes
\n\nSee the upgrade guide before starting.
\nBack up your data before upgrading.
\nWhat's New
\nA soft-wrapped paragraph describing the release across multiple source lines that collapse into one.
\n
\nConfiguration
\n\n\n\n| Setting | \nDefault | \n
\n\n\n\n| retries | \n3 | \n
\n\n| timeout | \n30s | \n
\n\n
\npythonA pasted status macro: Stable
\n",
"warnings": []
}
diff --git a/internal/convert/testdata/storage2md/images/input.storage b/internal/convert/testdata/storage2md/images/input.storage
index 1139c4f..f3f5e7b 100644
--- a/internal/convert/testdata/storage2md/images/input.storage
+++ b/internal/convert/testdata/storage2md/images/input.storage
@@ -1,5 +1,5 @@
-
+
-
+
diff --git a/internal/convert/testdata/storage2md/images/output.md b/internal/convert/testdata/storage2md/images/output.md
index 0579601..c3006f9 100644
--- a/internal/convert/testdata/storage2md/images/output.md
+++ b/internal/convert/testdata/storage2md/images/output.md
@@ -1,4 +1,4 @@
-
+

@@ -6,4 +6,4 @@

-
+