  Our goal in this article is to prove a form of $p$-adic Birch and
Swinnerton-Dyer formula for the second derivative of the $p$-adic $L$-function
associated to a newform $f$ which is non-crystalline semistable at $p$ at its
central critical point, by expressing this quantity in terms of a $p$-adic
(cyclotomic) regulator defined on an extended trianguline Selmer group. We also
prove a two-variable version of this result for height pairings we construct by
considering infinitesimal deformations afforded by a Coleman family passing
through $f$. This, among other things, leads us to a proof of an appropriate
version of Perrin-Riou's conjecture in this set-up.
