Skip to content

Feature request: Support keyword/link parsing #147

Answered by Maxou44
Maxou44 asked this question in Q&A
Discussion options

You must be logged in to vote

I was able to parse my usernames correctly 🎉
Thanks for your help!

// This plugin merge all string chunks into a single string
const mergeStringsPlugin = (tree) => {
	let stringsBuffer = []
	return tree.reduce((acc, node, i) => {
		// Is a string
		if (isStringNode(node) && i !== tree.length - 1) {
			stringsBuffer.push(node)
			return acc
		}

		// Detect end of concat string
		if (i === tree.length - 1 || !isStringNode(node)) {
			const out = [...acc, stringsBuffer.join(''), node];
			stringsBuffer = [];
			return out;
		}
		return acc
	}, [])
};

// This plugin takes an array of users that contain a "login" field and create "user" node if it match
const usersParsePlugin = (users) => (tree

Replies: 9 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by JiLiZART
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #146 on September 02, 2022 11:36.