Angus Hollands
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Extensible MyST Exporters > [!Caution] > This has migrated to the JB team notes: https://hackmd.io/@jupyterbook/Skq85ZqvWl --- > [!Important] > This proposal builds upon "Universal AST" — https://hackmd.io/q0KUwIf_TLCgMyEORaK8kA?both > [!Note] TLDR > 1. MyST exporters are hard-coded (pdf, typst, etc.) — the list of export formats cannot be extended[^patch]. > 2. Static exports are configured by templates that weave together rendered AST (e.g. raw Typst, raw LaTeX) — the rendering step is not configurable by users[^patch]. > 3. By lifting exporters out of `mystmd` and using the same template mechanism as `site.template`, we can simplify `mystmd` and make exporters customisable. This document provides an async scratch-pad to discuss the a "Universal AST" in the MyST Engine. At a high-level, I am effectively proposing that we recognise the status-quo rather than build out anything massively new. [^patch]: Without patching `mystmd`, that is. ## Context The MyST Document Engine supports a range of export targets, including LaTeX and Typst. These exporters are vendored into the `mystmd` binary, and perform most of the export process, making it difficult for end-users to customise the process. For example, it is not possible to change the way that `mystmd` renders an `aside` directive into Typst, or a `figure` in LaTeX. Whilst export templates provide some support for customisation, this is limited to post-processing the rendered markup, rather than programatic access to the document state. Similarly, it is not trivially possible to add _new_ export targets to the MyST Document Engine. For example, there is an `ipynb` exporter being developed as a PR (https://github.com/jupyter-book/mystmd/pull/1882) but this is blocked on maintainer review. It is already fairly functional, yet due to the requirement that it is merged into `mystmd` its value is not being realised (and un-merged PRs atrophy!) Though a long-term view should be to make common features easily configurable, a near-term improvement to the situation would be to permit power-users to customise this behaviour in code whilst the project builds towards better customisation. In both cases, the pathway to resolving this could include giving the MyST Engine _less_ to do, by generalising and separating the export logic. `mystmd` implements support for different exporters in different ways. To build a site, `mystmd` populates a directory with files that a simple static file server can serve (plus a websocket). The theme then consumes this content via the web server. Meanwhile, the static exports are invoked directly within the `mystmd` binary, running AST specialisation before unvoking the typesetting tools. ## Proposal We have had a number of discussions about the difficulty in using consistent language between MyST Web Applications (themes) and the static document exporters. This is a symptom of the fact that these exports do not share a common pathway. The [Universal AST proposal](https://hackmd.io/q0KUwIf_TLCgMyEORaK8kA?both) ultimately argues that we should establish a "lossless" web-first export for MyST that _other_ export types can build atop of. This paves the way for making the MyST Engine _simpler_ and _easier to extend_, by establishing a handover point between the MyST Document Engine and an "exporter". This document proposes the following: 1. (Re)design a common interface for handing off to an external exporter. 2. Tease out the LaTeX and Typst exporters into new `mystmd` packages. This would permit third-party contributors to easily extend and configure static exports, e.g. to import different LaTeX packages or render `aside` in a different way. I'm _not_ necessarily proposing that `_build/site` is exactly the format that we want. It _might_ be that `_build/site/content` + `config.json` is all we need, though. What might this look like? The implications of this are: 1. PDF Templates like https://github.com/myst-templates/lapreprint-typst become _applications_. 2. The Jupyter Book team will lift the `myst-cli` logic for PDF and Typst exports into new `myst-export-typst` and `myst-export-pdf` packages that use the `myst-to-typst` and `myst-to-latex` packages. These exporters will _continue_ to support the basic JTeX templating features. 3. The existing exporter templates can be extended to support definition of an `exporter` field that points to the `myst-export-XXX` package, or the MyST Document Engine will infer the value as it already does. 4. `myst-export-typst` etc. can define extension points for loading custom AST renderers _without_ building a new application. Incidentally, this helps resolve some of the problems concerning language and architectural asymmetry that we have surrounding the "template" language / system. > [!Important] To Do > Explicitly establish the way that this would work. Will it be painful to publish _templates_ (if we use that mechanism) from `mystmd`? ## Related Issues - https://github.com/jupyter-book/mystmd/issues/576 - https://github.com/jupyter-book/mystmd/issues/2299 - https://github.com/jupyter-book/mystmd/issues/1801 - https://github.com/jupyter-book/mystmd/issues/2296 - https://github.com/jupyter-book/mystmd/issues/2162

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully