Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎭 Support more characters in typst export #1738

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fifty-cougars-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-to-typst': patch
---

Support additional greek characters in typst
7 changes: 5 additions & 2 deletions packages/myst-to-typst/src/utils.ts
Original file line number Diff line number Diff line change
@@ -49,8 +49,8 @@ const textOnlyReplacements: Record<string, string> = {
'©': '#emoji.copyright ',
'®': '#emoji.reg ',
'™': '#emoji.tm ',
'<': '\\< ',
'>': '\\> ',
'<': '\\<',
'>': '\\>',
Comment on lines +52 to +53
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this change did not feel good - I'm not sure why we were previously adding a space after these characters. However, for the examples I was looking at, the addition of this space looked very wrong, and simply removing it here fixed the output.

@rowanc1 perhaps you have some recollection of this...?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets go with an oversight/bug for now.

' ': '~',
' ': '~',
// eslint-disable-next-line no-irregular-whitespace
@@ -105,16 +105,19 @@ const mathReplacements: Record<string, string> = {
'×': 'times',
Α: 'A',
α: 'alpha',
𝜶: 'alpha',
Β: 'B',
β: 'beta',
ß: 'beta',
𝜷: 'beta',
Γ: 'Gamma',
γ: 'gamma',
Δ: 'Delta',
'∆': 'Delta',
δ: 'delta',
Ε: 'E',
ε: 'epsilon',
𝝴: 'epsilon',
Ζ: 'Z',
ζ: 'zeta',
Η: 'H',

Unchanged files with check annotations Beta

import type { DirectiveData, DirectiveSpec, GenericNode } from 'myst-common';
import { RuleId, fileWarn, normalizeLabel } from 'myst-common';

Check warning on line 2 in packages/myst-directives/src/include.ts

GitHub Actions / lint

'normalizeLabel' is defined but never used
import { CODE_DIRECTIVE_OPTIONS, getCodeBlockOptions } from './code.js';
import type { Include } from 'myst-spec-ext';
import type { VFile } from 'vfile';
constructor(opts?: { logger?: Logger }) {
this.log = opts?.logger ?? chalkLogger(LogLevel.debug, process.cwd());
}
fetch(url: URL | RequestInfo, init?: RequestInit | undefined): Promise<Response> {

Check warning on line 10 in packages/myst-cli-utils/src/session.ts

GitHub Actions / lint

'url' is defined but never used

Check warning on line 10 in packages/myst-cli-utils/src/session.ts

GitHub Actions / lint

'init' is defined but never used
throw new Error('fetch not implemented on session');
}
}
import type { JSONSchema7Definition } from 'json-schema';
const LicenseSchema: JSONSchema7Definition = {

Check warning on line 3 in packages/myst-frontmatter/src/licenses/schema.ts

GitHub Actions / lint

'LicenseSchema' is assigned a value but never used
$id: '',
description:
'The license information, which can be either a string or an object with `code` and `content`.',

Check warning on line 7 in packages/myst-transforms/src/links/github.ts

GitHub Actions / lint

'TRANSFORM_SOURCE' is assigned a value but never used

Check warning on line 106 in packages/myst-transforms/src/links/github.ts

GitHub Actions / lint

'file' is defined but never used
import { cleanOutput } from './utils/cleanOutput.js';
import { getFileContent } from './utils/getFileContent.js';
import { resolveFrontmatterParts } from '../utils/resolveFrontmatterParts.js';
import { parseMyst } from '../process/myst.js';

Check warning on line 18 in packages/myst-cli/src/build/cff.ts

GitHub Actions / lint

'parseMyst' is defined but never used
function exportOptionsToCFF(exportOptions: ExportWithOutput): CFF {
// Handle overlap of key "format" between CFF and export
mdast: GenericParent,
references: References,
frontmatter: PageFrontmatter,
templateYml: TemplateYml | null,

Check warning on line 69 in packages/myst-cli/src/build/typst.ts

GitHub Actions / lint

'templateYml' is defined but never used
printGlossaries: boolean,

Check warning on line 70 in packages/myst-cli/src/build/typst.ts

GitHub Actions / lint

'printGlossaries' is defined but never used
) {
const pipe = unified().use(mystToTypst, {
math: frontmatter?.math,
}
};
const { root, defaults, format: _, ...rest } = data;

Check warning on line 335 in packages/myst-cli/src/init/jupyter-book/toc.ts

GitHub Actions / lint

'_' is assigned a value but never used
let result = {
root,
defaults,