I have read two seemingly completely different definitions of formal schemes.
Hartshorne defined a formal scheme as the formal completion of a noetherian scheme $X$ along a closed subscheme $Y$ of $X$.
In Demazure's Lectures on p-Divisible Groups, a $k$-formal scheme is defined to be a left exact covariant functor from the category of finite dimensional $k$-algebras to the category of sets, where $k$ is a field.
Are these two definitions of formal schemes the same (or related to each other)?
(update) Now I have read about the definition in EGA I, which defines an affine formal scheme as the formal spectrum $\mathop{\mathrm{Spf}}(A)$ of an admissible ring $A$. As Murray answered, Demazure defines an affine formal scheme over $k$ as $\mathop{\mathrm{Spf}}(A)$ for some profinite $k$-algebra. It a profinite $k$-algebra always admissible? (It seems to me that this is not true, for example consider the the product of infinitely many $k$. So the definition in EGA is not the most general case?)