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

Support custom conceal maps #371

Open
llakala opened this issue Jan 14, 2025 · 0 comments
Open

Support custom conceal maps #371

llakala opened this issue Jan 14, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@llakala
Copy link
Contributor

llakala commented Jan 14, 2025

Description of the Problem

Currently, all of the conceal maps are hardcoded at https://github.com/artisticat1/obsidian-latex-suite/blob/418b355079ad03d2b6d84362df20fb31ca96aa52/src/editor_extensions/conceal_maps.ts. If you add custom Latex functions, which you can do via other plugins, they won't be concealed, and appear like this:
image

Description of the Solution

Obviously, custom commands like this shouldn't be added to the default. Therefore, we need a way to add them in after-the-fact. I propose an option be added, similar to the one seen for changing snippet variables. You could even make it possible to remove default conceals, by making the default value of the conceal option the current default.

To clarify what I mean, here's how the default could look if this was implemented:

{
	"${CMD_SYMBOLS}": {
        "aleph": "ℵ",
	    "amalg": "∐",
        // etc
	"${OPERATORS}": [
		"arcsin",
		"arccos",
		"arctan",
		"sinh",
		// etc
	],
	"${OPERATORS}": {
		"{1}{2}": "½",
		"{1}{3}": "⅓",
		"{2}{3}": "⅔",
        // etc
};

And so on, with the ability to customize each element within the linked file. I think you should be able to customize each existing variable in the file, which would give you this list:

  • symbols
  • operators
  • fractions
  • greek
  • super
  • sub
  • bar
  • dot
  • hat
  • brackets
  • mathbb
  • mathscrcal
  • mathfrak

I'll admit some of these make less sense than others when it comes to customizing them. But I think it makes more sense to support customizing everything, than only customizing certain fields that we arbitrarily decide are worth it, especially since simply reading from more variables would be fairly trivial.

Additional

I can't think of any other options that accomplish the same goal. You could set up lots of different options for each of the elements in the file, rather than one input with variables. I think that's silly, though. Using variable keeps the code light.

If nobody gets around to it, I can make a PR for this in a few weeks when I have time. If you want to beat me to it, feel free!

@llakala llakala added the enhancement New feature or request label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant