Skip to content

Commit

Permalink
docs: fix links in generated docs (#4200)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey authored and gkatsev committed Mar 21, 2017
1 parent 0fd7aad commit 61e2078
Show file tree
Hide file tree
Showing 27 changed files with 132 additions and 86 deletions.
20 changes: 20 additions & 0 deletions build/fix-api-docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var replace = require("replace");
var path = require('path')
var apiPath = path.join(__dirname, '..', 'docs', 'api');

var replacements = [
{find: /\/docs\/guides\/(.+)\.md/g, replace: 'tutorial-$1.html'},
{find: /tutorial-tech.html/g, replace: 'tutorial-tech_.html'},
{find: /\/docs\/guides\//g, replace: '#'}
];


replacements.forEach(function(obj) {
replace({
regex: obj.find,
replacement: obj.replace,
paths: [apiPath],
recursive: true,
silent: true
});
});
10 changes: 7 additions & 3 deletions docs/guides/audio-tracks.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cross-browser implementation of audio tracks.
They must be added programmatically.
* Video.js only stores track representations. Switching audio tracks for playback is
_not handled by Video.js_ and must be handled elsewhere - for example,
[videojs-contrib-hls](http://github.com/videojs/videojs-contrib-hls) handles switching
[videojs-contrib-hls][hls] handles switching
audio tracks to support track selection through the UI.

## Working with Audio Tracks
Expand Down Expand Up @@ -91,7 +91,7 @@ player.audioTracks().removeTrack(track);
## API

For more complete information, refer to the
[Video.js API docs](http://docs.videojs.com/docs/api/index.html), specifically:
[Video.js API docs](http://docs.videojs.com/), specifically:

* `Player#audioTracks`
* `AudioTrackList`
Expand Down Expand Up @@ -140,7 +140,7 @@ The valid [BCP 47](https://tools.ietf.org/html/bcp47) code for the language of t
track, e.g. `"en"` for English or `"es"` for Spanish.

For supported language translations, please see the [languages folder (/lang)](https://github.com/videojs/video.js/tree/master/lang)
located in the Video.js root and refer to the [languages guide](languages.md) for more
located in the Video.js root and refer to the [languages guide][languages-guide] for more
information on languages in Video.js.

#### `enabled`
Expand All @@ -154,4 +154,8 @@ than one, the last one to be enabled will end up being the only one. While the s
allows for more than one track to be enabled, Safari and most implementations only allow
one audio track to be enabled at a time.

[languages-guide]: /docs/guides/languages.md

[spec-audiotrack]: https://html.spec.whatwg.org/multipage/embedded-content.html#audiotrack

[hls]: http://github.com/videojs/videojs-contrib-hls
6 changes: 4 additions & 2 deletions docs/guides/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ A component is a JavaScript object that has the following features:
* The ability to listen for and trigger events.
* A lifecycle of initialization and disposal.

For more specifics on the programmatic interface of a component, see [the component API docs](http://docs.videojs.com/docs/api/component.html).
For more specifics on the programmatic interface of a component, see [the component API docs][api].

## Creating a Component

Expand Down Expand Up @@ -75,7 +75,7 @@ console.log(button.el());

## Component Children

Again, refer to [the component API docs](http://docs.videojs.com/docs/api/component.html) for complete details on methods available for managing component structures.
Again, refer to [the component API docs][api] for complete details on methods available for managing component structures.

### Basic Example

Expand Down Expand Up @@ -336,3 +336,5 @@ let player = videojs('myplayer', {
### Text Track Settings

The text track settings component is only available when using emulated text tracks.

[api]: http://docs.videojs.com/Component.html
2 changes: 1 addition & 1 deletion docs/guides/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ Finally, the history (if enabled) can be cleared at any time via:
videojs.log.history.clear();
```

[api]: http://docs.videojs.com/docs/api/index.html
[api]: http://docs.videojs.com/

[console]: https://developer.mozilla.org/en-US/docs/Web/API/Console
21 changes: 13 additions & 8 deletions docs/guides/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ with your issue.
A reduced test case is an example of the problem that you are facing in isolation.
Think of it as example page that reproduces the issue in the least amount of possible code.
We have a [starter example][starter-example] for reduced test cases. To learn more
about reduced test cases visit [css-tricks](https://css-tricks.com/reduced-test-cases/)
about reduced test cases visit [css-tricks][reduced-test-case]

## Q: What media formats does video.js support?

Expand Down Expand Up @@ -270,19 +270,25 @@ Be sure to use `require('!style-loader!css-loader!video.js/dist/video-js.css')`

## Q: Does video.js work with react?

Yes! See [ReactJS integration example](./guides/react.md).
Yes! See [ReactJS integration example][react-guide].

[plugin-guide]: plugins.md
[reduced-test-case]: https://css-tricks.com/reduced-test-cases/

[react-guide]: /docs/guides/react.md

[plugin-guide]: /docs/guides/plugins.md

[install-guide]: http://videojs.com/getting-started/

[troubleshooting]: troubleshooting.md
[troubleshooting]: /docs/guides/troubleshooting.md

[video-tracks]: /docs/guides/video-tracks.md

[video-tracks]: video-tracks.md
[audio-tracks]: /docs/guides/audio-tracks.md

[audio-tracks]: audio-tracks.md
[text-tracks]: /docs/guides/text-tracks.md

[text-tracks]: text-tracks.md
[debug-guide]: /docs/guides/debugging.md

[pr-issue-question]: #q-i-think-i-found-a-bug-with-videojs-or-i-want-to-add-a-feature-what-should-i-do

Expand Down Expand Up @@ -324,4 +330,3 @@ Yes! See [ReactJS integration example](./guides/react.md).

[starter-example]: http://jsbin.com/axedog/edit?html,output

[debug-guide]: ./guides/debug.md
14 changes: 7 additions & 7 deletions docs/guides/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ Finally, each file's extension is always `.json`.

### Updating an Existing Translation

If there is a [missing translation](../translations-needed.md), mistake, or room for improvement in an existing translation, don't hesitate to open a pull request!
If there is a [missing translation](/docs/translations-needed.md), mistake, or room for improvement in an existing translation, don't hesitate to open a pull request!

1. Edit the relevant JSON file and make the necessary changes.
1. Verify the language compiles by running `grunt dist`.
1. Verify the translation appears properly in the player UI.
1. Run `grunt check-translations` to update the [missing translation document](../translations-needed.md).
1. Run `grunt check-translations` to update the [missing translation document](/docs/translations-needed.md).
1. Commit and open a pull request on GitHub.

### Writing a New Translation
Expand Down Expand Up @@ -103,7 +103,7 @@ videojs.addLanguage('es', {

### Per-Player Languages

In addition to providing languages to Video.js itself, individual `Player` instances can be provided custom language support via [the `languages` option](options.md#languages):
In addition to providing languages to Video.js itself, individual `Player` instances can be provided custom language support via [the `languages` option](/docs/guides/options.md#languages):

```js
// Provide a custom definition of Spanish to this player.
Expand All @@ -116,7 +116,7 @@ videojs('my-player', {

### Setting Default Player Language

Player instances can also have a default language via [the `language` option](options.md#language):
Player instances can also have a default language via [the `language` option](/docs/guides/options.md#language):

```js
// Set the default language to Spanish for this player.
Expand All @@ -143,14 +143,14 @@ The player language is set to one of the following in descending priority:

## References

For information on translation/localization in plugins, see [the plugins guide](plugins.md).
For information on translation/localization in plugins, see [the plugins guide](/docs/guides/plugins.md).

Standard languages codes [are defined by the IANA][lang-codes].

For all existing/supported languages, please see the [languages lolder (`lang/`)][lang-supported] folder located in the project root.

[lang-en]: https://github.com/videojs/video.js/tree/master/lang/en.json
[lang-en]: /lang/en.json

[lang-supported]: https://github.com/videojs/video.js/tree/master/lang
[lang-supported]: /lang

[lang-codes]: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
6 changes: 3 additions & 3 deletions docs/guides/modal-dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The `ModalDialog` component is part of Video.js core and provides a baked-in UI

## Table of Contents

* [Creating the ModalDialog](#creating-the-modaldialog)
* [Creating a ModalDialog](#creating-a-modaldialog)
* [Example Using createModal()](#example-using-createmodal)
* [Example Using the ModalDialog Constructor](#example-using-the-modaldialog-constructor)
* [Styling Modals Independently](#styling-modals-independently)
Expand Down Expand Up @@ -73,6 +73,6 @@ A common need for modals is to style them independently from one another. The re
modal.addClass('vjs-my-fancy-modal');
```

[api-doc]: http://docs.videojs.com/docs/api/modal-dialog.html
[api-doc]: http://docs.videojs.com/ModalDialog.html

[creating-component]: ./components.md#creating-a-component
[creating-component]: /docs/guides/components.md#creating-a-component
16 changes: 10 additions & 6 deletions docs/guides/options.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Video.js Options Reference

> **Note:** This document is only a reference for available options. To learn about passing options to Video.js, see [the setup guide](setup.md#options).
> **Note:** This document is only a reference for available options. To learn about passing options to Video.js, see [the setup guide](/docs/guides/setup.md#options).
## Table of Contents

Expand Down Expand Up @@ -41,7 +41,7 @@

## Standard `<video>` Element Options

Each of these options is also available as a [standard `<video>` element attribute][video-attrs]; so, they can be defined in all three manners [outlined in the setup guide](setup.md#options). Typically, defaults are not listed as this is left to browser vendors.
Each of these options is also available as a [standard `<video>` element attribute][video-attrs]; so, they can be defined in all three manners [outlined in the setup guide](/docs/guides/setup.md#options). Typically, defaults are not listed as this is left to browser vendors.

### `autoplay`

Expand Down Expand Up @@ -151,15 +151,15 @@ The `inactivityTimeout` determines how many milliseconds of inactivity is requir
A [language code][lang-codes] matching one of the available languages in the player. This sets the initial language for a player, but it can always be changed.

Learn more about [languages in Video.js](languages.md).
Learn more about [languages in Video.js][languages].

### `languages`

> Type: `Object`
Customize which languages are available in a player. The keys of this object will be [language codes][lang-codes] and the values will be objects with English keys and translated values.

Learn more about [languages in Video.js](languages.md).
Learn more about [languages in Video.js][languages]

> **Note**: Generally, this option is not needed and it would be better to pass your custom languages to `videojs.addLanguage()`, so they are available in all players!
Expand Down Expand Up @@ -201,7 +201,7 @@ player.boo({baz: false});

Although, since the `plugins` option is an object, the order of initialization is not guaranteed!

See [the plugins guide](plugins.md) for more information on Video.js plugins.
See [the plugins guide][plugins] for more information on Video.js plugins.

### `sourceOrder`

Expand Down Expand Up @@ -291,7 +291,7 @@ This option will be used in the "novtt" build of video.js (i.e. `video.novtt.js`

The Video.js player is a component. Like all components, you can define what children it includes, what order they appear in, and what options are passed to them.

This is meant to be a quick reference; so, for more detailed information on components in Video.js, check out the [components guide](components.md).
This is meant to be a quick reference; so, for more detailed information on components in Video.js, check out the [components guide](/docs/guides/components.md).

### `children`

Expand Down Expand Up @@ -374,6 +374,10 @@ Only supported by the `Html5` tech, this option can be set to `true` to force na
Can be set to `false` to force emulation of text tracks instead of native support. The `nativeCaptions` option also exists, but is simply an alias to `nativeTextTracks`.

[plugins]: /docs/guides/plugins.md

[languages]: /docs/guides/languages.md

[ios-10-updates]: https://webkit.org/blog/6784/new-video-policies-for-ios/

[lang-codes]: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
Expand Down
8 changes: 4 additions & 4 deletions docs/guides/player-workflows.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Player Workflows

This document outlines many considerations for using Video.js for advanced player workflows. Be sure to read [the setup guide](setup.md) first!
This document outlines many considerations for using Video.js for advanced player workflows. Be sure to read [the setup guide](/docs/guides/setup.md) first!

## Table of Contents

Expand Down Expand Up @@ -31,9 +31,9 @@ After an instance has been created it can be accessed globally in two ways:

No matter the term used for it, web applications are becoming common. Not everything is a static, load-once-and-done web page anymore! This means that developers need to be able to manage the full lifecycle of a video player - from creation to destruction. Video.js supports player removal through the `dispose()` method.

### [`dispose()`](http://docs.videojs.com/docs/api/player.html#Methodsdispose)
### [`dispose()`](http://docs.videojs.com/Player.html#dispose)

This method is available on all Video.js players and [components](http://docs.videojs.com/docs/api/component.html#Methodsdispose). It is _the only_ supported method of removing a Video.js player from both the DOM and memory. For example, the following code sets up a player and then disposes it when media playback is complete:
This method is available on all Video.js players and [components](http://docs.videojs.com/Component.html#dispose). It is _the only_ supported method of removing a Video.js player from both the DOM and memory. For example, the following code sets up a player and then disposes it when media playback is complete:

```js
var player = videojs('my-player');
Expand Down Expand Up @@ -367,7 +367,7 @@ Coming soon...

### React

See [ReactJS integration example](./react.md)
See [ReactJS integration example](/docs/guides/react.md)

### Ember

Expand Down
12 changes: 8 additions & 4 deletions docs/guides/plugins.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Video.js Plugins

One of the great strengths of Video.js is its ecosystem of plugins that allow authors from all over the world to share their video player customizations. This includes everything from the simplest UI tweaks to new [playback technologies and source handlers](tech.md)!
One of the great strengths of Video.js is its ecosystem of plugins that allow authors from all over the world to share their video player customizations. This includes everything from the simplest UI tweaks to new [playback technologies and source handlers][tech]!

Because we view plugins as such an important part of Video.js, the organization is committed to maintaining a robust set of tools for plugin authorship:

Expand Down Expand Up @@ -63,7 +63,7 @@ While reading the following sections, you may want to refer to the [Plugin API d

### Write a JavaScript Class/Constructor

If you're familiar with creating [components](components.md), this process is similar. An advanced plugin starts with a JavaScript class (a.k.a. a constructor function).
If you're familiar with creating [components][components], this process is similar. An advanced plugin starts with a JavaScript class (a.k.a. a constructor function).

If you're using ES6 already, you can use that syntax with your transpiler/language of choice (Babel, TypeScript, etc):

Expand Down Expand Up @@ -314,9 +314,13 @@ These two methods are functionally identical - use whichever you prefer!
* [Plugin Generator][generator]
* [Plugin Conventions][standards]

[api-player]: http://docs.videojs.com/docs/api/player.html
[components]: /docs/guides/components.md

[api-plugin]: http://docs.videojs.com/docs/api/plugin.html
[tech]: /docs/guides/tech.md

[api-player]: http://docs.videojs.com/Player.html

[api-plugin]: http://docs.videojs.com/Plugin.html

[generator]: https://github.com/videojs/generator-videojs-plugin

Expand Down
5 changes: 3 additions & 2 deletions docs/guides/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ export default class VideoPlayer extends React.Component {
}
```

You can then use it like this:
You can then use it like this: (see [options guide][options] for option information)

```jsx
// see https://github.com/videojs/video.js/blob/master/docs/guides/options.md
const videoJsOptions = {
autoplay: true,
controls: true,
Expand All @@ -53,3 +52,5 @@ return <VideoPlayer { ...videoJsOptions } />
```

Dont forget to include the video.js CSS, located at `video.js/dist/video-js.css`.

[options]: /docs/guides/options.md
8 changes: 5 additions & 3 deletions docs/guides/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ videojs(document.querySelector('.video-js'));

## Options

> **Note:** This guide only covers how to pass options during player setup. For a complete reference on _all_ available options, see the [options guide](options.md).
> **Note:** This guide only covers how to pass options during player setup. For a complete reference on _all_ available options, see the [options guide](/docs/guides/options.md).
There are three ways to pass options to Video.js. Because Video.js decorates an HTML5 `<video>` element, many of the options available are also available as [standard `<video>` tag attributes][video-attrs]:

Expand Down Expand Up @@ -175,7 +175,9 @@ In each case, the callback is called asynchronously - _even if the player is alr

## Advanced Player Workflows

For a discussion of more advanced player workflows, see the [player workflows guide](player-workflows.md).
For a discussion of more advanced player workflows, see the [player workflows guide][player-workflows].

[player-workflows]: /docs/guides/player-workflows.md

[boolean-attrs]: https://www.w3.org/TR/2011/WD-html5-20110525/common-microsyntaxes.html#boolean-attributes

Expand All @@ -185,7 +187,7 @@ For a discussion of more advanced player workflows, see the [player workflows gu

[video-attrs]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#Attributes

[videojs]: http://docs.videojs.com/docs/api/video.html
[videojs]: http://docs.videojs.com/module-videojs.html

[w3c-media-events]: https://www.w3.org/2010/05/video/mediaevents.html

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/text-tracks.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The boolean `default` attribute can be used to indicate that a track's mode shou
The valid [BCP 47](https://tools.ietf.org/html/bcp47) code for the language of the text track, e.g. `"en"` for English or `"es"` for Spanish.

For supported language translations, please see the [languages folder (/lang)](https://github.com/videojs/video.js/tree/master/lang) folder located in the Video.js root and refer to the [languages guide](./languages.md) for more information on languages in Video.js.
For supported language translations, please see the [languages folder (/lang)](https://github.com/videojs/video.js/tree/master/lang) folder located in the Video.js root and refer to the [languages guide](/docs/guides/languages.md) for more information on languages in Video.js.

### Text Tracks from Another Domain

Expand Down Expand Up @@ -214,7 +214,7 @@ In general, `"descriptions"` tracks are of lower precedence than `"captions"` an

## API

For more complete information, refer to the [Video.js API docs](http://docs.videojs.com/docs/api/index.html).
For more complete information, refer to the [Video.js API docs](http://docs.videojs.com/).

### Remote Text Tracks

Expand Down
Loading

0 comments on commit 61e2078

Please sign in to comment.