bids-standard / bids-specification

Brain Imaging Data Structure (BIDS) Specification
https://bids-specification.readthedocs.io/
Creative Commons Attribution 4.0 International
280 stars 165 forks source link

possibly use mdBook to render md files online #18

Closed teonbrooks closed 6 years ago

teonbrooks commented 6 years ago

one possibility for the specification now that it is in md is to use mdBook. it's a project from the Rust team and it renders book-like html site.

choldgraf commented 6 years ago

Another option would be to use a simple Jekyll site (e.g. we've been hosting online textbooks with markdown + jekyll and it's worked pretty well as a drop-in for gitbook-style repos). That said, mdbook looks super cool so I'm interested in giving that a shot too.

I think the main question is how much complexity it'd add to this repo. I wonder if it'd be better hosted as a separate repo that pulls from the bids-specification repo?

chrisgorgo commented 6 years ago

Judging from pull request @teonbrooks made (https://github.com/bids-standard/bids-specification/pull/22) it should not add much overhead and will be fairly straightforward.

@franklin-feingold would be great to get your take on this as well.

chrisgorgo commented 6 years ago

One cool feature is that we could include source files such as JSON examples and validate them in CI: https://rust-lang-nursery.github.io/mdBook/format/mdbook.html#including-files

franklin-feingold commented 6 years ago

It may help to split up the specification and the mdbook appears to be a nice appealing way to complete this. I like the way it looks and this can help ease new users into reading it. Including source files is a nice feature. The storage doesn't appear too complex to interpret and follow.

A concern is that splitting it up may make it more difficult to locate items across different sections. We would lose quickly just finding across the entire document. We can also consider keeping the entire specification md file so not to lose the quick finding functionality for those that want the entire specification.

chrisgorgo commented 6 years ago

I had another look at mdbook and there are two features I was missing:

I found an interesting potential alternative - https://www.mkdocs.org/.

What do people think?

teonbrooks commented 6 years ago

that could be interesting. maybe we could have a similar test of the intro with mkdocs, compare, choose the better.

teonbrooks commented 6 years ago
* ability to export a PDF version (a feature requested by @dorahermes)

did some searching and there is an export ability using this repo. it adds more to the build, which might be less ideal.

choldgraf commented 6 years ago

Note that I think the choice of build system should be independent of the "split into multiple md files" stuff...so we shouldn't entangle the two if we think it'll be a bit of extra time to find the right build/hosting setup

chrisgorgo commented 6 years ago

Playing with mkdocs right now - looks stunning so far image

choldgraf commented 6 years ago

I know that @yuvipanda has used mkdocs before and I think really liked it

chrisgorgo commented 6 years ago

@choldgraf indeed - splitting is a separate issue https://github.com/bids-standard/bids-specification/issues/4

yuvipanda commented 6 years ago

@choldgraf I found mkdocs quite lacking in many ways. Using mkdocs was what finally fully converted me to rST and Sphinx :)

KirstieJane commented 6 years ago

Just on the export as a PDF question - if you click the little print button at the top of the rendered page (that @teonbrooks created in #22 hosted at https://teonbrooks.github.io/bids-specification you can get a pretty nice PDF of the whole site. What are the additional requirements? To do it programatically?

bids-standard-print.pdf

(I just realised that the links are broken in that print out - they're blue but don't link to anything - so that might be a reason to say it isn't good enough)

dorahermes commented 6 years ago

Yes, this little print button is nice! It seems to print the entire spec and not just a sub-section (which would be a problem).

KirstieJane commented 6 years ago

You could just print the page from the browser if you wanted a subsection. What's the usecase that you can imagine for the PDF @dorahermes? To physically print out, or to email around? The broken links are a problem for the email but not for printing for example.

bids-standard-definitions-only.pdf

dorahermes commented 6 years ago

Use cases for having a PDF of the spec: 1) Being able to have a certain version of 'The Spec'. Say you have a project and are putting data in BIDS Version X, I can imagine that a lab would want to have a PDF of this BIDS version alongside instructions of how to put data in BIDS. 2) I personally like having a PDF when I travel a lot and the internet is crappy.

KirstieJane commented 6 years ago

Coolio - I think for the first option it's important to have a nice PDF that includes the links etc. I think this would only have to be made once for each release so maybe it doesn't have to be done really automatically.

For crappy internet the pdfs with the broken links would probably be fine.

Totally ok by me for the search for a nice way of doing everything to continue, I guess this is just a light +1 for the simplicity of mdBook 😸

dorahermes commented 6 years ago

and one more example,

  1. Some people might need to be able to generate a paper-trail for data-management plans.

+1 for a nice PDF with links only generated once per release

chrisgorgo commented 6 years ago

Good find @KirstieJane.

@yuvipanda what were the ways mkdocs was lacking in?

BTW the search feature in mkdocs is pretty neat image

teonbrooks commented 6 years ago

@satra brought up another great suggestion for a rendering engine, sphinx: https://github.com/bids-standard/bids-specification/pull/28#issuecomment-426812108

it seems that there are three options at the moment

chrisgorgo commented 6 years ago

I created some prototypes:

Let me know what do you think

nicholst commented 6 years ago

I'd like to throw one consideration into the formatting discussions: HTML print-to-PDF by the browser is a highly browser-dependent operation. E.g. I've even seen different PDFs produced from the same website on the same OS but slightly different versions of a Chrome browser.

My $0.02 is that a highly professionally rendered PDF is a priority for the spec. If the plan is that each user/reader is to create a PDF by a browser Print-to-PDF action, we need to verify that good looking PDF is found with different browsers (presumably at least Firefox, Chrome, DefaultOSbrowser).

Thus, if one of the tools we're evaluating has the capability of rendering to PDF directly (in a browser-independent fashion), this is a big plus.

See, e.g. first page on Mac OS on, Chrome, Safari, Firefox, illustrated here, respectively:

bids-chrome bids-safari bids-firefox

Full PDFs here: Chrome | Safari | Firefox

satra commented 6 years ago

@chrisfilo - i prefer the simplicity of the first one #37

@nicholst - i'm personally fine with just reading html, but i agree that if a pdf is to be produced a consistent version would be good.

chrisgorgo commented 6 years ago

@nicholst delivering professionally looking PDF will be hard. Best approach is using pandoc, (see example output https://11-151034407-gh.circle-artifacts.com/0/home/circleci/project/site/specification.pdf) but there still issues with tables and header hierarchy.

I was hoping that most people will be interested in HTML outputs.

choldgraf commented 6 years ago

2 cents about the PDF printing: I think this should be community-driven question. How do we know that a large % of users want to print the specification out as a PDF for reference? Perhaps a user survey of some kind can help give us a path forward.

nicholst commented 6 years ago

I may have muddled things. IMHO, a polished PDF adds credibility/stature to the effort, but if the consensus is that HTML is sufficient, that’s fine. I think my point is that if we’re considering PDF it should be good & consistent; otw, we say this is a HTML spec and leave it at that.

As a random idea: I just looked at some PDF from Read The Docs and it looked very nice. Is that system in the running here?

choldgraf commented 6 years ago

we had discussed using readthedocs and hosting with sphinx. I believe it actually works with mkdocs https://mkdocs.readthedocs.io/en/stable/ so maybe that's a good approach!

chrisgorgo commented 6 years ago

Would someone be willing to explore the readthedocs route (especially the PDF generation feature)?

choldgraf commented 6 years ago

if you give me admin privileges on the repo and merge the mkdocs PR (so that the mkdocs files are in docs/, then I can try to set up RTD.

chrisgorgo commented 6 years ago

Would you mind doing this on your fork? I don't want to commit to mkdocs solution yet.

nicholst commented 6 years ago

@choldgraf: Oddly that link https://mkdocs.readthedocs.io/en/stable/ lacks the PDF rendering I had seen.

I was looking at this site: https://packaging.python.org/ which has a floating pop-up menu in the lower right that gives a PDF download option. In contrast, say, https://mriqc.readthedocs.io/en/stable/index.html has a similar pop-up (on the lower left) but offers no PDF download.

choldgraf commented 6 years ago

hmmm - usually it shows up in the little "latest" menu in the bottom right (e.g. it's there on this page https://repo2docker.readthedocs.io/en/latest). Maybe RTD doesn't build PDF with mkdocs?

choldgraf commented 6 years ago

@chrisfilo isn't there already a PR open that gets this repo built on mkdocs? All we'd need to do is set up readthedocs with whatever repo that is. What is the question you'd like answered with respect to readthedocs? Just whether you can download as PDF using mkdocs?

chrisgorgo commented 6 years ago

Correct - there is PR that adds mkdocs build, but more needs to be done to make it work with RTD. Just hooking it up with RTD leads to this result: https://bids-specification-demo.readthedocs.io/en/latest/. Even though there is no index and PDF is basically empty the individual pages got rendered (see https://bids-specification-demo.readthedocs.io/en/latest/src/04-modality-specific-files/01-magnetic-resonance-imaging-data.html). However, tables are not displayed correctly (which might be an intrinsic limitation of RTD support for markdown.

So a host of problems - what needs to be investigated is if they can be mitigated easily leading to quality HTML and PDF output.

choldgraf commented 6 years ago

ok - if I have a moment than I'll give it a shot

chrisgorgo commented 6 years ago

Thanks!

On Mon, Oct 8, 2018 at 11:37 AM Chris Holdgraf notifications@github.com wrote:

ok - if I have a moment than I'll give it a shot

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bids-standard/bids-specification/issues/18#issuecomment-427881434, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOkpxX-Zi5Z3yZLcqNT7W6FuYj2xB18ks5ui3ExgaJpZM4XDOlu .

choldgraf commented 6 years ago

So an update here: it looks like mkdocs is pretty easy to set up on readthedocs, but it does not support anything like PDF/EPUB generation of the document.

What do folks think about this?

teonbrooks commented 6 years ago

@choldgraf, do you know how repo2docker generates its pdf and epub? that would be a nice to have if it's easily implementable.

choldgraf commented 6 years ago

We're using sphinx there, which uses rst under the hood. Sphinx works with markdown as well through Recommonmark, but I think some features (like markdown tables) don't work :-/

chrisgorgo commented 6 years ago

Even though I like the option of having PDF (if it comes 'for free'), but it seems this is not easy. I believe we get the "prestige" effect from multiple papers related to BIDS that are published and in the works. I'm not sure we need to do a formal survey, but happy to be convinced otherwise.

Personally, I would just pick one of the HTML only solutions, for now, deploy it, but be open for future contributions enabling quality PDF output.

teonbrooks commented 6 years ago

+1. This would be in the same vein as W3C.

for archival purposes, I think as long as we can have pointers to the previous versions, we should be set. we can just have links to all the pdf versions before markdown, and then we will just have versioned html build views of post markdown.

dorahermes commented 6 years ago

+1 on being pragmatic and +1 on Teon's suggestion on having a previous version archived

choldgraf commented 6 years ago

A note re: readthedocs, it will also archive old versions of the specification relatively seamlessly, so if we want to use mkdocs (#42) then that would come "for free" even if PDF generation does not

chrisgorgo commented 6 years ago

Does this work with mkdocs integration? I could not see the menu with versions usually present in sphinx/rst readthedocs documents.

It's also not so hard to configure circle to deploy each version to a new subfolder (1.1.1/index.html, 1.2.0/index.html). Archival versions of source documents (Markdown) will, of course, be available on github as well.

nicholst commented 6 years ago

+1 for accepting this as a HTML-based standard.

choldgraf commented 6 years ago

I believe that versioning should work fine with mkdocs...if the community is +1 on using mkdocs then I can try to confirm this in my RTD PR

chrisgorgo commented 6 years ago

If versioning via RTD doesn't work we can always use https://pypi.org/project/mike/ and push directly to gh-pages.

I don't have a strong preference - I like material design of mkdocs, but I dislike the necessity of having an extra index.md file and lack of single page print option.

choldgraf commented 6 years ago

@chrisfilo this makes think of a question: does the bids-specification community have an official governance process? E.g., what's the process by which we would decide to use one build system over another?

chrisgorgo commented 6 years ago

We listen to each other, strive for consensus, use voting to resolve conflicts.

However, there is no formal governance structure. It's a complex topic that we will address in due time. If you have concrete ideas for a governance structure I would love to hear them (for the sake of clarity in a separate issue).

On Wed, Oct 10, 2018, 5:33 PM Chris Holdgraf notifications@github.com wrote:

@chrisfilo https://github.com/chrisfilo this makes think of a question: does the bids-specification community have an official governance process? E.g., what's the process by which we would decide to use one build system over another?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bids-standard/bids-specification/issues/18#issuecomment-428740267, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOkp68XR2iV0euzQiVCxhyXmZBD3QNGks5ujmekgaJpZM4XDOlu .

choldgraf commented 6 years ago

Sounds good - longer governance conversations I agree are a separate issue.

For this issue, my 2 cents is that we should:

My reasoning: The mkdocs PR is already ready to go more or less, and I don't think we should let "picking the right tool" get in the way of "picking any tool at all". With mkdocs we aren't committing ourselves to any kind of complex dependency that'll make it hard to switch to something later if a better option surfaces (beyond potentially the reliance on RTD for versioning...on that point, we should probably get a URL that isn't dependent on readthedocs so that we could switch if need be). I am still intrigued by @teonbrooks 's idea of mdbook, but I think we could keep exploring that idea on an ongoing basis and revisit this conversation later if it seems like it's the best choice.

Thoughts?