nortikin / sverchok

Sverchok
http://nortikin.github.io/sverchok/
GNU General Public License v3.0
2.26k stars 233 forks source link

Documentation #269

Closed wclyffe closed 10 years ago

wclyffe commented 10 years ago

I was wondering about the best way to produce the documentation.

Sphinx seems to be the best fit. It is using restructuredtext, which is similar to markdown. It can generate docs directly from the docstrings in the code, and obviously from whatever file you feed it. Sphinx can also output to html, pdf or even epub.

Besides ReadTheDocs.org can host and update directly from the github repo.

So, I took the opportunity to convert the current documentation to sphinx / restructuredtext to see more clearly what it could look like. (There's many themes you can choose from, or even make your own). It is still rough around the edges (some links, and other things are not correctly formatted yet)

Below are some screenshots of different screen resolution (the theme is responsive)

Oppinions?

screen shot 2014-06-01 at 07 05 37

screen shot 2014-06-01 at 07 04 35

screen shot 2014-06-01 at 07 03 34

screen shot 2014-06-01 at 07 03 08

nortikin commented 10 years ago

@wclyffe thanks. but first of all, it is needed to support images of nodes, if we create complete wiki. more over, we need to stop supporting addones wiki on official blender site http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Nodes/Sverchok and bring all to one place. But i not see direct benefits

wclyffe commented 10 years ago

@nortikin I must say that I didn't looked at the blender wiki site. In general (and that is for all the other addons), it is a bloody mess and not up to date. Usually, the best info is on the blog/site of the addon or blenderartists. I converted only what was in the docs folder, so there's was no images. But that's not a problem to have images in the sphinx documentation. I understand that there's a need to have documentation for all the different nodes (with examples!) For me, the benefits are :

ly29 commented 10 years ago

Good documentation is really needed. I look forward to writing it.

I think there will be some nice surprises for all of us what the nodes the code can actually do.

ly29 commented 10 years ago

I think it would be very nice if you could open the documentation for the active node in a browser directly via a help button in one of the panels. This is a bit down the road of course...

wclyffe commented 10 years ago

About the help button: I think It could be quite straightforward. With a custom attribute on each node and a class method to compose the url to the relevant doc. It could be even be done with some sort of naming convention, and then mirroring the categories in the code and the docs

zeffii commented 10 years ago

my favourite doc theme! I think the Blender docs are getting this treatment too, soon, but it is hush hush.

how does it fare with the table located in vector math node? I'm not going to write restructured text, it's GFM or pure markdown all the way.

rightclick node:

wclyffe commented 10 years ago

@zeffii Restructuredtext: I thought too that it would be a pain, but the syntax is not that different than markdown. And it is way easier to inter/cross link between pages. To ouput one document from several markdown files is not really straightforward. Furthermore, sphinx is made for documenting python code : there's some facilities to extract the documentation from the docstrings directly.

And here's the table: screen shot 2014-06-01 at 09 48 16

wclyffe commented 10 years ago

With this, you can get something like that:

screen shot 2014-06-01 at 10 05 09

enzyme69 commented 10 years ago

Jimmy may be interested to write too.

zeffii commented 10 years ago

@wclyffe cool, i'll use Google style docstrings then!

nortikin commented 10 years ago

So, lets voting for variants. I see there is Sphinx solution, but also blender wiki page. What we need more?

nortikin commented 10 years ago

and i have to understand how to deal with images there

ly29 commented 10 years ago

I think the best idea is to make a test documentation for one node and show how it looks.

zeffii commented 10 years ago

I think the blender wiki page should have a simple link to these documents here, and a full PDF link of the most up to date. People will prefer a link to nice documentation than reading the current implementation of blender wiki, no doubt about it.

zeffii commented 10 years ago

updating docs is much more likely to happen (correctly) if it's only necessary to update in one place.

ly29 commented 10 years ago

@enzyme69 As the defacto English documentation for sverchok your help would be great.

wclyffe commented 10 years ago

I'll push my local branch then as it seems that there's some interest.

wclyffe commented 10 years ago

In the meantime, if you want, you have a look at:

zeffii commented 10 years ago

yes, i'm on windows :)

zeffii commented 10 years ago

pandoc --from=markdown --to=rst --output=README.rst README.md

please implement that, I don't think I can spare the extra attention span of learning rst.

wclyffe commented 10 years ago
zeffii commented 10 years ago

debating this would take more effort than learning rst.

wclyffe commented 10 years ago

Wise words :-)

enzyme69 commented 10 years ago

Is this RST? http://en.wikipedia.org/wiki/ReStructuredText

Let's make it that so each node in Sverchok is explained really well, just like in Houdini.

enzyme69 commented 10 years ago

prtscr capture_24 prtscr capture_23 prtscr capture_22

enzyme69 commented 10 years ago

Of course, it will also be unique-ly Sverchok. If this Add-On really embraced. It's a new language, the way I think of it. Alien for many who never use procedural workflow, parametric, or node, or even code.

wclyffe commented 10 years ago

Yes that is RST. But the examples on wikipedia are quite succinct. For example, an ordered list can use 1. just like in markdown.

The workflow is effectively quite alien for most users. And good accessible documentation and examples are necessary to get going

enzyme69 commented 10 years ago

Dealga is a fan of on-the-fly markdown.

zeffii commented 10 years ago

I don't really have a problem with RST, i've read the specs now.

but in MD you can

wclyffe commented 10 years ago

Image size in markdown : I didn't know about that workaround. Path to local file : I knew about that one. Where rst is different is that it builds a table of content, and you can make reference to any item in it. You could say that rst is a middle ground between tex and markdown

zeffii commented 10 years ago

our docs will look and read nicer than houdini's. but only if:

For me the key is consistency. Maybe i'm finicky, but it shouldn't be blatantly evident that multiple people write the docs. The docs should be personable not personal.

enzyme69 commented 10 years ago

Yes, totally agree.

wclyffe commented 10 years ago

And image size is now completely irrelevant... I should read the docs more carefully:

    As a responsive style, you should not set a height and width to your images.
    Wide tables will add a horizontal scroll bar to maintain the responsive layout.

Stupid me! But curious about what that will do to the latex-pdf output

On consistency : I agree as well. Perhaps we should have a blend file in the repo with sane defaults that we could use for screenshots?

wclyffe commented 10 years ago

I just pushed my local branch and made a pull request.

To build the docs, just run make html from the docs directory. Then, if all goes well, open docs/_build/html/main.html in your browser of choice

nortikin commented 10 years ago

windows is evil

ly29 commented 10 years ago

Realistically speaking I guess there will be a lot of proofreading of what I write in the documentation...

nortikin commented 10 years ago

a looooot of work

zeffii commented 10 years ago

Dont warrry you text will by edotted myrceloosly.

nortikin commented 10 years ago

))

wclyffe commented 10 years ago

Does the building of the docs work for all of you?

And it seems that the branch has been merged into master. If so, we should perhaps delete the sphinx-doc branch to avoid confusion.

zeffii commented 10 years ago

i got a make error


C:\blender_trunk\2.71\scripts\addons\sverchok\docs>make html
Running Sphinx v1.1.3
loading pickled environment... not yet created

Theme error:
no theme named 'sphinx_rtd_theme' found (missing theme.conf?)

but that file is located there, so it's a path thing i guess

wclyffe commented 10 years ago

Ok i'll try to have a look. I generated the make.bat file in a dummy project as an afterthought. So something could be borked in there, but since I can't test it...

wclyffe commented 10 years ago

Ok. It is a miserable fuck-up on my part. The theme folder was symliked from a clone of the original. So when I pushed my branch, there was effectively nothing in the theme folder. See https://github.com/nortikin/sverchok/blob/master/docs/_themes/sphinx_rtd_theme. I will fix this asap.

wclyffe commented 10 years ago

In the mean time , you can edit https://github.com/nortikin/sverchok/blob/master/docs/conf.py#L113 tohtml_theme = 'default' and comment out the next line with the theme path

wclyffe commented 10 years ago

Should be fixed by the new commit

zeffii commented 10 years ago

I can confirm this makes very pretty docs :) :+1:

zeffii commented 10 years ago

i hope the download zip gets these precompiled

zeffii commented 10 years ago

the scripted node doc has an embedded image, it doesn't show up. I hope to find a nice rst highlighter for sublimetext.

wclyffe commented 10 years ago

Currently the zip doesn't contain the compiled docs, but I could add that to travis But you can get the docs compiled(html + pdf) by readthedocs.org on every commit or release easily. And they host them for you. (and they are versionned)

But before thinking about distributing the docs, they should be of reasonnable quality, not perfect obviously, but at least covering the essentials.

Embedded image : what I did was still really rough around the edges. I didn't do anything about the links' formating. It was just a test to see was sphinx docs could look like and if people were interrested

The image should be in the images folder (or somewhere under the docs folder), and then you can reference them absolutely : .. image:: /images/file_name.jpg . The root / is the root of the docs folder. Or relatively ../img_folder/file.name.png for example

And we should use PNG or another lossless format

zeffii commented 10 years ago

.gif can be highly optimized for short animated examples, else .png