Skip to content

Commit

Permalink
🔧 A couple tweaks for consuming the myst-cli package (#569)
Browse files Browse the repository at this point in the history
* 🔧 Resolve file path in selectFile function
* 🔧 Export linkCheck function
* 🍿 Changeset
  • Loading branch information
fwkoch authored Aug 29, 2023
1 parent 64e941a commit bc3e6a3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-rice-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-cli': patch
---

checkLink is exported
5 changes: 5 additions & 0 deletions .changeset/sweet-dragons-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-cli': patch
---

selectFile resolves the input file path
1 change: 1 addition & 0 deletions packages/myst-cli/src/process/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export async function bibFilesInDir(session: ISession, dir: string, load = true)

export function selectFile(session: ISession, file: string): RendererData | undefined {
const cache = castSession(session);
file = path.resolve(file);
if (!cache.$mdast[file]) {
session.log.error(`Expected mdast to be processed for ${file}`);
return undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/myst-cli/src/transforms/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const skippedDomains = [
'en.wikipedia.org',
];

async function checkLink(session: ISession, url: string): Promise<ExternalLinkResult> {
export async function checkLink(session: ISession, url: string): Promise<ExternalLinkResult> {
const cached = selectors.selectLinkStatus(session.store.getState(), url);
if (cached) return cached;
const link: ExternalLinkResult = {
Expand Down

0 comments on commit bc3e6a3

Please sign in to comment.