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

🔗 Enable external MyST project cross-references #1180

Merged
merged 30 commits into from
May 7, 2024
Merged

Conversation

fwkoch
Copy link
Member

@fwkoch fwkoch commented May 4, 2024

This PR adds support for cross-references to external MyST projects, similar to intersphinx.

To do this, MyST projects serve a myst.xref.json file which contains all the available project targets. Then, when you add a reference to this project in your project config:

project:
  references:
    key: https://external-myst-project.org
  ...

you may add cross-reference links with the format [](xref:key/path#identifier).

This PR also:

  • updates intersphinx to use the same syntax xref:... instead of myst:... (old syntax generates a warning)
  • adds label to page frontmatter for specifying an identifier for the page that is not just the filename/slug
    • name is now an alias of label on page frontmatter
    • name is removed from project frontmatter
  • warns on duplicate identifiers within a MyST project (we previously only warned on duplicate identifiers within a page)
  • checks all links in your MyST project to make sure they all have link text (if a link has no text, nothing will be clickable in your site - nice to surface this issue to the author)

See also:

TODO:

  • Support these xrefs with {embed} (separate PR)
  • Get project title instead of index page title from <xref:key> (separate PR)
  • Replace default xref text for link of format <xref:key#id>
  • Deprecate identifier on crossReference, etc nodes in favour of target (separate PR)
  • Tidy up myst.xref.json - no duplicate identifier/html_id, no page slug identifiers
    • keep page identifiers though, if they are explicit!
  • Better docs!

Copy link
Member

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

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

A few quick thoughts on improving the clarity of the docs here. This is looking super cool!

docs/external-references.md Outdated Show resolved Hide resolved
docs/external-references.md Outdated Show resolved Hide resolved
docs/external-references.md Outdated Show resolved Hide resolved
docs/external-references.md Outdated Show resolved Hide resolved
docs/external-references.md Outdated Show resolved Hide resolved
Co-authored-by: Chris Holdgraf <choldgraf@berkeley.edu>
@choldgraf
Copy link
Member

Just noting that the deploy preview on Netlify seems borked:

CleanShot 2024-05-06 at 15 33 44@2x

Noting here in case something in this PR has added a bug to the static HTML export...

@rowanc1
Copy link
Member

rowanc1 commented May 6, 2024

Turns out that the myst build --html is actually currently broken. Something to look into!

@rowanc1
Copy link
Member

rowanc1 commented May 7, 2024

@rowanc1 rowanc1 merged commit ab863c8 into main May 7, 2024
5 checks passed
@rowanc1 rowanc1 deleted the feat/myst-xref-json branch May 7, 2024 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants