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

Mark Shortcuts #149

Closed
ShahriarKh opened this issue Dec 8, 2023 · 2 comments
Closed

Mark Shortcuts #149

ShahriarKh opened this issue Dec 8, 2023 · 2 comments
Assignees
Labels
Documentation Improvements or additions to documentation

Comments

@ShahriarKh
Copy link
Contributor

Hi @damiankorcz
Big thanks for maintaining this awesome theme!

Following #97 for an easier way to mark text, I created a simple script to add all possible styles and allow toggling mark styles with the help of "custom wrapper" functionality of https://github.com/Benature/obsidian-text-format plugin.

I'm posting it here so everyone can use it (this can be added to Wiki too 👀)

Steps:

  1. Install Obsidian Text Foramt plugin
  2. Use this script to generate a list of wanted mark styles:
const colors = [
  { class: "", name: "Accent" },
  { class: "red", name: "Red" },
  { class: "orange", name: "Orange" },
  { class: "yellow", name: "Yellow" },
  { class: "green", name: "Green" },
  { class: "mint", name: "Mint" },
  { class: "cyan", name: "Cyan" },
  { class: "blue", name: "Blue" },
  { class: "purple", name: "Purple" },
  { class: "pink", name: "Pink" },
  { class: "grey", name: "Gray" },
];
const styles = [
  { class: "mark-default", name: "Default" },
  { class: "mark-border", name: "Border" },
  { class: "mark-filled", name: "Filled" },
  { class: "mark-borderandfilled", name: "Border and Filled" },
];
const textStyles = [
  { class: "mark-text-default", name: "Default Text" },
  { class: "mark-text-color", name: "Colored Text" },
];

for (let color of colors) {
  for (let style of styles) {
    for (let textStyle of textStyles) {
      console.log(`{
        "name": "Mark: ${color.name} - ${style.name} - ${textStyle.name}",
        "prefix": "<mark class=\\"${color.class} ${style.class} ${textStyle.class}\\">",
        "suffix": "</mark>"
      },`);
    }
  }
}
  1. Open .obsidian/plugins/obsidian-text-format/data.json and add the styles:
{
  ...other options
  "wrapperList": [
    {
      "name": "Mark: Accent - Default - Default Text",
      "prefix": "<mark class=\" mark-default mark-text-default\">",
      "suffix": "</mark>"
    },
    {
      "name": "Mark: Accent - Border and Filled - Colored Text",
      "prefix": "<mark class=\" mark-borderandfilled mark-text-color\">",
      "suffix": "</mark>"
    },
    {
      "name": "Mark: Red - Default - Colored Text",
      "prefix": "<mark class=\"red mark-default mark-text-color\">",
      "suffix": "</mark>"
    },
    ...
]
}
  1. 🛩 Restart Obsidian and Enjoy!
@ShahriarKh ShahriarKh added the Documentation Improvements or additions to documentation label Dec 8, 2023
@damiankorcz
Copy link
Owner

Hi @ShahriarKh,
Thanks for figuring this out! It's a pretty sleek solution.

I've added the steps to set this up as a separate page in the wiki here:
https://github.com/damiankorcz/Prism-Theme/wiki/Mark-Highlight-Shortcuts-using-the-Text-Format-Plugin

...and added a mention to it in the main guide for the Mark Highlight System here:
https://github.com/damiankorcz/Prism-Theme/wiki/Mark-Highlight-System-Guide

@ShahriarKh
Copy link
Contributor Author

That's very kind of you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants