The story, which dates in writing as early as the 10th century, is variously said to have occurred in Fatimid Egypt[17][18][19] or in the Umayyad Caliphate in Damascus, Syria, where Levantine dessert makers preparing it for Mu'awiya I.
[20][21] Ibn Sayyar al-Warraq's tenth century Arabic cookbook, Kitab al-Tabikh (Book of Dishes), which documented many recipes from Abbasid courts, does not mention or describe knafeh.
[22][4] The 13th century anonymous cookbook, Kitab al tabikh fi-l-Maghrib wa-l-Andalus (Book of Dishes from Maghreb and Al-Andalus), however, gives a number of recipes for knafeh, which it describes as a pancake dumpling thinner that qatayif prepared on a flag pan.
[23][4] Ibn al-Jazari gives an account of a 13th-century Mamluk period market inspector who rode through Damascus at night ensuring the quality of knafeh, qatayif, and other foods associated with Ramadan.
[24] Over time, new knafeh preparation methods were developed, including a technique of dripping thin batter onto a metal sheet from a perforated container, creating hair-like strings.
A mid-15th century Ottoman Turkish translation of Muhammad bin Hasan al-Baghdadi's Kitab al-Tabikh added several new contemporary knafeh recipes, though it does not specify where they originated from.
[5] Nablus is still renowned in for its knafeh, which "is filled with the city’s trademark firm, white, salty nabulsi cheese" and covered with sweet syrup.