Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

A proposal for hosted docs #569

Merged
merged 21 commits into from Jun 3, 2013
Merged

A proposal for hosted docs #569

merged 21 commits into from Jun 3, 2013

Conversation

knuton
Copy link
Contributor

@knuton knuton commented May 4, 2013

This is a proposal on how to give the documentation for Chaplin some more glory, while still keeping them close to the source for convenient maintenance. It also builds on @paulmillr's work to have bi-lingual (CoffeeScript/JavaScript) docs.

It would be nice to have some more freedom in the presentation of the docs, make browsing them more convenient, and offer an option to switch between the two languages to reduce visual noise.

At the same time, as @molily told me, an earlier attempt at keeping the docs in a separate repo has been abandoned due to trouble with keeping source and documentation in sync.

My basic idea for remedying both is to leave documentation source files where they are now, but use GitHub Pages to make them available to the public. Using Jekyll, the existing files can be transformed into a more easy-to-use, more browsable collection of docs, without having to change too much.

You can see my first steps into this direction here: http://knuton.github.io/chaplin/chaplin.collection_view.html

I have slightly adapted the styles from chaplinjs.org and added the option to choose one's preferred language at the top of the page (persisted in localStorage).

The individual doc files would not have to change much in order to accomodate this change: 06ea47f#L4R0

Another addition I would like to make is to add a sidebar or some other option to jump between modules quickly.

The main benefits I expect from this are

  • the option to choose a preferred language,
  • ease of navigation, more discoverability,
  • stability of docs for current release (if docs are deployed to docs.chaplin.org on every release).

I'd like to hear your feedback. Paul has already expressed his concerns in an inline note. Paul, can you explain how this suggestion would be harder to maintain compared with the current setup?

@paulmillr
Copy link
Contributor

good job in this case. we should add links to all doc files from each file, like most doc systems do. no need to hide this and it will take not much space

@knuton
Copy link
Contributor Author

knuton commented May 6, 2013

Glad you like it. Will put more work into this towards the end of the week.

I agree about placing links to all other modules in each doc file, will probably go for a sidebar of sorts.

@molily
Copy link
Member

molily commented May 8, 2013

This looks good so far.

@paulmillr @mehcode Some explanation: @knuton worked with me on moviepilot.com in 2011/2012 and he contributed much of the initial code that made it into Chaplin. Now 9elements is sponsoring him to work on Chaplin again. The first steps will be to improve the documentation, examples, articles and marketing since that’s a major weakness – the code quality is quite good and Chaplin has great features, but we need to communicate this better.

@chrisabrams
Copy link
Contributor

Great news to hear docs/marketing are going to get a nice push :)

...but we need to communicate this better.

Please do 👍 I encounter some people who won't consider Chaplin because they "haven't heard of it." - Which is a silly reason not to consider something, but nonetheless it happens.

Had originally planned on building a widget for inline switching for
each separate example, but realised that the common use case will be to
switch language once and leave it at that. So there is no need to group
the code examples into "same semantics" lists.
I am not entirely happy with the relative links as they are now.
Relative links were brittle already with the use of GitHub's section
links, where links would break with changing method signatures. This
situation has now become even worse, where unrelated changes, e.g. an
additional method being added to the docs, can break links.

This is because I use RedCarpet's feature of automatically creating
heading identifiers and it doesn't use the text of the heading to do so.
Maybe going for HTML with IDs here is actually the most reliable choice.
@knuton
Copy link
Contributor Author

knuton commented May 11, 2013

Still work in progress, but would be happy about feedback! Current state can be seen here: http://knuton.github.io/chaplin/

Some issues I definitely need to address:

  • The short explanations of modules are neat, but make the sidebar less usable: Use only linked module names
  • Deal with issues discussed in 0bfa788

If these changes makes sense to all of you, I would then try to brush up the docs themselves.

Thanks for the introduction, @molily!

@paulmillr
Copy link
Contributor

Nice one! like this.

how about making explanations in <a title='...'>?

@knuton
Copy link
Contributor Author

knuton commented May 18, 2013

In the docs at the moment there is a mix of files with unwrapped text and files with text wrapped at 80 characters. Should any kind of convention be agreed on for this?

@molily
Copy link
Member

molily commented May 18, 2013

I find it easier not to insert line breaks in documentation texts. Inserting or deleting a single word can cause a re-wrap for the next couple of lines. In practice, nobody will correct that so it gets inconsistent.

Line-based diffs are fucked up in both cases; Git doesn’t perform a word-diff per default.

@knuton
Copy link
Contributor Author

knuton commented May 18, 2013

Updated version hosted via my fork: http://knuton.github.io/chaplin/

I am now going through the content, trying to simultaneously understand and explain the current code base.

@molily
Copy link
Member

molily commented May 22, 2013

Looks good so far!

@vendethiel
Copy link
Contributor

Nice work :).

EDIT : I think the menu could "stick"

class Layout extends Chaplin.Layout
isExternalLink: (href) -> # some test on the href variable
```

```javascript
// JavaScript
var Layout = Chaplin.Layout.extend({
isExternalLink: function(href) {} # some test on the href variable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just saw the typo here (#)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@paulmillr
Copy link
Contributor

ok this needs sync with master.

What else is needed to merge this? Can we launch this ASAP?

@knuton
Copy link
Contributor Author

knuton commented May 25, 2013

@Nami-Doc Yes, I have also thought about fixing the sidebar. Any other opinions on this?

@paulmillr In principle this is close to being ready for merging, one thing that could be decided first is the above question regarding the sidebar. I am working on the actual content of the documentation at the moment, but this shouldn't necessarily be bound to the technical things that have happened so far. To complete the technical part we should

  • add a grunt task for publishing the docs;
  • decide on sidebar, and make change;
  • decide on where docs will live (I guess docs.chaplinjs.org), add CNAME file.

Then I'd ask you to configure the subdomain appropriately.

The more interesting question is about actually getting the docs out of the door. Should anything on chaplinjs.org be updated at the same time? Should this be part of going 1.0? etc.

Conflicts:
	docs/chaplin.view.md
@paulmillr
Copy link
Contributor

I think we can release 0.10 with new docs. Fixed sidebar is cool. docs.chaplinjs.org is good

Creates a throw-away repository to which contents of /docs are copied,
then force pushes this to the gh-pages branch.
@knuton
Copy link
Contributor Author

knuton commented Jun 1, 2013

If everything looks good, I can squash and we can merge this. (Updated version, as always, at http://knuton.github.io/chaplin/.)

Version numbers are handled manually at the moment, right? As I am using the version number to link to the correct versions of source files, there is now yet another place where the version number appears (see this commit). It might be a good idea to add an automatic check of this value in the grunt task for publishing docs and abort if the version number mismatches the one in package.json. How is this handled in general?

@mehcode
Copy link
Member

mehcode commented Jun 1, 2013

Docs look awesome! Great job @knuton.

As for versioning we could always add something like https://npmjs.org/package/grunt-bumpx or https://npmjs.org/package/grunt-release.

@paulmillr
Copy link
Contributor

looks cool. auto-check will be good, yes

@knuton
Copy link
Contributor Author

knuton commented Jun 1, 2013

@mehcode, yeah, something like this would be great. I think grunt-release looks quite good, but it is too simplistic for our use case, we will want to automatically bump at least package.json and component.json, while apparently grunt-release expects there to be just one package file. I will open a separate issue for this.

@knuton knuton mentioned this pull request Jun 1, 2013
Conflicts:
	docs/chaplin.view.md
@molily
Copy link
Member

molily commented Jun 3, 2013

Ready for merge, @knuton and me talked about some changes and fixes that will come soon so we can deploy.
I need to set up a DNS record for docs.chaplinjs.org, right?

molily added a commit that referenced this pull request Jun 3, 2013
@molily molily merged commit 91e228b into master Jun 3, 2013
@molily molily deleted the topics/hosted-docs branch June 3, 2013 15:52
@knuton
Copy link
Contributor Author

knuton commented Jun 3, 2013

Yes, DNS record needs to be added.

@molily
Copy link
Member

molily commented Jun 3, 2013

The docs are still available at https://github.com/chaplinjs/chaplin/tree/master/docs, but they are a bit confusing because of the new Jekyll markup. We need to investigate how to transition to the new domain while supporting the old URLs.

@molily
Copy link
Member

molily commented Jun 5, 2013

Should it already work when the domain points correctly? I tried to make such a HTTP request but got a Forbidden.
Do we need to put the docs in a gh-pages branch?
(How does it work for the website? There seems to be no gh-pages branch in the website repo: https://github.com/chaplinjs/chaplinjs.github.com)
</noob-questions>

@molily
Copy link
Member

molily commented Jun 5, 2013

I’ve created

docs.chaplinjs.org. 3600    IN  CNAME   chaplinjs.github.io.

(name server: superns1.9elements.com)
according to https://help.github.com/articles/setting-up-a-custom-domain-with-pages

@paulmillr
Copy link
Contributor

gh-pages is not needed for repos which are in .github.com repo

@paulmillr
Copy link
Contributor

I can see the docs here http://chaplinjs.org/chaplin/ but not at new domain

@knuton
Copy link
Contributor Author

knuton commented Jun 5, 2013

The entry looks fine. The gh-pages branch in this repo exists now, but is not up to date and there is no CNAME file to tell the GitHub servers what to expect. If you want to publish the docs, running grunt docs:publish should do the job. The docs should be available at http://docs.chaplinjs.org/ a short while after.

@knuton
Copy link
Contributor Author

knuton commented Jun 5, 2013

For your question about chaplinjs.github.com, see https://help.github.com/articles/user-organization-and-project-pages.

@molily
Copy link
Member

molily commented Jun 7, 2013

Any idea where I have to put the CNAME?
The branch is here with a CNAME https://github.com/chaplinjs/chaplin/tree/gh-pages, but still 404 at http://docs.chaplinjs.org/.

@molily
Copy link
Member

molily commented Jun 7, 2013

It’s on! Hooray!

@molily
Copy link
Member

molily commented Jun 7, 2013

Is it safe to add a Chaplin: $title Jekyll variables so Github renders the nicely?
Example: https://github.com/chaplinjs/chaplin/blob/master/docs/chaplin.view.md
This looks way better than for example:
https://github.com/chaplinjs/chaplin/blob/master/docs/chaplin.application.md
And Jekyll should just ignore the variable:
http://docs.chaplinjs.org/chaplin.view.html

@knuton
Copy link
Contributor Author

knuton commented Jun 8, 2013

That is definitely safe. I am not sure to what extent they should be tailored to be read directly on GitHub, but this would surely do the job.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants