How was John the Baptist, as a child, protected from Herod's soldiers? At Matthew 2:16 (RSVCE) we read:


  Then Herod, when he saw that he had been tricked by the wise men, was in a furious rage, and he sent and killed all the male children in Bethlehem and in all that region who were two years old or under, according to the time which he had ascertained from the wise men.


Now, the village of Ein Karem  (also Ain Karem) where John the Baptist is believed to have been born, is in the neighborhood of southwest Jerusalem. Naturally, his place would have also been targeted by Herod's soldiers. Are there any authentic writings, say in the collections of Catholic Church, on how the child John was protected from the soldiers?
There is a document called the protoevangelium (prequel to the gospel) of St James, the earliest copy of which is said to be third century.

This describes it in more detail.

Chapter 22 verse 3 says


  But Elizabeth when she heard that they sought for John, took him and went up into the hill-country and looked about her where she should hide him: and there was no hiding-place. And Elizabeth groaned and said with a loud voice: 0 mountain of God, receive thou a mother with a child. For Elizabeth was not able to go up. And immediately the mountain clave asunder and took her in. And there was a light shining alway for them: for an angel of the Lord was with them, keeping watch over them. 


It goes on to say Zacharias, John's father, was subsequently killed for refusing to reveal John's whereabouts.

This is not regarded as canonical. 

Ein Karem is about five miles from Bethlehem though, so would not necessarily have been included in the death zone.