Lun Wenxu was born into a poor family and makes a living by selling vegetables, but he is well-known for being studious and talented. Intending to marry his daughter to Wenxu, the wealthy Hu asks his maid, Ah Xiu, to pay the young man a visit to make a proposal. Wenxu declines but falls in love with the kindhearted maid, who also admires him for his talent. The two promise themselves to each other.
Poor but aspiring, Wenxu produces brilliant impromptu prose at the temple, thoroughly impressing the official Liang Chu. In the imperial palace, his talent further wins the emperor’s admiration. Finally, he outwits his opponent, Liu Xiankai, and becomes the highest-honored scholar of the state. The emperor’s mother orders him to marry the emperor’s daughter. Unwilling to betray Ah Xiu, he would rather give up his title than comply. Though enraged at first, the emperor is subsequently moved by Wenxu’searnest prose about his disdain of fame and fortune. He permits him to go home and marry the maid.
Seeing Wenxu returning in glory, Hu thinks that the top scholar has come to marry his daughter, only to find a happy maid. To make up for Hu’s disappointment, Wenxu makes a match between Miss Hu and Liang Erguan, the new successful candidate of the imperial examination. Wenxu marries Ah Xiu, to the satisfaction of all.