Skip to content

Support custom conceal maps #371

Open
@llakala

Description

@llakala

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions