diff --git a/.babelrc b/.babelrc index cab5d10d9..60e33aa08 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,8 @@ { + "env": { + "test": { + "plugins": ["babel-plugin-rewire"] + } + }, "stage": 2 } diff --git a/.gitignore b/.gitignore index 76b192b84..e3f8c0c41 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +.DS_Store node_modules/ dist/ npm-debug.log* docs/_site docs/.sass-cache/ +dist-es5-module/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c0e75c50..e009f2609 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +## [0.0.7](https://github.com/algolia/docsearch/compare/v0.0.6...v0.0.7) (2015-12-22) + + +### Bug Fixes + +* **appId:** Allow passing a custom appId ([e1777d3](https://github.com/algolia/docsearch/commit/e1777d3)), closes [#21](https://github.com/algolia/docsearch/issues/21) +* **css:** Renaming all `ads-` prefix to `algolia-docsearch-` ([c6fc53f](https://github.com/algolia/docsearch/commit/c6fc53f)) + + + ## [0.0.6](https://github.com/algolia/docsearch/compare/v0.0.5...v0.0.6) (2015-12-16) diff --git a/README.md b/README.md index 304d7c3fc..895003949 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,17 @@ +# DocSearch + +[![build status](https://travis-ci.org/algolia/docsearch.svg?branch=master)](http://travis-ci.org/algolia/docsearch) +[![NPM version](https://badge.fury.io/js/docsearch.js.svg)](http://badge.fury.io/js/docsearch.js) + +We've created the fastest, easiest way to search within documentation. Check out our [website](https://community.algolia.com/docsearch/) to add an outstanding search to your documentation. + -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* +## Table of Contents -- [docsearch](#docsearch) -- [Usage](#usage) -- [Examples](#examples) -- [How do I get an `apiKey` and `indexName`?](#how-do-i-get-an-apikey-and-indexname) -- [How does it work?](#how-does-it-work) +- [Introduction](#introduction) +- [Setup](#setup) +- [Customization](#customization) - [Development workflow](#development-workflow) - [Local example](#local-example) - [Documentation website](#documentation-website) @@ -14,68 +19,62 @@ -# docsearch + -Add a search autocomplete to any documentation. +## Introduction -Currently on-demand, send an email to [docsearch@algolia.com](mailto:docsearch@algolia.com) -if you want documentation search on your website. +We're scratching our own itch here. As developers, we spend a lot of time reading documentation, and it isn't always easy to find the information we need. -# Usage +Not blaming anyone here. Building a good search for a documentation is a complex challenge. We happen to have a lot of experience doing that, and we want to share it with the world. For free. -```html - - -``` +Just submit the form on the [website](https://community.algolia.com/docsearch/) and we'll get back to you with what you need to integrate your new search into your website. -```js -documentationSearch({ - apiKey: apiKey, // Mandatory - indexName: indexName, // Mandatory - inputSelector: '#search-input' // Mandatory -}); -``` + 1. We'll crawl your documentation pages, + 2. We'll configure your search experience, + 3. You'll need to add a bit of JavaScript and CSS code to your website. -# Examples +## Setup -- http://eslint.org/ -- https://bootstrap.algolia.com/ -- https://reactjs.algolia.com/ -- https://babeljs.algolia.com/ +Once we've crawled your documentation website we'll send you the credentials you need to add the following code snippet to your website: -# How do I get an `apiKey` and `indexName`? - -Send us [an email](mailto:docsearch@algolia.com) with the url of -the documentation website you would like to add search to. - -# How does it work? +```html + + + +``` -The JavaScript library is a wrapper on top of our -[autocomplete.js](https://github.com/algolia/autocomplete.js) library, along -with default CSS styling of the dropdown. +## Customization -The indexing of the website data itself is currently done by an internal tool (to be released). +To customize the look & feel of the dropdown menu, you can either: -Indexing of websites using docsearch takes places every day. + * edit the color [variables](https://github.com/algolia/docsearch/blob/master/src/styles/_variables.scss) and rebuild this project CSS (`npm run build:css`), + * or override the colors like we did in [dev/docsearch-styling.css](https://github.com/algolia/docsearch/blob/master/dev/docsearch-styling.css). -# Development workflow + +## Development workflow -## Local example +### Local example We use a simple documentation example website as a way to develop the docsearch.js library. Requirements: - [Node.js](https://nodejs.org/en/) - npm@2 - + ```sh npm run dev # open http://localhost:8080 ``` -## Documentation website +### Documentation website -This is the [Jekyll](https://jekyllrb.com/) instance running at https://community.algolia.com/docsearch. +This is the [Jekyll](https://jekyllrb.com/) instance running at [https://community.algolia.com/docsearch](https://community.algolia.com/docsearch). Requirements: - [Ruby](https://www.ruby-lang.org/en/) @@ -86,7 +85,7 @@ npm run dev:docs # open http://localhost:4000/docsearch/ ``` -## MacOS +### MacOS If you are using `brew` and you had `brew install openssl`, you may need to configure the build path of eventmachine with diff --git a/dev/docsearch-styling.css b/dev/docsearch-styling.css index 0a026ec48..72bf189f9 100644 --- a/dev/docsearch-styling.css +++ b/dev/docsearch-styling.css @@ -1,35 +1,35 @@ /* Bottom border of each suggestion */ -.ads-suggestion { +.algolia-docsearch-suggestion { border-bottom-color: #3A3DD1; } /* Main category headers */ -.ads-suggestion--category-header { +.algolia-docsearch-suggestion--category-header { background-color: #4B54DE; } /* Highlighted search terms */ -.ads-suggestion--highlight { +.algolia-docsearch-suggestion--highlight { color: #3A33D1; } /* Highligted search terms in the main category headers */ -.ads-suggestion--category-header .ads-suggestion--highlight { +.algolia-docsearch-suggestion--category-header .algolia-docsearch-suggestion--highlight { background-color: #4D47D5; } /* Currently selected suggestion */ -.aa-cursor .ads-suggestion--content { +.aa-cursor .algolia-docsearch-suggestion--content { color: #272296; } -.aa-cursor .ads-suggestion { +.aa-cursor .algolia-docsearch-suggestion { background: #EBEBFB; } /* For bigger screens, when displaying results in two columns */ @media (min-width: 768px) { /* Bottom border of each suggestion */ - .ads-suggestion { + .algolia-docsearch-suggestion { border-bottom-color: #7671df; } /* Left column, with secondary category header */ - .ads-suggestion--subcategory-column { + .algolia-docsearch-suggestion--subcategory-column { border-right-color: #7671df; background-color: #F2F2FF; color: #4E4726; diff --git a/docs/.DS_Store b/docs/.DS_Store new file mode 100644 index 000000000..1dd08da9f Binary files /dev/null and b/docs/.DS_Store differ diff --git a/docs/Gemfile b/docs/Gemfile index 0227eb6f5..c684a373b 100644 --- a/docs/Gemfile +++ b/docs/Gemfile @@ -4,7 +4,7 @@ source 'https://rubygems.org' group :development, :test do - gem 'jekyll' + gem 'jekyll', '< 3' gem 'haml' gem 'rouge' gem 'sass' diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index dce1b547f..ff6ee1d2a 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -1,20 +1,23 @@ GEM remote: https://rubygems.org/ specs: + addressable (2.3.8) blankslate (2.1.2.4) - classifier-reborn (2.0.3) + classifier-reborn (2.0.4) fast-stemmer (~> 1.0) coderay (1.1.0) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.9.1.1) + coffee-script-source (1.10.0) colorator (0.1) em-websocket (0.5.1) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) eventmachine (1.0.8) execjs (2.6.0) + faraday (0.9.2) + multipart-post (>= 1.2, < 3) fast-stemmer (1.0.2) ffi (1.9.10) formatador (0.2.5) @@ -62,7 +65,8 @@ GEM coffee-script (~> 2.2) jekyll-contentblocks (1.0.1) jekyll - jekyll-gist (1.3.4) + jekyll-gist (1.4.0) + octokit (~> 4.2) jekyll-paginate (1.1.0) jekyll-sass-converter (1.3.0) sass (~> 3.2) @@ -70,7 +74,7 @@ GEM listen (~> 3.0) kramdown (1.9.0) liquid (2.6.3) - listen (3.0.3) + listen (3.0.5) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) lumberjack (1.0.9) @@ -78,12 +82,15 @@ GEM method_source (0.8.2) mini_portile (0.6.2) multi_json (1.11.2) + multipart-post (2.0.0) nenv (0.2.0) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) notiffany (0.0.8) nenv (~> 0.1) shellany (~> 0.0) + octokit (4.2.0) + sawyer (~> 0.6.0, >= 0.5.3) parslet (1.5.0) blankslate (~> 2.0) posix-spawn (0.3.11) @@ -100,7 +107,10 @@ GEM redcarpet (3.3.3) rouge (1.7.7) safe_yaml (1.0.4) - sass (3.4.19) + sass (3.4.20) + sawyer (0.6.0) + addressable (~> 2.3.5) + faraday (~> 0.8, < 0.10) shellany (0.0.1) slop (3.6.0) thor (0.19.1) @@ -118,7 +128,7 @@ DEPENDENCIES guard-jekyll-plus guard-livereload haml - jekyll + jekyll (< 3) jekyll-contentblocks nokogiri rouge diff --git a/docs/_config.yml b/docs/_config.yml index b8dfaf0b6..afb36b847 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -8,11 +8,28 @@ host: 0.0.0.0 # Navigation navigation: - - text: About - url: /about/ + - + text: Documentation + url: /documentation/ + - + text: About + url: /about/ # Build settings markdown: kramdown +kramdown: + input: GFM + hard_wrap: false + + auto_ids: true + footnote_nr: 1 + entity_output: as_char + smart_quotes: lsquo,rsquo,ldquo,rdquo + enable_coderay: true + + coderay_wrap: div + coderay_line_numbers: nil + coderay_css: style # Assets sass: diff --git a/docs/_includes/header.html b/docs/_includes/header.html index 4d1938e5b..11b9f2b1e 100644 --- a/docs/_includes/header.html +++ b/docs/_includes/header.html @@ -1,13 +1,14 @@ +