(input: string)
| 30 | * The compile function takes something as input and caches it. |
| 31 | */ |
| 32 | const compile = async (input: string): Promise<[string, Meta]> => { |
| 33 | const digest = hash(input).toString(); |
| 34 | if (cache.has(digest)) { |
| 35 | return JSON.parse(cache.get(digest)); |
| 36 | } |
| 37 | const result = await compileMarkdown( |
| 38 | input, |
| 39 | config.compiler, |
| 40 | utils.markdown_cache, |
| 41 | false |
| 42 | ); |
| 43 | cache.set(digest, JSON.stringify(result)); |
| 44 | return result; |
| 45 | }; |
| 46 | |
| 47 | return { |
| 48 | name: "vite-tinypages-markdown", |