Skip to content

Conversation

@GeoffreyBooth
Copy link
Collaborator

More improvements to the documentation:

  • All the content is now markdown, compiled into HTML at build/template render time.
  • The code examples are compiled into JavaScript at build/template render time, without a step that creates intermediate .js files. The compilation is so fast that the disk writes were slower.
  • index.html now requires sub-templates, to divide content into relevant sub-files. The build process reassembles everything. The sub-files are mostly inside a documentation/v1 folder, giving the 2 docs source files a logical place to go.
  • index.html and test.html are now built via separate cake tasks, to avoid a gigantic function.
  • The browser-based tests run in test.html now run all the tests, including error_messages.coffee, thanks to a fixed polyfill for @throw.

@GeoffreyBooth GeoffreyBooth requested a review from lydell December 11, 2016 07:37
lydell
lydell previously requested changes Dec 11, 2016
Copy link
Collaborator

@lydell lydell left a comment

Choose a reason for hiding this comment

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

I like this. Very much. Very well done!

</b>
"""
htmlFor = ->
marked = require 'marked'
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to be added to package.json,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. Are you okay with me merging this into develop whenever I'm done testing it? I'm working on getting the 2 docs built in their branch, based on this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Master, I mean.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, go for it!


All together now:

<table class="definitions">
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we use CommonMark, then we could possibly write the tables in a more readable way. http://spec.commonmark.org/0.27/#html-blocks

What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is that supported by the marked module? Its docs say to use this syntax: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#tables

I just haven't gotten around to converting, the automated HTML-to-Markdown converters I tried didn't support tables.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, I didn't realize you used an autmated converter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Isn't that essentially treating the table as one big passthrough? But we still want markdown within the cells to be evaluated.

I would think the github style would be more idiomatic markdown than any form of HTML tags. It'll just take manual effort to convert.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There’s also the issue of rendering a headerless table in Markdown: markedjs/marked#484

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we only have two tables in total currently, so the way it is currently is not such a big deal. But if it could be made nicer in any way, that'd be great! 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that can be a future improvement. You're welcome to try 😄

@jashkenas
Copy link
Owner

Very, very nice!

@tiye
Copy link

tiye commented Dec 13, 2016

Then it will cost less time to translate into Chinese. Great.

… docs can have different example code blocks/editors
…keywords and triple backticks (docs output is unchanged)
@GeoffreyBooth GeoffreyBooth merged commit e620434 into jashkenas:master Dec 16, 2016
@GeoffreyBooth GeoffreyBooth deleted the improve-docs branch December 16, 2016 05:05
EsrefDurna pushed a commit to EsrefDurna/coffeescript that referenced this pull request Nov 12, 2025
…s, fixed tests (jashkenas#4401)

* Replace tiny bitmaps with base64-encoded URIs

* Optimize SVGs; replace logo PNG with SVG

* Modernize favicon

* Embed CSS; a bit unorthodox, but we’re a single page so there’s no point in separate .css files and their separate HTTP requests

* Documentation is now markdown, converted to HTML on compilation

* Render the examples when we’re rendering index.html; they compile so quickly that there’s no need to pre-render them and save the intermediate .js files

* Split apart index.html into components that Cakefile assembles, so that we can add in logic to include different files for v1 versus v2

* Split building index.html and building test.html into two tasks; collapse the parts of `releaseHeader` into one compact function

* Move include logic into templates

* Get error messages tests to work in the browser

* Update output index.html

* Split body into nav and body

* Watch subtemplates

* Revert "Split body into nav and body"

This reverts commit ec9e559.

* Add marked

* Update gitignore

* Use idiomatic markdown output for code blocks (<pre><code>)

* Handle ids within the template, not in the Cakefile; remove marked’s auto-generated and conflicting ids

* Move the `codeFor` function into versioned folders, so that v1 and v2 docs can have different example code blocks/editors

* Update packages, including new highlight.js which supports our newer keywords and triple backticks (docs output is unchanged)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants