Skip to content

Commit

Permalink
feat: added a and span tag for default patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausMikhaelson committed Nov 13, 2023
1 parent 9571608 commit e8c402e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function newLinestyles(matchingString: string) {

function renderTextStyles(matchingString: string) {
const pattern =
/<PUSHText color=["']?(#[0-9A-Fa-f]{3,6}|[a-zA-Z]+)["']?>(.*?)<\/PUSHText>/i;
/<span color=["']?(#[0-9A-Fa-f]{3,6}|[a-zA-Z]+)["']?>(.*?)<\/span>/i;
const match = matchingString.match(pattern);

if (match) {
Expand Down Expand Up @@ -56,7 +56,7 @@ function renderTextStyles(matchingString: string) {

function renderLinkWithColor(matchingString: string) {
const pattern =
/<PUSHText color=["']?(#[0-9A-Fa-f]{3,6}|[a-zA-Z]+)["']?\s+link=["'](https?:\/\/[^"']+)["']>(.*?)<\/PUSHText>/i;
/<a color=["']?(#[0-9A-Fa-f]{3,6}|[a-zA-Z]+)["']?\s+href=["'](https?:\/\/[^"']+)["']>(.*?)<\/a>/i;
const linkPattern = /\[([^\]]+)]\((https?:\/\/[^)]+)/;
const match = matchingString.match(pattern);
const markdownLinkPattern = matchingString.match(linkPattern);
Expand Down Expand Up @@ -244,13 +244,13 @@ const DEFAULT_PATTERNS: CustomParseShape[] = [
},
{
pattern:
/<PUSHText color=["']?(#[0-9A-Fa-f]{3,6}|[a-zA-Z]+)["']?>(.*?)<\/PUSHText>/gi,
/<span color=["']?(#[0-9A-Fa-f]{3,6}|[a-zA-Z]+)["']?>(.*?)<\/span>/gi,
style: {}, // we can add aditional styles here if needed
renderText: renderTextStyles,
},
{
pattern:
/<PUSHText color=["']?(#[0-9A-Fa-f]{3,6}|[a-zA-Z]+)["']?\s+link=["'](https?:\/\/[^"']+)["']>(.*?)<\/PUSHText>/gi,
/<a color=["']?(#[0-9A-Fa-f]{3,6}|[a-zA-Z]+)["']?\s+href=["'](https?:\/\/[^"']+)["']>(.*?)<\/a>/gi,
style: {}, // can Add additional styles here if needed
renderText: renderLinkWithColor,
},
Expand Down

0 comments on commit e8c402e

Please sign in to comment.