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

Add the \markdownImportSnippets LaTeX command #107

Closed
Tracked by #120
Witiko opened this issue Nov 10, 2021 · 3 comments · Fixed by #286
Closed
Tracked by #120

Add the \markdownImportSnippets LaTeX command #107

Witiko opened this issue Nov 10, 2021 · 3 comments · Fixed by #286
Labels
latex Related to the LaTeX interface and implementation quality of life Related to quality-of-life improvements to the interface
Milestone

Comments

@Witiko
Copy link
Owner

Witiko commented Nov 10, 2021

Suppose the jdoe/verylongpackagename/lists LaTeX theme defines the arabic, roman, and alphabetic setup snippets. If we want to access these snippets by their unqualified names, we must import them:

\markdownSetupSnippet{arabic}{snippet=jdoe/verylongpackagename/lists/arabic}
\markdownSetupSnippet{roman}{snippet=jdoe/verylongpackagename/lists/roman}
\markdownSetupSnippet{alphabetic}{snippet=jdoe/verylongpackagename/lists/alphabetic}

This is quite long and prone to typos. We may want to provide syntactic sugar:

\markdownImportSnippets{jdoe/verylongpackagename/lists}{arabic, roman, alphabetic}
@Witiko Witiko added latex Related to the LaTeX interface and implementation quality of life Related to quality-of-life improvements to the interface labels Nov 10, 2021
@Witiko Witiko added this to the 2.13.0 milestone Nov 10, 2021
@Witiko
Copy link
Owner Author

Witiko commented Nov 10, 2021

Some LaTeX themes may define snippets with conflicting unqualified names:

\markdownSetupSnippet{arabic1}{snippet=jdoe/verylongpackagename/lists/arabic}
\markdownSetupSnippet{arabic2}{snippet=jdoe/anotherlongpackagename/lists/arabic}
\markdownSetupSnippet{roman}{snippet=jdoe/verylongpackagename/lists/roman}
\markdownSetupSnippet{alphabetic}{snippet=jdoe/verylongpackagename/lists/alphabetic}

Our syntactic sugar may tackle this using the as operator:

\markdownImportSnippets{jdoe/verylongpackagename/lists}{arabic as arabic1, roman, alphabetic}
\markdownImportSnippets{jdoe/anotherlongpackagename/lists}{arabic as arabic2}

@Witiko
Copy link
Owner Author

Witiko commented Mar 30, 2022

Here is an alternative syntax that does not require a separate command:

\markdownSetup{
    importSnippets = {
        jdoe/longpackagename/lists = {
            arabic as arabic1,
            roman,
            alphabetic,
        }, jdoe/anotherlongpackagename/lists = {
            arabic as arabic2,
        },
    },
}

@Witiko Witiko added this to the 3.0.0 milestone Nov 12, 2022
@Witiko Witiko modified the milestones: 3.0.0, 2.20.0, 2.22.0 Dec 28, 2022
@Witiko Witiko modified the milestones: 2.22.0, 3.0.0, 2.23.0 Mar 13, 2023
@Witiko
Copy link
Owner Author

Witiko commented Apr 2, 2023

Here is an alternative syntax that combines loading themes and snippets under a single interface, deprecates the LaTeX theme option.

Here is the current way you would load themes and import snippets from them:

\markdownSetup{theme=jdoe/verylongpackagename/lists}
\markdownSetupSnippet{arabic1}{snippet=jdoe/verylongpackagename/lists/arabic}
\markdownSetupSnippet{roman}{snippet=jdoe/verylongpackagename/lists/roman}
\markdownSetupSnippet{alphabetic}{snippet=jdoe/verylongpackagename/lists/alphabetic}
\markdownSetup{theme=jdoe/anotherlongpackagename/lists}
\markdownSetupSnippet{arabic2}{snippet=jdoe/anotherlongpackagename/lists/arabic}
\markdownSetup{theme=jdoe/yetanotherlongpackagename}

Here is the alternative syntax that gives the same result:

\markdownSetup{
    import = {
        jdoe/longpackagename/lists = {
            arabic as arabic1,
            roman,
            alphabetic,
        },
        jdoe/anotherlongpackagename/lists = {
            arabic as arabic2,
        },
        jdoe/yetanotherlongpackagename,
    },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
latex Related to the LaTeX interface and implementation quality of life Related to quality-of-life improvements to the interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant