forked from FoundKeyGang/FoundKey
add position, scale, fg and bg MFM functions
This commit is contained in:
parent
51b95e272c
commit
59c880b909
2 changed files with 28 additions and 1 deletions
|
@ -71,6 +71,22 @@
|
|||
}
|
||||
}
|
||||
|
||||
.mfm-position {
|
||||
transform: translate(calc(var(--mfm-x, 0) * 1em), calc(var(--mfm-y, 0) * 1em));
|
||||
}
|
||||
|
||||
.mfm-scale {
|
||||
transform: scale(var(--mfm-x, 1), var(--mfm-y, 1));
|
||||
}
|
||||
|
||||
.mfm-fg {
|
||||
color: var(--mfm-color, #f00);
|
||||
}
|
||||
|
||||
.mfm-bg {
|
||||
background-color: var(--mfm-color, #0f0);
|
||||
}
|
||||
|
||||
.markdown-container {
|
||||
blockquote {
|
||||
display: block;
|
||||
|
|
|
@ -17,6 +17,9 @@ const sanitizerOptions = {
|
|||
span: {
|
||||
'--mfm-speed': [/^\d*\.?\d+m?s$/],
|
||||
'--mfm-deg': [/^\d*\.?\d+$/],
|
||||
'--mfm-x': [/^\d*\.?\d+$/],
|
||||
'--mfm-y': [/^\d*\.?\d+$/],
|
||||
'--mfm-color': [/^#([0-9a-f]{3}){1,2}$/i],
|
||||
},
|
||||
},
|
||||
allowedSchemes: sanitizeHtml.defaults.allowedSchemes.concat([ 'gopher', 'gemini' ]),
|
||||
|
@ -259,7 +262,15 @@ marked.use({
|
|||
if (arg.includes('=')) {
|
||||
// split once at first equal sign
|
||||
const equalsIdx = arg.indexOf('=');
|
||||
return [arg.slice(0, equalsIdx), arg.slice(equalsIdx + 1)];
|
||||
const key = arg.slice(0, equalsIdx);
|
||||
let value = arg.slice(equalsIdx + 1);
|
||||
|
||||
// add initial octothorpe to hex color code if necessary
|
||||
if (key === 'color' && !value.startsWith('#')) {
|
||||
value = '#' + value;
|
||||
}
|
||||
|
||||
return [key, value];
|
||||
} else {
|
||||
return [arg, null];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue