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

feat(typlite): render context block contextually #1305

Merged
merged 13 commits into from
Feb 19, 2025

Conversation

hongjr03
Copy link
Contributor

@hongjr03 hongjr03 commented Feb 17, 2025

  • Better contexual render

    I introduced an EcoString to store the codes of nodes that result in Value::None (excluding Ident | Bool | Int | Float | Numeric | Str | Array | Dict and Hash at the beginning of #context) that appear before a Contextual node. Then prepend the buffer to the Contextual node to render in right environment.

    Add assets_path and assets_src_path to args and TypliteFeat, support render contexual code to external svg file.

Variable names were chosen quickly and are not ideal apparently, sorry for that :(

@hongjr03 hongjr03 force-pushed the better-contextual-render branch from fe8da10 to b6779b2 Compare February 18, 2025 06:43
@hongjr03 hongjr03 force-pushed the better-contextual-render branch from b6779b2 to cf0cb14 Compare February 18, 2025 06:44
Ident | Bool | Int | Float | Numeric | Str | Array | Dict
)
{
self.prepend_code += node.clone().into_text();
Copy link
Owner

@Myriad-Dreamin Myriad-Dreamin Feb 19, 2025

Choose a reason for hiding this comment

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

The code here has bad performance. Assuming there are $O(N)$ statements in your document and you render typst code many times, the prepend_code will copy the content in $O(N^2 \log N)$ of time complexity.

@Myriad-Dreamin Myriad-Dreamin merged commit 55f8392 into Myriad-Dreamin:main Feb 19, 2025
15 checks passed
@Myriad-Dreamin Myriad-Dreamin changed the title feat: better contextual render feat(typlite): render context block contextually Feb 19, 2025
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.

2 participants