Skip to content

Commit

Permalink
remove prefix from markdown slugify, normalize name with backlinks to…
Browse files Browse the repository at this point in the history
… avoid dups
  • Loading branch information
haveanicedavid committed Apr 16, 2024
1 parent 393aaff commit 16e1a7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/convertors/markdown/markdown-convertor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ describe('isDaily', () => {
describe('id', () => {
it('slugifies filename', async () => {
const convertor = new MarkdownConvertor({graphId: '123'})
const {notes} = await convertor.convert({data: '# foo', filename: 'foo wem.md'})
const {notes} = await convertor.convert({
data: '# Alex MacCaw',
filename: 'Alex MacCaw.md',
})
const [{id}] = notes

expect(id).toEqual('md-foo-wem')
expect(id).toEqual('alexmaccaw')
})
})
2 changes: 1 addition & 1 deletion src/convertors/markdown/markdown-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const dailyDateFromFilename = (filename: string): Date | undefined => {
export const filenameToId = (filename: string) => {
const basename = stripFileExtension(filename)

return `md-${slugify(basename)}`
return `${slugify(basename, {lowercase: true, decamelize: false, separator: ''})}`
}

export const filenameToSubject = (filename: string) => {
Expand Down

0 comments on commit 16e1a7a

Please sign in to comment.