Commit graph

82 commits

Author SHA1 Message Date
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
Eric Nakagawa
dc835770a0 RSS/ATOM Feed added, Prism changes, and global Copyright notice. (#94)
* Add Reason support to Prism.js

* Add XML/ATOM feed. Generates for both localhost and build script. Adds meta links to feeds to all html files.

* Updated /core/Footer.js to pull from siteConfig
2017-09-27 12:49:09 -07:00
Eric Nakagawa
b241ed4404 Prints an console error if /blog/ folder has no files. 2017-09-25 12:11:37 -07:00
Frank Li
cfc6030d23 Fix replacement of relative doc links 2017-08-16 16:17:33 -07:00
Frank Li
43ef3c8142 Add comments 2017-08-15 16:55:38 -07:00
Frank Li
ae4c577237 Fix to metadata ids 2017-08-14 10:19:01 -07:00
Frank Li
2e33758bef Clean up cache removal function 2017-08-11 11:39:04 -07:00
Frank Li
074ac07837 Small fix 2017-08-10 16:10:30 -07:00
Frank Li
4646fc98c5 Update color configurations 2017-08-10 16:03:43 -07:00
Frank Li
964e9e2108 Update doc metadata to use file name as id fallback and id as title fallback 2017-08-10 14:51:34 -07:00
Frank Li
db7a7394b3 Merge pull request #61 from facebookexperimental/error-messages
Add better error messages for most common cases
2017-08-10 13:46:58 -07:00
Frank Li
56b5554799 Merge pull request #26 from JoelMarcey/cname
Write CNAME file if custom domain
2017-08-10 11:37:25 -07:00
Frank Li
c0792044b2 Update CNAME file generation 2017-08-10 11:34:40 -07:00
Frank Li
18bcc59fd0 Merge branch 'master' of https://github.com/facebookexperimental/Docusaurus 2017-08-09 16:25:25 -07:00
Frank Li
91fe923cf7 Fix variable declaration 2017-08-09 16:25:18 -07:00
Frank Li
88359ea845 Update messages for versioning 2017-08-09 16:17:39 -07:00
Frank Li
cdea25eceb Merge branch 'master' of https://github.com/facebookexperimental/Docusaurus 2017-08-09 15:50:34 -07:00
Frank Li
374ca9b86c Change sidebar.json to sidebars.json in versionFallback.js 2017-08-09 15:50:20 -07:00
Frank Li
b256d2f8d9 Initial changes to error messages 2017-08-09 15:43:30 -07:00
Frank Li
d2eaf04ec7 Fix markdown html link replacement 2017-08-08 15:44:51 -07:00
Frank Li
94a3265aab Fix blog metadata 2017-08-08 14:58:41 -07:00
Frank Li
b94dbff181 Fix versioning bugs 2017-08-08 11:44:30 -07:00
Frank Li
9ddd2f5ea4 Merge branch 'master' into versioning 2017-08-08 11:39:23 -07:00
Frank Li
cf5ee95a48 Minor cleanup 2017-08-08 11:38:07 -07:00
Frank Li
4b96408fa5 Rename sidebar.json to sidebars.json 2017-08-07 17:25:52 -07:00
Frank Li
09ca732402 Allow document not in sidebar.json to be displayed 2017-08-07 15:15:09 -07:00
Frank Li
b4e9a068ab Update server to provide message with full link 2017-08-07 11:08:37 -07:00