-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
When running against a file in a different directory, these two inject blocks should be interchangeable. They're not because the command action is being issued within the current working directory, while the file action is being issued relative to the location of the markdown file.
<!-- CODEBLOCK_START { "value": ".nvmrc" } -->
<!-- CODEBLOCK_END -->
<!-- CODEBLOCK_START { "type": "command", "value": "cat .nvmrc" } -->
<!-- CODEBLOCK_END -->Duplication Steps
mkdir -p nested-dir
echo "Test Root-Level File" > test-root.txt
echo "Test Nested File" > nested-dir/test-nested.txt
echo 'Works:\n<!--CODEBLOCK_START {"value":"cat test-root.txt","type":"command"}--> <!--CODEBLOCK_END-->' > nested-dir/README.md
npx -y markdown-inject -a
echo 'Fails:\n<!--CODEBLOCK_START {"value":"test-root.txt"}--> <!--CODEBLOCK_END-->' > nested-dir/README.md
npx -y markdown-inject -a
echo 'Works:\n<!--CODEBLOCK_START {"value":"test-nested.txt"}--> <!--CODEBLOCK_END-->' > nested-dir/README.md
npx -y markdown-inject -a
echo 'Fails:\n<!--CODEBLOCK_START {"value":"cat test-nested.txt","type":"command"}--> <!--CODEBLOCK_END-->' > nested-dir/README.md
npx -y markdown-inject -aI'd probably like if all actions happened relative to the file rather than relative to the cwd.
Dream case:
mkdir -p nested-dir
echo "Test Root-Level File" > test-root.txt
echo "Test Nested File" > nested-dir/test-nested.txt
echo 'Fails:\n<!--CODEBLOCK_START {"value":"cat test-root.txt","type":"command"}--> <!--CODEBLOCK_END-->' > nested-dir/README.md
npx -y markdown-inject -a
echo 'Fails:\n<!--CODEBLOCK_START {"value":"test-root.txt"}--> <!--CODEBLOCK_END-->' > nested-dir/README.md
npx -y markdown-inject -a
echo 'Works:\n<!--CODEBLOCK_START {"value":"test-nested.txt"}--> <!--CODEBLOCK_END-->' > nested-dir/README.md
npx -y markdown-inject -a
echo 'Works:\n<!--CODEBLOCK_START {"value":"cat test-nested.txt","type":"command"}--> <!--CODEBLOCK_END-->' > nested-dir/README.md
npx -y markdown-inject -a
echo 'Works:\n<!--CODEBLOCK_START {"value":"../test-root.txt"}--> <!--CODEBLOCK_END-->' > nested-dir/README.md
npx -y markdown-inject -a
echo 'Works:\n<!--CODEBLOCK_START {"value":"cat ../test-root.txt","type":"command"}--> <!--CODEBLOCK_END-->' > nested-dir/README.md
npx -y markdown-inject -aMetadata
Metadata
Assignees
Labels
No labels