Commit graph

108 commits

Author SHA1 Message Date
Richard Zhang
a5e963dba1 Issue 305 broken link because of language fixes (#322)
* without having having to worry about site design.

Let me know if double having is intentional

* distinguish case of no translation and en lang

* prettier recommends

* distinguish case of no translation and en lang

* prettier recommends

* merge with latest origin/master changes

* typo

* link with language fixes

* do not show language dropdown if only one enabled

* check translation outside of LanguageDropDown.render
2017-12-19 17:44:43 -08:00
Joel Marcey
18c9a2ab31 Revert "Fixing Issue 305 - broken links because of language (#316)"
This reverts commit 7dc6c6c2da.
2017-12-19 09:23:41 -08:00
Richard Zhang
7dc6c6c2da Fixing Issue 305 - broken links because of language (#316)
* without having having to worry about site design.

Let me know if double having is intentional

* distinguish case of no translation and en lang

* prettier recommends

* distinguish case of no translation and en lang

* prettier recommends

* merge with latest origin/master changes

* typo
2017-12-19 09:20:32 -08:00
neilsutcliffe
21cbece838 Fixes to testing guide (for Windows only) (#304)
* Fixes to testing guide (for Windows only)

* Fixed line ending detection for UNIX and Windows

* Removed incorrect instructions about translations

* Removed redudant heading and turned it into a note.
2017-12-18 11:48:53 -08:00
Kunall Banerjee
c60131fdb4 cleanup startup logs (#291) 2017-12-16 16:51:52 -08:00
Jan Kassens
d97e2e9d81 Add newlines at end of generated files (#283) 2017-12-13 13:55:40 -08:00
Hector Ramos
a7d81c629d Resolve conflicts 2017-12-12 12:49:02 -08:00
Jan Kassens
b174ee2d2a Update prettier to 1.9.1 (#273) 2017-12-12 12:47:52 -08:00
Ricky Vetter
c22203523f use faded primaryColor background for inline code snippets instead of link color (#276) 2017-12-12 12:46:52 -08:00
Joel Marcey
c9e4f4479d Prettier fix 2017-12-11 16:41:09 -08:00
Héctor Ramos
11029cf02d Update build script (#272)
* Copy dot files if present in the static folder, and add .circleci config to Docusaurus site

* Update docs
2017-12-11 16:32:05 -08:00
Héctor Ramos
ad87bab09b Fix path to docs assets dir (#265) 2017-12-07 10:14:32 -08:00
Héctor Ramos
65421db62e Add Prettier Formatting (#258)
* Add Prettier formatting to source files and example files, and check that Prettier formatting is maintained on PRs

* Remove trailing-comma as we are using Node 6 on Circle

* Use latest Node 6 LTS version in Circle

* Remove unused test
2017-12-04 19:21:02 -08:00
Cheng Lou
76e423fba3 Use path module instead of string concat / (#255)
This also in part prepares for #253. I discovered a bug when setting `projectName` to `""`, and some `"build/" + projectName + "/foo"` concatenated into `"build//foo"`. Granted, it's a hack, but we should use `path` anyway.

Test: tested on https://github.com/BuckleScript/bucklescript.github.io. Seems working
2017-12-04 09:32:02 -08:00
Héctor Ramos
1efce743dd Provide additional debugging information (#241) 2017-11-26 21:59:28 -08:00
Héctor Ramos
09726c6361 [Versioning] Fix issue when a doc is added (#231)
* Simplify function, return error if doc not found
2017-11-15 15:55:08 -08:00
Héctor Ramos
420d2e86fb Replace diff with string comparison (#230) 2017-11-15 12:17:05 -08:00
Héctor Ramos
19e6cc7ecc Check whether a previous/next doc actually exists (#226)
* Check whether a previous/next doc actually exists

* Use reasonable defaults

* Remove extraneous space
2017-11-14 20:36:25 -08:00
Eric Nakagawa
8d14f8fb02
Merge pull request #217 from JoelMarcey/custom-docs-subdir
Allow custom path for the location of documentation
2017-11-13 13:50:39 -08:00
Christine Abernathy
1d3f71a60a Fix HTML copy file generation (#223) 2017-11-10 15:46:22 -08:00
Joel Marcey
e273dfc13b Allow the docs not to just be in a folder called docs
Also:
- regex escaping
- update api documentation
2017-11-09 09:55:26 -08:00
Joel Marcey
dc0c1390c4 [WIP] Allow custom subpath for docs within the "docs" folder
e.g.,

The default is

`docs/*.md`

This allows

`docs/somedir/*.md`

or

`docs/somedir/anotherdir/*.md`

Notes:

- All URLs are still /docs/*.html (i.e. the subpath does not get preserved in the link).
- Files in `translated_docs`, if any, will still only be one level
- This should not affect translations or versioning
2017-11-08 20:16:05 -08:00
Héctor Ramos
09354ab738 [BREAKING] Rename Marked to MarkdownBlock (#162)
* Switch to Remarkable

* Clean up references to custom code blocks

* Remove valdiateDOMNesting warning

* Add syntax highlighting

* Add Reason support

* Breaking change: prismColor to codeColor, remove CompLibrary.Prism, expose hljs

* Completely remove Prism and associated CSS rules

* Support loading plugins and scripts

* Remove CSS rules, allowing Highlight.js theme to be used entirely

* Remove unnecessary webplayer script

* Rename Marked to MarkdownBlock

* Rename Marked to MarkdownBlock

* Remove Marked.js
2017-10-30 15:47:13 -07:00
Héctor Ramos
459984516b Ensure some errors are logged to the console (#194)
* Clarify some error conditions in versioning

* Clarify missing doc error;

* Remove excess space

* Remove excess space part duex
2017-10-30 11:42:45 -07:00
Eric Nakagawa
fa1ec70432 Bug fixes in generatejs (#169)
* Misc cleanups related to console.log messages in yarn build

* Fixes https://github.com/facebookexperimental/Docusaurus/issues/96
2017-10-26 16:13:56 -07:00
Ricky Vetter
c97da9d3f7 Sitemap local (#157)
* Better support for localized pages in sitemap

* clean console
2017-10-26 16:12:47 -07:00
Joel Marcey
f72df94dd3 Return empty object instead of false if no metadata (#182)
Closes #139
2017-10-26 07:02:52 -07:00
Eric Nakagawa
55b0f33f2a Allows periods in blog file names -- will allow for version numbers, etc (#163)
* Allows periods in blog file names -- will allow for version numbers, etc

* Removed debug lines...
2017-10-24 19:27:37 -07:00
Joel Marcey
7b2e950a4c Add previous and next titles to metadata props 2017-10-24 19:09:34 -07:00
Héctor Ramos
b832176dc6 [markdown] Switch to Remarkable (#153)
* Switch to Remarkable
* Clean up references to custom code blocks
* Remove valdiateDOMNesting warning
* Add syntax highlighting
* Add Reason support
* Breaking change: prismColor to codeColor, remove CompLibrary.Prism, expose hljs
* Completely remove Prism and associated CSS rules
* Support loading plugins and scripts
* Remove CSS rules, allowing Highlight.js theme to be used entirely
* Remove unnecessary webplayer script
2017-10-24 09:45:21 -07:00
Joel Marcey
7e23f3e4ef Avoid null enabledLanguages when there is no languages.js file (#155)
```
var enabledLanguages = languages.filter(function (lang) {
                                  ^

TypeError: Cannot read property 'filter' of null
    at module.exports
```
2017-10-20 15:19:13 -07:00
Eric Nakagawa
574872d075 Only builds redirect pages if the current file is an english doc (#152) 2017-10-19 16:56:14 -07:00
Eric Nakagawa
d8b55fffa4 Fall back to English when strings are missing (#151) 2017-10-19 16:41:20 -07:00
Eric Nakagawa
22d0cebc18 Merge pull request #149 from ericnakagawa/noop-redirect
Removed copy from redirect page, reduced delay to 0s for js and meta
2017-10-19 13:20:07 -07:00
Eric Nakagawa
7f7459baa5 Merge pull request #148 from ericnakagawa/default-localization-english
This PR will create a default set of docs to use when localization is…
2017-10-19 13:19:55 -07:00
Eric Nakagawa
a9571ebf4d Removed copy from redirect page, reduced delay to 0s for js and meta 2017-10-19 13:15:05 -07:00
Eric Nakagawa
7c80becb87 Fix bug in when running local server 2017-10-19 12:58:57 -07:00
Eric Nakagawa
bf2f0cf935 Typo fix 2017-10-19 10:27:03 -07:00
Eric Nakagawa
bfb28441b4 This PR will create a default set of docs to use when localization is enabled. This allows seeing using the site without having synced with crowdin. Once synced, those files will replace the default set generated by this PR. 2017-10-19 09:57:10 -07:00
Christopher Chedeau
57251a22c0 Ability to tweak the prism language (#146)
I want to be able to tweak the default tokenizer for syntax highlighting. The current one isn't as good as it could be.

With this PR, I would be able to add this to the siteConfig and it would give me the Prism access so that I can get proper syntax highlighting:

```js
  prism: function(Prism) {
    Prism.languages.javascript = Prism.languages.extend("javascript", {
      keyword: /\b(alias|as|async|await|base class|...|with)\b/,
      constant: /\b[A-Z][a-zA-Z0-9_]*\b/,
      builtin: /\bopen_file|...|invariant_violation|invariant|getcwd\b/,
      function: /\b[_$a-z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/,
    });
  },
```
2017-10-19 08:21:00 -07:00
Eric Nakagawa
c3a1d99964 Include baseUrl when redirecting /docs/ pages in a localized project (#147) 2017-10-19 07:29:48 -07:00
Joel Marcey
26f498a2db Add a check for languages.js in sitemap.js
Without this a build failure would occur for those that are not using the languages.js file.

e.g.,

```
sitemap.js triggered...
module.js:471
    throw err;
    ^

Error: Cannot find module '/home/ubuntu/fasttext-website/website/languages.js'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at module.exports (/home/ubuntu/fasttext-website/website/node_modules/docusaurus/lib/server/sitemap.js:48:15)
    at execute (/home/ubuntu/fasttext-website/website/node_modules/docusaurus/lib/server/generate.js:316:5)
    at Object.<anonymous> (/home/ubuntu/fasttext-website/website/node_modules/docusaurus/lib/build-files.js:31:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
Error: generating html failed
```
2017-10-18 15:43:25 -07:00
Eric Nakagawa
a4695a3083 Code cleanups for consistency & adds Docusaurus to meta tags (#138)
* Add a made with Docusaurus meta tag

* Code cleanups and changes for clarity

* Add back pages string extraction
2017-10-18 14:40:16 -07:00
Eric Nakagawa
967970eaa5 Generates a file that redirects from /docs/file.html to /docs/en/folder.html when languages are enabled (languages.js is present) (#137) 2017-10-18 12:56:14 -07:00
Eric Nakagawa
bcba05ae03 Adds sitemap.xml. Adds 'Help Translate' to translatable strings. Error messages and fn name cleanups. (#136)
* added a note about needing more than one language to be enabled to allow for a drop down

* Removing debug statements

* Add 'Help Translate' to translatable strings, improves error messages around missing translated strings, calls write-translations on some routes

* Adds sitemap.xml to live server and build. Versioning not supported. -- Also did some file name and module cache cleanups.
2017-10-18 12:55:58 -07:00
Christopher Chedeau
a26bba14c6 Add the ability to provide custom layout (#128)
* Add the ability to provide custom layout

When I designed the system, I added the ability to provide a custom layout that would use arbitrary JavaScript to render some custom pages. This is why files are called "DocsLayout.js", "BlogPostLayout.js"... This ability to customize it was [ripped out](https://github.com/facebook/react-native/blob/master/website/server/convert.js#L78) during the migration to Docusaurus but I need it for the project I'm working on right now (that should remain unnamed!).

This adds back the ability to do it in a way that fits the third party system. In order to provide a new layout:

1) Add a `layout` field in the header of your markdown file:

```js
---
layout: mylayout
---
```

2) In your `siteConfig`, add

```js
  layouts: {
    mylayout: function({React, Marked}) {
      return class extends React.Component {
        render() {
           return React.createElement('div', {}, this.props.metadata.layout);
         }
      }
    }
  }
```

I think that it's a reasonable to add and would unblock me :)

* Update DocsLayout.js
2017-10-18 10:20:13 -07:00
Christopher Chedeau
5693eba5d1 Allow for header and empty body (#127)
My hack of checking if the body was empty wasn't correct :(

```js
---
id: String
title: String
layout: stdlib
---
```

The above would be treated as pure content. Now it's working properly :)
2017-10-18 10:16:30 -07:00
Eric Nakagawa
8ac191a331 Fixes #104 by providing a useful error message.
Next step will be to run 'write-translations' on 'yarn start' and 'yarn build' (#119)
2017-10-06 12:16:27 -07:00
Joel Marcey
77535d80f2 The complete move to MIT license (#115)
- headers in .js files
- update README and LICENSE year

Testing:

grep BSD, Patents, patents turned up nothing
2017-10-05 11:14:49 -07:00
Eric Nakagawa
3b5db4bbf8 2 bug fixes (#98)
* Merge fix

* Updating lock file.

* Bug fix for rss feed truncation...

* Fixes infinite recursive loop for #89

* Removed use of module cache invalidator from feed.js

* Replaced 'latest' babel presets with 'env'

* Ignore temp build folder

* Adding back new truncation logic for RSS

* Updating yarn lock
2017-09-28 14:46:29 -07:00