how transcode python doc strings github readme.md
?
even though seems does, cannot seem decent solution , assuming should easy, seems unlikely folks going throw 2 converters…
what have tried
pydoc simple. output of pydoc manpages (groff format unix systems). dead end man md not thing. via html, pydoc3 -w
+ pandoc, utterly munges docstrings bits.
custom code there seems lots of short custom code, few tried output not seem pydoc, has summary, adds inherited methods , lists attributes.
mkdocs. suggested somewhere. pollutes folder misleading name not docstrings > md converter, md > html.
sphinx + pandoc. after fixing utf-8 issue, gave on sphinx have single py script convert , autodoc setting of quickstart did not parse script. tried in python import sphinx.ext.autodoc
tbh documentation long , gave up.
nb
there [year-old unanswered question] (automatically generate github wiki documentation python docstrings) on topic, hope giving lot more detail answer.
i have little bit of code use generate index file project. it's not you're looking for, little wiggle add if statement py files (where have html , png) , grab doc = "your docstrings."... https://gist.github.com/krewn/6e9acdadddb4bf2a56c0
# warning running file overide existing readme.md file in cwd import os class indexer: path = "~" username = "" # !!! enter github username in provided quotes. site = "http://"+username+".github.io" proj = "" # !!! enter repository name in provided quotes. prod = [] loc=[] def __init__(self,p): self.path=p def fprep(self,name): name.replace(".","") name.replace("\\","/") return(name) def refprep(self): ref = self.site+"/"+self.proj qw in self.loc: ref+="/"+qw return(ref) def htmlfrek(self,adir): self.loc.append(adir) os.chdir(adir) pys = [f f in os.listdir('.') if os.path.isfile(f) , f.split(".")[len(f.split("."))-1]=="py"] in pys: open file __doc__ string , append ret k in folders: if(k.__contains__(".")): continue ret+=self.htmlfrek(k) os.chdir("..") del self.loc[len(self.loc)-1] return(ret) def htmlprod(self): ret = "" pys = [f f in os.listdir('.') if os.path.isfile(f) , f.split(".")[len(f.split("."))-1]=="py"] in pys: open file __doc__ string , append ret folders = [f f in os.listdir(".") if not os.path.isfile(f)] k in folders: if(k.__contains__(".")): continue ret+=self.htmlfrek(k) self.prod = ret return(ret) = indexer(".") q=i.htmlprod() #print i.prod w = open("readme.md","w") w.write(q) w.close()
Comments
Post a Comment