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

Disable syntax highlighting when raw theme is set to none #4175

Closed
DrGo opened this issue May 17, 2024 · 12 comments · Fixed by #4256
Closed

Disable syntax highlighting when raw theme is set to none #4175

DrGo opened this issue May 17, 2024 · 12 comments · Fixed by #4256
Labels
feature request New feature or request styling About set and show rules or style properties

Comments

@DrGo
Copy link

DrGo commented May 17, 2024

Description

There does not seem to be an obvious way to remove syntax highlighting from code (raw) blocks without altering the source.
It would be great if there is a way to disable syntax highlighting in Typst itself: e.g.,
#set raw(lang: none)

Use Case

The current solution (removing the language specifier from the source) interferes with other uses of that specifier, e.g., in mdbook, code blocks need to be annotated with the language specifier to enable e.g., testing the code blocks. The other solution #show raw.line: it => it.text seems hacky and not obvious. Most users will expect setting raw(lang:none) to disable syntax highlighting.

@DrGo DrGo added the feature request New feature or request label May 17, 2024
@Enivex Enivex added the duplicate This issue or pull request already exists label May 24, 2024
@Enivex
Copy link
Collaborator

Enivex commented May 24, 2024

Duplicate of #4182 I believe

@Enivex Enivex closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2024
@DrGo
Copy link
Author

DrGo commented May 24, 2024

Sorry but I do not believe this is a duplicate
I am able to set lang to none; it just does not disable syntax highlighting, forcing the hack I mentioned above
https://typst.app/project/pIpd6tZZ3aPFZb6BSkXLfO

@laurmaedje
Copy link
Member

@DrGo it's sort of a half-duplicate. the issue doesn't really describe the bug, but in the PR discussion for that issue, we've come to the conclusion that theme: none should disable highlighting. I guess we can reopen this issue to track that. See #4186 (review)

@laurmaedje laurmaedje reopened this May 24, 2024
@laurmaedje laurmaedje changed the title An obvious way to remove syntax highlighting from code (raw) blocks without altering the source. Disable syntax highlighting when raw theme is set to none May 24, 2024
@DrGo
Copy link
Author

DrGo commented May 24, 2024

I see.. thanks,

@DrGo
Copy link
Author

DrGo commented May 24, 2024

@laurmaedje
Happy to close the issue... theme=none solves my problem. Thanks again

@laurmaedje
Copy link
Member

theme: none isn't yet implemented though and the PR also doesn't directly implement it. Rather, it changes the default from none to auto because it's currently confusingly none even though it means default theme rather than no theme.

@DrGo
Copy link
Author

DrGo commented May 24, 2024

Is anyone working on implementing theme:none? I could try to submit a PR if that's ok with you.

@laurmaedje
Copy link
Member

I'm not aware of someone else working on it unless @Coekjan is. I merged #4186 now, so there shouldn't be a conflict with that.

@Coekjan
Copy link
Contributor

Coekjan commented May 25, 2024

I am not working on none theme. No conflicts with me.

To implement none, you could take a look at my changes it in #4186, and adapt the function signature for none.


EDIT: I am trying to implement it.

@Enivex Enivex added styling About set and show rules or style properties and removed duplicate This issue or pull request already exists labels May 25, 2024
@DrGo
Copy link
Author

DrGo commented May 25, 2024

Thanks,
presumably, the theme should be now declared Smart<Option<EcoString>>and fn highlight(&self, styles: StyleChain) -> Vec<Packed<RawLine>> would be restructured to handle Smart::Custom(None). Right?
Anything else I should be aware of?

@Coekjan
Copy link
Contributor

Coekjan commented May 25, 2024

I am not working on none theme. No conflicts with me.

To implement none, you could take a look at my changes it in #4186, and adapt the function signature for none.


EDIT: I am trying to implement it.

Here I edited the comment and the PR has been sent. @DrGo

@DrGo
Copy link
Author

DrGo commented May 25, 2024

OK. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request styling About set and show rules or style properties
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants