Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

{slug} does not replace space with slugSeparator used with siteImagesDir #312

Closed
fkjensen opened this issue Mar 31, 2022 · 1 comment
Closed

Comments

@fkjensen
Copy link

Describe the bug
{slug} does not replace space with slugSeparator used with siteImagesDir.

I created a project specific mdwriter.cson configuration with a minimal setup where I would like the markdown filename to be used with the {slug} counterpart. I expected that the filename "test space.md" would have a corresponding {slug} as "test_space.md" with slugSeparator is set to "".

Mac OS X: 12.3
Atom: 1.60.0

To Reproduce
Steps to reproduce the behavior:

  1. First I do a new project "wr" by making a directory named "t/wr". In that directory I use Atom to create a new "_mdwriter.cson" project specific configuration file with the following configuration
siteEngine: "general"
fileExtension: ".md"
slugSeparator: "_"
siteLocalDir: ""
siteImagesDir: "assets/{slug}/"
imageTag: "![{alt}]({relativeSiteSrc})"
relativeImagePath: true
  1. On Mac OS X based Atom I do a "Cmd-Shift-3" to copy a screenshot and then do a "Cmd-Shift-I" to copy the screenshot into a project specific folder configured.

  2. With a filename "testnospace.md" I happen to get the following link and a file in assets/testnospace/a.png as intended and expected

# Test No Space In Filename
![a](assets/testnospace/a.png)
  1. With a filename "test space.md" I happen to get the follwing link and a file in "assets/test space/a.png" which is not what I intended or expected. I know that I expect {slug} to be computed from the filename.
test one:
![a](assets/test space/a.png)
  1. I tried to set the slug manually by adding the slug defintion to frontmatter:
---
slug: test_space
---
test one:
![a](assets/test space/a.png)

test two with manual slug in frontmatter:
![b](assets/test space/b.png)

Expected behavior
I expected the following content after doing the clipboard screenshot and a paste of the clipboard to Atom. {slug} with filename spaces replaced by slugSeparator is expected. Am I missing something here or is it a bug?

test one:
![c](assets/test_space/c.png)
@zhuochun
Copy link
Owner

zhuochun commented Apr 7, 2022

Currently, filename is assumed to be slug-ed and used directly to {slug} placeholder.

But agree, front matter slug should be respected.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants