fix bugs

no longer use cdn, and export docs as a function.