damiankorcz / Prism-Theme

A Comprehensive, Highly-Customisable and Elegant Light/Dark Theme for Obsidian.md
https://www.buymeacoffee.com/DamianKorcz
MIT License
369 stars 13 forks source link

Mark Shortcuts #149

Closed ShahriarKh closed 8 months ago

ShahriarKh commented 8 months ago

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>" },); } } }

3. Open `.obsidian/plugins/obsidian-text-format/data.json` and add the styles:
```json
{
  ...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!
damiankorcz commented 8 months ago

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 commented 8 months ago

That's very kind of you