mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-28 21:16:43 -06:00
Method and property support
This commit is contained in:
parent
351f306cd9
commit
4cabbe1668
2 changed files with 34 additions and 0 deletions
|
@ -240,6 +240,33 @@ const elements = [
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// method
|
||||||
|
code => {
|
||||||
|
const match = code.match(/^([a-zA-Z_-]+?)\(/);
|
||||||
|
if (!match) return null;
|
||||||
|
|
||||||
|
if (match[1] == '-') return null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
html: `<span class="method">${match[1]}</span>`,
|
||||||
|
next: match[1].length
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// property
|
||||||
|
(code, i, source) => {
|
||||||
|
const prev = source[i - 1];
|
||||||
|
if (prev != '.') return null;
|
||||||
|
|
||||||
|
const match = code.match(/^[a-zA-Z_-]+/);
|
||||||
|
if (!match) return null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
html: `<span class="property">${match[0]}</span>`,
|
||||||
|
next: match[0].length
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
// symbol
|
// symbol
|
||||||
code => {
|
code => {
|
||||||
const match = symbols.filter(s => code[0] == s)[0];
|
const match = symbols.filter(s => code[0] == s)[0];
|
||||||
|
|
|
@ -141,6 +141,13 @@ pre > code
|
||||||
font-style italic
|
font-style italic
|
||||||
//text-decoration underline
|
//text-decoration underline
|
||||||
|
|
||||||
|
.method
|
||||||
|
font-style italic
|
||||||
|
color #8964c1
|
||||||
|
|
||||||
|
.property
|
||||||
|
color #a71d5d
|
||||||
|
|
||||||
mk-locker
|
mk-locker
|
||||||
display block
|
display block
|
||||||
position fixed
|
position fixed
|
||||||
|
|
Loading…
Reference in a new issue