-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(contented-pipeline-md): parse
%20
as space (#582)
#### What this PR does / why we need it: Parse `%20` as space for `RemarkLink.ts`, also, add test for `truncate`.
- Loading branch information
Showing
6 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...ages/contented-pipeline-md/fixtures/20-Heading/40-Section Title/200-DeepLink.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# DeepLinke | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ege. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Remark Frontmatter | ||
|
||
This is a test file with frontmatter where `title` and `description` will automatically be extracted if they are | ||
present and not explicitly set in the `---` configuration. This is useful for SEO purposes where descriptions and | ||
titles are important but not always explicitly set in the markdown frontmatter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
# `RemarkLink.ts` | ||
|
||
`RemarkLink.ts` will automatically link to other markdown files in your repository. | ||
|
||
## Test Links | ||
|
||
- [20-Heading/100-RemarkLinked.md](20-Heading/100-RemarkLinked.md) | ||
- [01-RemarkLinked.md](01-RemarkLinked.md) | ||
- [RemarkLink.md](RemarkLink.md) | ||
- [Contented](https://contented.dev) | ||
- [20-Heading/100-RemarkLinked.md](./20-Heading/100-RemarkLinked.md) | ||
- [20-Heading/40-Section Title/200-DeepLink.md](./20-Heading/40-Section%20Title/200-DeepLink.md) | ||
- [01-RemarkLinked.md](./01-RemarkLinked.md) |
35 changes: 35 additions & 0 deletions
35
packages/contented-pipeline-md/src/plugins/RemarkFrontmatter.unit.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { join } from 'node:path'; | ||
|
||
import { MarkdownPipeline } from '../MarkdownPipeline'; | ||
|
||
const rootPath = join(__dirname, '../../fixtures'); | ||
|
||
const pipeline = new MarkdownPipeline(__dirname, { | ||
type: 'Markdown', | ||
pattern: ['/20-Heading/*.md', '/01-RemarkLinked.md', '/RemarkLink.md'], | ||
processor: 'md', | ||
}); | ||
|
||
beforeAll(async () => { | ||
await pipeline.init(); | ||
}); | ||
|
||
it('should process RemarkFrontmatter.md', async () => { | ||
const content = await pipeline.process(rootPath, 'RemarkFrontmatter.md'); | ||
expect(content).toStrictEqual([ | ||
{ | ||
type: 'Markdown', | ||
fields: { | ||
title: 'Remark Frontmatter', | ||
description: | ||
'This is a test file with frontmatter where title and description will automatically be extracted if they are present and not explicitly set in the --- configuration. This is useful for SEO purposes where descriptions and titles are important but n...', | ||
}, | ||
headings: expect.any(Array), | ||
sections: [], | ||
path: '/remark-frontmatter', | ||
fileId: expect.stringMatching(/[0-f]{64}/), | ||
modifiedDate: expect.any(Number), | ||
html: expect.any(String), | ||
}, | ||
]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters