Skip to content

Instantly share code, notes, and snippets.

@ellisgl
Created October 6, 2021 01:40
Show Gist options
  • Save ellisgl/87ab3c14f4c12634fa2bb7c1ff224796 to your computer and use it in GitHub Desktop.
Save ellisgl/87ab3c14f4c12634fa2bb7c1ff224796 to your computer and use it in GitHub Desktop.
16 Color support MD?
// Support Color Markdown
data = data.replace(/\{color fg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray)\}([^{]+)\{\/color\}/img, '<span style="color:$1;">$2</span>');
data = data.replace(/\{color bg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray)\}([^{]+)\{\/color\}/img, '<span style="background-color:$1;">$2</span>');
data = data.replace(/\{color fg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray) bg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray)\}([^{]+)\{\/color\}/img, '<span style="color:$1; background-color:$2;">$3</span>');
data = data.replace(/\{color bg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray) fg:(White|Black|Blue|Green|Red|Brown|Purple|Orange|Yellow|LightGreen|Cyan|LightCyan|LightBlue|PinkGray|LightGray)\}([^{]+)\{\/color\}/img, '<span style="color:$2; background-color:$1;">$3</span>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment