Skip to content

Commit 9917708

Browse files
authored
Merge pull request #14 from yacir/docs
Add the documentation
2 parents ca956a6 + a360eeb commit 9917708

15 files changed

Lines changed: 510 additions & 79 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ instance/
6262
# Scrapy stuff:
6363
.scrapy
6464

65-
# Sphinx documentation
66-
docs/_build/
65+
# Documentation
66+
docs/site/
6767

6868
# PyBuilder
6969
target/

CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## 1.0.3 (2018-05-27)
2-
* Avoid adding the `<div class="md-fenced-code-tabs"></div> structure for single code blocks if the `single_block_as_tab` option is `True`.
2+
* Avoid adding the `<div class="md-fenced-code-tabs"></div>` structure for single code blocks if the `single_block_as_tab` option is `True`.
33

44
## 1.0.2 (2018-05-27)
55
* **FIX**: Fixed the Bootsrap templates

README.md

Lines changed: 14 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,26 @@
1-
[![PyPI][pypi-image]][pypi-link]
2-
3-
[pypi-image]: https://img.shields.io/pypi/v/markdown-fenced-code-tabs.svg
4-
[pypi-link]: https://pypi.python.org/pypi/markdown-fenced-code-tabs
1+
<p align="center">
2+
<a href="https://pypi.python.org/pypi/markdown-fenced-code-tabs">
3+
<img src="https://img.shields.io/pypi/v/markdown-fenced-code-tabs.svg"/>
4+
</a>
5+
<img src="https://img.shields.io/pypi/pyversions/markdown-fenced-code-tabs.svg"/>
6+
<img src="https://img.shields.io/pypi/l/markdown-fenced-code-tabs.svg"/>
7+
</p>
58

69
# Markdown Code Tabs Extension
710

8-
Generates Bootstrap HTML Tabs for Consecutive Markdown Fenced Code Blocks
9-
10-
```md
11-
```http
12-
GET / HTTP/1.1
13-
User-Agent: MyClient/1.0.0
14-
Accept: application/vnd.travis-ci.2+json
15-
Host: api.travis-ci.org
16-
17-
HTTP/1.1 200 OK
18-
Content-Type: application/json
19-
20-
{"hello":"world"}
21-
```
22-
23-
```shell
24-
$ travis raw /
25-
{"hello":"world"}
26-
```
27-
28-
```ruby
29-
require 'travis'
30-
31-
# You usually don't want to fire API requests manually
32-
client = Travis::Client.new
33-
client.get_raw('/') # => {"hello"=>"world"}
34-
35-
client.get('/repos/sinatra/sinatra')
36-
# => {"repo"=>#<Travis::Client::Repository: sinatra/sinatra>}
37-
```
38-
```
39-
40-
Becomes:
41-
42-
![Generated result](docs/images/img1.png)
11+
**Code Tabs** is an extension that generates a HTML structure for consecutive fenced code blocks content.
4312

44-
To customize the tab label, add the `fct_label` option to your code block.
13+
## Quick start
4514

46-
```md
47-
```swift fct_label="Swift 2"
48-
array.enumerate()
49-
```
15+
Installation is easy with pip:
5016

51-
```swift fct_label="Swift 3"
52-
array.enumerated()
53-
```
54-
```
55-
56-
![Generated result](docs/images/img2.png)
57-
58-
## Installation
59-
60-
Install the latest version with `pip`:
61-
```sh
17+
``` sh
6218
pip install markdown-fenced-code-tabs
63-
```
64-
65-
## MkDocs Usage
66-
67-
```yml
68-
markdown_extensions:
69-
- markdown_fenced_code_tabs:
70-
single_block_as_tab: True
71-
```
72-
73-
## Options
74-
75-
### `single_block_as_tab`
76-
If `True`, the extension will render a single code block as a tab. Default is `False`.
77-
78-
`single_block_as_tab: True` generates:
79-
80-
![True single_block_as_tab](docs/images/img3.png)
19+
```
8120

82-
`single_block_as_tab: False` generates:
21+
For detailed installation instructions and a demo, visit
22+
[the documentation](https://yacir.github.io/markdown-fenced-code-tabs/).
8323

84-
![False single_block_as_tab](docs/images/img4.png)
8524

8625
## Author
8726
[Yassir Barchi](http://yassir.fr)

docs/images/img1.png

-23.4 KB
Binary file not shown.

docs/images/img2.png

-5.97 KB
Binary file not shown.

docs/images/img3.png

-3.21 KB
Binary file not shown.

docs/images/img4.png

-2.2 KB
Binary file not shown.

docs/mkdocs.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
site_name: MD Code Tabs Extension
2+
site_url: https://yacir.github.io/markdown-fenced-code-tabs
3+
repo_url: https://github.com/yacir/markdown-fenced-code-tabs
4+
edit_uri: tree/master/docs/src/
5+
site_description: Markdown extension who generates HTML tabs for consecutive fenced code blocks in markdown syntax
6+
copyright: |
7+
Copyright &copy; 2017 - present <a href="https://github.com/yacir">Yassir Barchi</a>
8+
9+
docs_dir: src
10+
theme:
11+
name: material
12+
language: en
13+
palette:
14+
primary: light-blue
15+
accent: light-blue
16+
logo:
17+
icon: description
18+
font:
19+
text: 'Ubuntu'
20+
code: 'Ubuntu Mono'
21+
include_search_page: false
22+
search_index_only: true
23+
24+
pages:
25+
- Getting Started: index.md
26+
- Templates: templates.md
27+
- Release Notes: release-notes.md
28+
- Contributing & Support: contributing.md
29+
- Licence: licence.md
30+
31+
markdown_extensions:
32+
- markdown.extensions.admonition
33+
- markdown.extensions.codehilite:
34+
guess_lang: false
35+
- markdown.extensions.toc:
36+
permalink: true
37+
- pymdownx.betterem:
38+
smart_enable: all
39+
- pymdownx.details
40+
- pymdownx.emoji:
41+
emoji_generator: !!python/name:pymdownx.emoji.to_svg
42+
- pymdownx.inlinehilite
43+
- pymdownx.magiclink
44+
- pymdownx.smartsymbols
45+
- pymdownx.tasklist:
46+
custom_checkbox: true
47+
- pymdownx.details
48+
- markdown_fenced_code_tabs
49+
50+
extra_css:
51+
- 'assets/css/code-tabs.css'

docs/src/assets/css/code-tabs.css

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.md-fenced-code-tabs * {
2+
box-sizing: border-box;
3+
}
4+
5+
.md-fenced-code-tabs {
6+
box-sizing: border-box;
7+
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12), 0 3px 1px -2px rgba(0,0,0,.2);
8+
max-width: 100%;
9+
border-radius: .2rem;
10+
}
11+
12+
.md-fenced-code-tabs {
13+
display: flex;
14+
position: relative;
15+
flex-wrap: wrap;
16+
width: 100%;
17+
}
18+
19+
.md-fenced-code-tabs input {
20+
position: absolute;
21+
opacity: 0;
22+
}
23+
24+
.md-fenced-code-tabs label {
25+
width: auto;
26+
cursor: pointer;
27+
font-size: 1.28rem;
28+
padding: 1.2rem 1.6rem;
29+
}
30+
31+
.md-fenced-code-tabs input:checked + label {
32+
color: #03a9f4;
33+
border-bottom: 2px solid #03a9f4;
34+
}
35+
36+
.md-fenced-code-tabs .code-tabpanel {
37+
display: none;
38+
width: 100%;
39+
order: 99;
40+
}
41+
42+
.md-fenced-code-tabs input:checked + label + .code-tabpanel {
43+
display: block;
44+
}
45+
46+
.md-fenced-code-tabs pre,
47+
.md-fenced-code-tabs .codehilite {
48+
width: 100%;
49+
margin: 0px;
50+
padding-top: 5px;
51+
padding-bottom: 5px;
52+
}

docs/src/contributing.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: It's people like you that make the open source community such a great community! 😊
2+
3+
Any type of contribution is welcome, not only code. You can help with
4+
5+
- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
6+
- **Code**: take a look at the [open issues](https://github.com/yacir/markdown-fenced-code-tabs/issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
7+
8+
## Your First Contribution
9+
10+
Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
11+
12+
## Submitting code
13+
14+
Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests.
15+
16+
## Code review process
17+
18+
The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge.
19+
It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you?
20+
21+
## Questions
22+
23+
If you have any questions or found a bug in the source code, create an [issue](https://github.com/yacir/markdown-fenced-code-tabs/issues) (protip: do a quick search first to see if someone else didn't ask the same question before!).

0 commit comments

Comments
 (0)