├── .gitignore
├── LICENSE
├── README.md
├── deploy.sh
├── mkdocs_bootstrap_tables_plugin
├── __init__.py
└── plugin.py
├── requirements.txt
└── setup.py
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 |
3 | # Byte-compiled / optimized / DLL files
4 | __pycache__/
5 | *.py[cod]
6 | *$py.class
7 |
8 | # C extensions
9 | *.so
10 |
11 | # Distribution / packaging
12 | .Python
13 | build/
14 | develop-eggs/
15 | dist/
16 | downloads/
17 | eggs/
18 | .eggs/
19 | lib/
20 | lib64/
21 | parts/
22 | sdist/
23 | var/
24 | wheels/
25 | share/python-wheels/
26 | *.egg-info/
27 | .installed.cfg
28 | *.egg
29 | MANIFEST
30 |
31 | # PyInstaller
32 | # Usually these files are written by a python script from a template
33 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
34 | *.manifest
35 | *.spec
36 |
37 | # Installer logs
38 | pip-log.txt
39 | pip-delete-this-directory.txt
40 |
41 | # Unit test / coverage reports
42 | htmlcov/
43 | .tox/
44 | .nox/
45 | .coverage
46 | .coverage.*
47 | .cache
48 | nosetests.xml
49 | coverage.xml
50 | *.cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 |
63 | # Flask stuff:
64 | instance/
65 | .webassets-cache
66 |
67 | # Scrapy stuff:
68 | .scrapy
69 |
70 | # Sphinx documentation
71 | docs/_build/
72 |
73 | # PyBuilder
74 | target/
75 |
76 | # Jupyter Notebook
77 | .ipynb_checkpoints
78 |
79 | # IPython
80 | profile_default/
81 | ipython_config.py
82 |
83 | # pyenv
84 | .python-version
85 |
86 | # celery beat schedule file
87 | celerybeat-schedule
88 |
89 | # SageMath parsed files
90 | *.sage.py
91 |
92 | # Environments
93 | .env
94 | .venv
95 | env/
96 | venv/
97 | ENV/
98 | env.bak/
99 | venv.bak/
100 |
101 | # Spyder project settings
102 | .spyderproject
103 | .spyproject
104 |
105 | # Rope project settings
106 | .ropeproject
107 |
108 | # mkdocs documentation
109 | /site
110 |
111 | # mypy
112 | .mypy_cache/
113 | .dmypy.json
114 | dmypy.json
115 |
116 | # Pyre type checker
117 | .pyre/
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2018 Your Name Here
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # mkdocs-bootstrap-tables-plugin
2 |
3 | This plugin converts the raw `
` elements that result from basic markdown, and augments them with [Bootstrap table classes](https://getbootstrap.com/docs/4.0/content/tables/) for improved styling.
4 |
5 | ## Setup
6 |
7 | Install the plugin using pip:
8 |
9 | `pip install mkdocs-bootstrap-tables-plugin`
10 |
11 | Activate the plugin in `mkdocs.yml`:
12 | ```yaml
13 | plugins:
14 | - search
15 | - bootstrap-tables
16 | ```
17 |
18 | > **Note:** If you have no `plugins` entry in your config file yet, you'll likely also want to add the `search` plugin. MkDocs enables it by default if there is no `plugins` entry set, but now you have to enable it explicitly.
19 |
20 | More information about plugins in the [MkDocs documentation][mkdocs-plugins].
21 |
22 | ## Usage
23 |
24 | Enabling this plugin will take a simple table generated by markdown:
25 |
26 | ### Original Markdown
27 |
28 | ```
29 | | Parameter | Type | Description |
30 | | --------------- | ------ | ----------- |
31 | | `foo` | string | A parameter that does something. |
32 | | `bar` | int | A parameter that does something. |
33 | | `baz` | URI | Required. You better use this. |
34 | ```
35 |
36 | ### HTML before processing
37 |
38 | This is the HTML that Markdown will produce:
39 |
40 | ```html
41 |
42 |
43 |
44 | Parameter |
45 | Type |
46 | Description |
47 |
48 |
49 |
50 |
51 | foo |
52 | string |
53 | |
54 |
55 |
56 |
|
57 | int |
58 | A parameter that does something. |
59 |
60 |
61 | baz |
62 | A parameter that does something.URI |
63 | Required. You better use this. |
64 |
65 |
66 |
67 | ```
68 |
69 | ### HTML after processing
70 |
71 | This is the HTML after this plugin has run:
72 |
73 | ```html
74 |
75 |
76 |
77 | Parameter |
78 | Type |
79 | Description |
80 |
81 |
82 |
83 |
84 | foo |
85 | string |
86 | |
87 |
88 |
89 |
|
90 | int |
91 | A parameter that does something. |
92 |
93 |
94 | baz |
95 | A parameter that does something.URI |
96 | Required. You better use this. |
97 |
98 |
99 |
100 | ```
101 |
102 | ## See Also
103 |
104 | More information about templates [here][mkdocs-template].
105 |
106 | More information about blocks [here][mkdocs-block].
107 |
108 | [mkdocs-plugins]: http://www.mkdocs.org/user-guide/plugins/
109 | [mkdocs-template]: https://www.mkdocs.org/user-guide/custom-themes/#template-variables
110 | [mkdocs-block]: https://www.mkdocs.org/user-guide/styling-your-docs/#overriding-template-blocks
111 |
--------------------------------------------------------------------------------
/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | rm -rf dist
4 | python setup.py bdist_wheel sdist --formats gztar && twine upload dist/*
5 |
--------------------------------------------------------------------------------
/mkdocs_bootstrap_tables_plugin/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/byrnereese/mkdocs-bootstrap-tables-plugin/fa2baddecc7ac288fe75a29cf05f2bffd92ba462/mkdocs_bootstrap_tables_plugin/__init__.py
--------------------------------------------------------------------------------
/mkdocs_bootstrap_tables_plugin/plugin.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 | import re
4 | from timeit import default_timer as timer
5 | from datetime import datetime, timedelta
6 |
7 | from mkdocs import utils as mkdocs_utils
8 | from mkdocs.config import config_options, Config
9 | from mkdocs.plugins import BasePlugin
10 |
11 | class BootstrapTablesPlugin(BasePlugin):
12 |
13 | config_scheme = (
14 | ('param', config_options.Type(str, default='')),
15 | )
16 |
17 | def __init__(self):
18 | self.enabled = True
19 | self.total_time = 0
20 |
21 | def on_post_page(self, output_content, page, config):
22 | output_content = re.sub(r"", "", output_content)
23 | output_content = re.sub(r"", " | ", output_content)
24 | return output_content
25 |
26 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | mkdocs==1.0.3
2 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup, find_packages
2 |
3 |
4 | setup(
5 | name='mkdocs-bootstrap-tables-plugin',
6 | version='0.1.1',
7 | description='A MkDocs plugin to add bootstrap classes to plan markdown generated tables.',
8 | long_description='',
9 | keywords='mkdocs bootstrap css',
10 | url='https://github.com/byrnereese/mkdocs-bootstrap-tables-plugin',
11 | author='Byrne Reese',
12 | author_email='byrne@majordojo.com',
13 | license='MIT',
14 | python_requires='>=3.5',
15 | install_requires=[
16 | 'mkdocs>=1.0.4'
17 | ],
18 | classifiers=[
19 | 'Development Status :: 4 - Beta',
20 | 'Intended Audience :: Developers',
21 | 'Intended Audience :: Information Technology',
22 | 'License :: OSI Approved :: MIT License',
23 | 'Programming Language :: Python',
24 | 'Programming Language :: Python :: 3 :: Only',
25 | 'Programming Language :: Python :: 3.4',
26 | 'Programming Language :: Python :: 3.5',
27 | 'Programming Language :: Python :: 3.6',
28 | 'Programming Language :: Python :: 3.7'
29 | ],
30 | packages=find_packages(),
31 | entry_points={
32 | 'mkdocs.plugins': [
33 | 'bootstrap-tables = mkdocs_bootstrap_tables_plugin.plugin:BootstrapTablesPlugin'
34 | ]
35 | }
36 | )
37 |
--------------------------------------------------------------------------------
|