-
|
I have a rating inline token which is const rating = {
name: 'rating',
level: 'inline',
start(src) { return src.match(/^[1-5]\*/)?.index; },
tokenizer(src) {
const match = src.match(/^([1-5])\*/);
if (match) {
return {
type: 'rating',
raw: match[0],
rating: parseInt(match[1]),
};
}
}
};This is the source markdown: 1*
2* suffix
_prefix_ 3*
prefix 4*
prefix 5* suffixIt seems to be unable to work if there is text before it. It works if the text is tokenized(like italic or bold) but not if it is plain text. |
Beta Was this translation helpful? Give feedback.
Answered by
ivanjaros
Aug 17, 2024
Replies: 1 comment 2 replies
-
|
Your start regex has a ^ so it will only match if the text is at the beginning |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

ah, this worked: