-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
📚 Allow multiple pages in typst export #844
Conversation
ExportFormats.tex, | ||
ExportFormats.typst, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fwkoch I am not actually sure we should add this, can you confirm?
@@ -261,12 +262,13 @@ export async function localArticleToTypstTemplated( | |||
const includeFileBases = results.map((result, ind) => { | |||
const base = `${name}-${content[ind]?.slug ?? ind}${ext}`; | |||
const includeFile = path.format({ dir, ext, base }); | |||
writeFileToFolder(includeFile, result.value); | |||
const exports = renderTypstImports(false, collected); | |||
writeFileToFolder(includeFile, `${versionString}\n\n${exports}\n\n${result.value}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typst exports on different pages need to also have imports in each page.
@@ -29,6 +29,7 @@ export async function resolvePageExports(session: ISession, file: string) { | |||
ExportFormats.docx, | |||
ExportFormats.pdf, | |||
ExportFormats.tex, | |||
ExportFormats.typst, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add to the site 👍
@@ -3,18 +3,18 @@ import type { TypstTemplateImports } from '../types.js'; | |||
import { writeFileToFolder } from 'myst-cli-utils'; | |||
|
|||
export function renderTypstImports( | |||
output: string, | |||
output: string | false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this stops writing myst.typ
multiple times for multi-page export. Shouldn't be false
in other cases.
writeFileToFolder(mystTypst, macros.join('\n\n')); | ||
} | ||
importStatements.push('#set math.equation(numbering: "(1)")'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this moved to the template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
@@ -261,12 +262,13 @@ export async function localArticleToTypstTemplated( | |||
const includeFileBases = results.map((result, ind) => { | |||
const base = `${name}-${content[ind]?.slug ?? ind}${ext}`; | |||
const includeFile = path.format({ dir, ext, base }); | |||
writeFileToFolder(includeFile, result.value); | |||
const exports = renderTypstImports(false, collected); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, a bit tedious we have to add these here, but they get added to the main page during render... but makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was a bit suprised.
This allows for multi-page exports for typst