Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vite-plugin-angular): add pipeline to transform analog markdown …
…template (#875)
- Loading branch information
1 parent
f72cabb
commit 789fa06
Showing
4 changed files
with
41 additions
and
11 deletions.
There are no files selected for viewing
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,5 +1,9 @@ | ||
import { angular } from './lib/angular-vite-plugin'; | ||
export { PluginOptions } from './lib/angular-vite-plugin'; | ||
export { compileAnalogFile } from './lib/authoring/analog'; | ||
export { | ||
MarkdownTemplateTransform, | ||
defaultMarkdownTemplateTransforms, | ||
} from './lib/authoring/markdown-transform'; | ||
|
||
export default angular; |
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
21 changes: 21 additions & 0 deletions
21
packages/vite-plugin-angular/src/lib/authoring/markdown-transform.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,21 @@ | ||
export type MarkdownTemplateTransform = ( | ||
content: string, | ||
fileName: string | ||
) => string | Promise<string>; | ||
|
||
export const defaultMarkdownTemplateTransform: MarkdownTemplateTransform = | ||
async (content: string) => { | ||
const { MarkedSetupService } = await import('./marked-setup.service'); | ||
|
||
// read template sections, parse markdown | ||
const markedSetupService = new MarkedSetupService(); | ||
const mdContent = markedSetupService | ||
.getMarkedInstance() | ||
.parse(content) as unknown as Promise<string>; | ||
|
||
return mdContent; | ||
}; | ||
|
||
export const defaultMarkdownTemplateTransforms: MarkdownTemplateTransform[] = [ | ||
defaultMarkdownTemplateTransform, | ||
]; |
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