# Input a text by the command in newenvironment

I want to have something like this but I can't figure out how I can achieve it.

\begin{sidenote}
Text
\end{sidenote}


I want to create this environment using newenvironment. What I want to do is the text in the begin-end should be fed to the command \marginnote. So I need to get

\marginnote{Text}


whenever I put the text in a sidenote environment.

• There is a package for sidenotes, as far as I know – user31729 Dec 30 '16 at 15:56

\documentclass{article}