Create an environment that allows you to bold words before a ” : “

comma-separated listenvironmentslistsmacros

(This is my first question, I hope I'm not breaking any rules in how I'm asking it)
I would need an environment that basically takes as input a list of words separated by the ":" symbol and that only bolds what appears before the ":"

Practical example:

If I write in my code

\begin{environment}

pizza: italian food made of (etc...)
dog: animal that is similar to a wolf and (etc...)
John: name of persone that (etc...)
plastic: type of material given by (etc...)

\end{environment}

I would like my output to be:

pizza: italian food made of (etc…)
dog: animal that is similar to a wolf and (etc…)
John: name of persone that (etc…)
plastic: type of material given by (etc…)


In general other ":"s could also appear in the description of the words, so one thing to pay attention to is the fact that it is not condoned (Basically it must be in bold only before the first ":")

I had initially used chatGPT to try to create this environment but despite the various corrections I made to it (it generated a lot of wrong or non-working codes)

Motivation

I already have the list of words defined (there are about 4000 words), I would like to avoid going in front of each word and copying and pasting "\mathbf{}" or any other command like "\item" or similar. I would greatly prefer it if it were therefore an environment that only requires adding code to the beginning and end of the list.

Best Answer

enter image description here

I would probably edit the source rather than do this but...

\documentclass{article}

\newenvironment{environment}
{\obeylines
\everypar{\boldify}%
}
{}
\def\boldify#1:{\textbf{#1: }}
\begin{document}

\begin{environment}

pizza: italian food made of pineapples (etc...)
dog: animal that is similar to a wolf and (etc...)
John: name of persone that (etc...)
plastic: type of material given by (etc...)

\end{environment}


aaa: oops

\end{document}

Related Question