mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 22:22:51 +09:00
Method and property support
This commit is contained in:
parent
351f306cd9
commit
4cabbe1668
@ -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 New Issue
Block a user