# mkdocs-video2-plugin
MkDocs plugin for embedding videos in generated documentation.
This plugin allows you to embed videos directly in your markdown content using a simple comment-based syntax that gets converted to HTML video elements.

## Setup
Install the plugin using pip:
```bash
pip install mkdocs-video2-plugin
```
Activate the plugin in `mkdocs.yaml`:
```yaml
plugins:
- video2:
video_autoplay: false # Enable/disable autoplay by default
video_muted: false # Enable/disable muted by default
video_loop: false # Enable/disable loop by default
video_controls: true # Enable/disable controls by default
video_type: "mp4" # Default video type
```
## Usage
To embed a video in your markdown, use the following syntax:
```markdown
https://example.com/video.mp4 <!--video 640x480 autoplay=true mute=true loop=false controls=true-->
```
### Parameters
The video comment supports the following parameters:
- **Dimensions**: `640x480` - Set video width and height
- **autoplay**: `true|false` - Enable/disable autoplay
- **mute**: `true|false` - Enable/disable muted audio
- **loop**: `true|false` - Enable/disable video looping
- **controls**: `true|false` - Show/hide video controls
- **type**: `mp4|webm|ogg|quicktime` - Explicit video type (optional)
### Examples
Basic video with custom dimensions:
```markdown
https://example.com/video.mp4 <!--video 640x480-->
```
Video with all options:
```markdown
https://example.com/video.webm <!--video 1280x720 autoplay=true mute=true loop=true controls=true type=video/webm-->
```
Multiple videos:
```markdown
First video:
https://example.com/video1.mp4 <!--video 640x480 autoplay=true-->
Second video:
https://example.com/video2.webm <!--video 800x600 loop=true controls=false-->
```
## Supported Video Formats
The plugin automatically detects video types from URL extensions:
- **MP4**: `.mp4` → `video/mp4`
- **WebM**: `.webm` → `video/webm`
- **OGG**: `.ogg` → `video/ogg`
- **QuickTime**: `.mov` → `video/quicktime`
- **AVI**: `.avi` → `video/x-msvideo`
- **WMV**: `.wmv` → `video/x-ms-wmv`
For URLs without clear extensions, you can specify the type explicitly:
```markdown
https://example.com/video <!--video 640x480 type=mp4-->
https://example.com/video <!--video 640x480 type=video/webm-->
```
## Generated HTML
The plugin converts the markdown syntax into standard HTML5 video elements:
```html
<video width="640" height="480" controls muted>
<source src="https://example.com/video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
```
## Development
### Running Tests
To run the tests, use the following commands:
```bash
# Run tests directly
python3 mkdocs_video2_plugin/test_plugin.py
# Run tests with verbose output
python3 mkdocs_video2_plugin/test_plugin.py --verbose
# Run with unittest discovery
python3 -m unittest discover -s mkdocs_video2_plugin -p "test_*.py"
```
### Project Structure
```
mkdocs-video2-plugin/
├── mkdocs_video2_plugin/
│ ├── __init__.py
│ ├── plugin.py # Main plugin implementation
│ ├── test_plugin.py # Unit tests
│ └── example.md # Usage examples
├── README.md
├── setup.py
└── mkdocs.yaml
```
Raw data
{
"_id": null,
"home_page": "https://github.com/mihaigalos/mkdocs-video2-plugin",
"name": "mkdocs-video2-plugin",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "mkdocs plugin",
"author": "Mihai Galos",
"author_email": "mihai@galos.one",
"download_url": "https://files.pythonhosted.org/packages/3b/ae/893ad11a5a6a5a71282e2bac69a0d6c7676f3ff3c1fac21dff83c1e08860/mkdocs_video2_plugin-0.0.1.tar.gz",
"platform": null,
"description": "# mkdocs-video2-plugin\n\nMkDocs plugin for embedding videos in generated documentation.\n\nThis plugin allows you to embed videos directly in your markdown content using a simple comment-based syntax that gets converted to HTML video elements.\n\n\n\n## Setup\n\nInstall the plugin using pip:\n\n```bash\npip install mkdocs-video2-plugin\n```\n\nActivate the plugin in `mkdocs.yaml`:\n\n```yaml\nplugins:\n - video2:\n video_autoplay: false # Enable/disable autoplay by default\n video_muted: false # Enable/disable muted by default\n video_loop: false # Enable/disable loop by default\n video_controls: true # Enable/disable controls by default\n video_type: \"mp4\" # Default video type\n```\n\n## Usage\n\nTo embed a video in your markdown, use the following syntax:\n\n```markdown\nhttps://example.com/video.mp4 <!--video 640x480 autoplay=true mute=true loop=false controls=true-->\n```\n\n### Parameters\n\nThe video comment supports the following parameters:\n\n- **Dimensions**: `640x480` - Set video width and height\n- **autoplay**: `true|false` - Enable/disable autoplay\n- **mute**: `true|false` - Enable/disable muted audio\n- **loop**: `true|false` - Enable/disable video looping\n- **controls**: `true|false` - Show/hide video controls\n- **type**: `mp4|webm|ogg|quicktime` - Explicit video type (optional)\n\n### Examples\n\nBasic video with custom dimensions:\n```markdown\nhttps://example.com/video.mp4 <!--video 640x480-->\n```\n\nVideo with all options:\n```markdown\nhttps://example.com/video.webm <!--video 1280x720 autoplay=true mute=true loop=true controls=true type=video/webm-->\n```\n\nMultiple videos:\n```markdown\nFirst video:\nhttps://example.com/video1.mp4 <!--video 640x480 autoplay=true-->\n\nSecond video:\nhttps://example.com/video2.webm <!--video 800x600 loop=true controls=false-->\n```\n\n## Supported Video Formats\n\nThe plugin automatically detects video types from URL extensions:\n\n- **MP4**: `.mp4` \u2192 `video/mp4`\n- **WebM**: `.webm` \u2192 `video/webm`\n- **OGG**: `.ogg` \u2192 `video/ogg`\n- **QuickTime**: `.mov` \u2192 `video/quicktime`\n- **AVI**: `.avi` \u2192 `video/x-msvideo`\n- **WMV**: `.wmv` \u2192 `video/x-ms-wmv`\n\nFor URLs without clear extensions, you can specify the type explicitly:\n\n```markdown\nhttps://example.com/video <!--video 640x480 type=mp4-->\nhttps://example.com/video <!--video 640x480 type=video/webm-->\n```\n\n## Generated HTML\n\nThe plugin converts the markdown syntax into standard HTML5 video elements:\n\n```html\n<video width=\"640\" height=\"480\" controls muted>\n <source src=\"https://example.com/video.mp4\" type=\"video/mp4\">\n Your browser does not support the video tag.\n</video>\n```\n\n## Development\n\n### Running Tests\n\nTo run the tests, use the following commands:\n\n```bash\n# Run tests directly\npython3 mkdocs_video2_plugin/test_plugin.py\n\n# Run tests with verbose output\npython3 mkdocs_video2_plugin/test_plugin.py --verbose\n\n# Run with unittest discovery\npython3 -m unittest discover -s mkdocs_video2_plugin -p \"test_*.py\"\n```\n\n### Project Structure\n\n```\nmkdocs-video2-plugin/\n\u251c\u2500\u2500 mkdocs_video2_plugin/\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 plugin.py # Main plugin implementation\n\u2502 \u251c\u2500\u2500 test_plugin.py # Unit tests\n\u2502 \u2514\u2500\u2500 example.md # Usage examples\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 setup.py\n\u2514\u2500\u2500 mkdocs.yaml\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Embedding of videos in generated mkdocs files.",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/mihaigalos/mkdocs-video2-plugin"
},
"split_keywords": [
"mkdocs",
"plugin"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "578418046288908f6686998f69e27a76845ec7a8798bebc3ae79a92577162cc0",
"md5": "f11b7ef41fc9b25fea1fa0da3ff6d870",
"sha256": "16f668bfbf2386f8eca9324c9325d3f695994e9928b5dd3bf27215c8ab35dec1"
},
"downloads": -1,
"filename": "mkdocs_video2_plugin-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f11b7ef41fc9b25fea1fa0da3ff6d870",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 7629,
"upload_time": "2025-08-06T20:32:24",
"upload_time_iso_8601": "2025-08-06T20:32:24.710016Z",
"url": "https://files.pythonhosted.org/packages/57/84/18046288908f6686998f69e27a76845ec7a8798bebc3ae79a92577162cc0/mkdocs_video2_plugin-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "3bae893ad11a5a6a5a71282e2bac69a0d6c7676f3ff3c1fac21dff83c1e08860",
"md5": "e9c8bc46987ed3b51d9eaa07269b86ce",
"sha256": "1647a849fc5e56ddf57146550890430dd010024bd34b0b9f6f6f461cae74eacc"
},
"downloads": -1,
"filename": "mkdocs_video2_plugin-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "e9c8bc46987ed3b51d9eaa07269b86ce",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 6508,
"upload_time": "2025-08-06T20:32:26",
"upload_time_iso_8601": "2025-08-06T20:32:26.627562Z",
"url": "https://files.pythonhosted.org/packages/3b/ae/893ad11a5a6a5a71282e2bac69a0d6c7676f3ff3c1fac21dff83c1e08860/mkdocs_video2_plugin-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-06 20:32:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mihaigalos",
"github_project": "mkdocs-video2-plugin",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "mkdocs",
"specs": []
}
],
"tox": true,
"lcname": "mkdocs-video2-plugin"
}