markdown-up 3.2.0__tar.gz → 3.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- markdown_up-3.3.0/PKG-INFO +156 -0
- markdown_up-3.3.0/README.md +131 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/pyproject.toml +1 -2
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up/app.py +1 -7
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up/main.py +5 -64
- markdown_up-3.3.0/src/markdown_up.egg-info/PKG-INFO +156 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up.egg-info/SOURCES.txt +0 -1
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up.egg-info/requires.txt +0 -1
- markdown_up-3.2.0/PKG-INFO +0 -318
- markdown_up-3.2.0/README.md +0 -292
- markdown_up-3.2.0/src/markdown_up/api.py +0 -158
- markdown_up-3.2.0/src/markdown_up.egg-info/PKG-INFO +0 -318
- {markdown_up-3.2.0 → markdown_up-3.3.0}/LICENSE +0 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/setup.cfg +0 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up/__init__.py +0 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up/__main__.py +0 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up/static/__init__.py +0 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up/static/index.html +0 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up/static/markdownUpIndex.bare +0 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up.egg-info/dependency_links.txt +0 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up.egg-info/entry_points.txt +0 -0
- {markdown_up-3.2.0 → markdown_up-3.3.0}/src/markdown_up.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: markdown-up
|
|
3
|
+
Version: 3.3.0
|
|
4
|
+
Summary: MarkdownUp is a Markdown viewer
|
|
5
|
+
Author-email: "Craig A. Hobbs" <craigahobbs@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/craigahobbs/markdown-up-py
|
|
8
|
+
Keywords: Markdown,viewer
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: chisel<2.5.0,>=2.4.0
|
|
23
|
+
Requires-Dist: waitress>=3.0.0
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# markdown-up
|
|
27
|
+
|
|
28
|
+
[](https://pypi.org/project/markdown-up/)
|
|
29
|
+
[](https://pypi.org/project/markdown-up/)
|
|
30
|
+
[](https://github.com/craigahobbs/markdown-up-py/blob/main/LICENSE)
|
|
31
|
+
[](https://pypi.org/project/markdown-up/)
|
|
32
|
+
|
|
33
|
+
MarkdownUp is a Markdown viewer.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Install MarkdownUp
|
|
37
|
+
|
|
38
|
+
Use Python's `pip` to install MarkdownUp as follows:
|
|
39
|
+
|
|
40
|
+
~~~
|
|
41
|
+
pip install markdown-up
|
|
42
|
+
~~~
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## View Markdown Files
|
|
46
|
+
|
|
47
|
+
To start MarkdownUp, open a terminal and run the `markdown-up` application:
|
|
48
|
+
|
|
49
|
+
~~~
|
|
50
|
+
markdown-up
|
|
51
|
+
~~~
|
|
52
|
+
|
|
53
|
+
The `markdown-up` application opens the web browser to the MarkdownUp file browser, which allows you
|
|
54
|
+
to view Markdown or HTML files and navigate directories. To view a file, click on its link.
|
|
55
|
+
|
|
56
|
+
You can view a specific file as follows:
|
|
57
|
+
|
|
58
|
+
~~~
|
|
59
|
+
markdown-up README.md
|
|
60
|
+
~~~
|
|
61
|
+
|
|
62
|
+
**Note:** MarkdownUp runs entirely offline. It does not use an external service to render Markdown
|
|
63
|
+
files.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## Running MarkdownUp
|
|
67
|
+
|
|
68
|
+
When you run the `markdown-up` application, in addition to opening the web browser, it starts a
|
|
69
|
+
[chisel](https://pypi.org/project/chisel/)
|
|
70
|
+
backend API application using
|
|
71
|
+
[waitress](https://pypi.org/project/waitress/).
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### Automatic HTML for Markdown Files
|
|
75
|
+
|
|
76
|
+
When you run MarkdownUp and click on a Markdown file link, the link navigates to an HTML file that
|
|
77
|
+
renders the Markdown file. Every Markdown file hosted by MarkdownUp has a corresponding `.html` file
|
|
78
|
+
of the same name. For example, if you run MarkdownUp in a directory that has the following Markdown
|
|
79
|
+
files: "README.md" and "CHANGELOG.md". The MarkdownUp service automatically generates "README.html"
|
|
80
|
+
and "CHANGELOG.html" files.
|
|
81
|
+
|
|
82
|
+
The generated `.html` files are HTML stubs for the
|
|
83
|
+
[MarkdownUp frontend application](https://github.com/craigahobbs/markdown-up#readme).
|
|
84
|
+
All Markdown parsing and rendering are done on the client.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
### Configuration File
|
|
88
|
+
|
|
89
|
+
The
|
|
90
|
+
[MarkdownUp Application Configuration File](https://craigahobbs.github.io/markdown-up-py/config.html#var.vName='MarkdownUpConfig'),
|
|
91
|
+
`markdown-up.json`, allows you to enable release mode, set the number of backend server threads, and more.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Command-Line Arguments
|
|
95
|
+
|
|
96
|
+
The `markdown-up` application has the following command-line arguments:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
usage: markdown-up [-h] [-p N] [-t N] [-n] [-r] [-q] [-c FILE] [path]
|
|
100
|
+
|
|
101
|
+
positional arguments:
|
|
102
|
+
path the file or directory to view (default is ".")
|
|
103
|
+
|
|
104
|
+
options:
|
|
105
|
+
-h, --help show this help message and exit
|
|
106
|
+
-p, --port N the application port (default is 8080)
|
|
107
|
+
-t, --threads N the number of web server threads (default is 8)
|
|
108
|
+
-n, --no-browser don't open a web browser
|
|
109
|
+
-r, --release release mode (cache statics, remove documentation and index)
|
|
110
|
+
-q, --quiet hide access logging
|
|
111
|
+
-c, --config FILE the application config filename (default is "markdown-up.json")
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
## MarkdownUp Applications
|
|
116
|
+
|
|
117
|
+
With MarkdownUp, you can write client-rendered frontend applications using
|
|
118
|
+
[BareScript](https://craigahobbs.github.io/bare-script/language/).
|
|
119
|
+
MarkdownUp applications are created by adding `markdown-script` fenced code blocks containing
|
|
120
|
+
[BareScript](https://craigahobbs.github.io/bare-script/language/)
|
|
121
|
+
to a Markdown file and viewing it with the MarkdownUp frontend application. When the Markdown file
|
|
122
|
+
is rendered, the BareScript is executed and its results are rendered in place. For example:
|
|
123
|
+
|
|
124
|
+
~~~markdown
|
|
125
|
+
# Frontend Hello World
|
|
126
|
+
|
|
127
|
+
```markdown-script
|
|
128
|
+
markdownPrint('Hello, **World**!!')
|
|
129
|
+
```
|
|
130
|
+
~~~
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### MarkdownUp Application Reference
|
|
134
|
+
|
|
135
|
+
[The BareScript Language](https://craigahobbs.github.io/bare-script/language/)
|
|
136
|
+
|
|
137
|
+
[The BareScript Library](https://craigahobbs.github.io/bare-script/library/)
|
|
138
|
+
|
|
139
|
+
[MarkdownUp Frontend Examples](https://craigahobbs.github.io/#var.vPage='MarkdownUp')
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
### MarkdownUp Backend Applications
|
|
143
|
+
|
|
144
|
+
MarkdownUp no longer hosts BareScript backend APIs. To write a backend application in BareScript, use the
|
|
145
|
+
[bare-script](https://pypi.org/project/bare-script/) package's
|
|
146
|
+
[WSGI support](https://craigahobbs.github.io/bare-script-py/wsgi.html).
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
This package is developed using [python-build](https://github.com/craigahobbs/python-build#readme).
|
|
152
|
+
It was started using [python-template](https://github.com/craigahobbs/python-template#readme) as follows:
|
|
153
|
+
|
|
154
|
+
~~~
|
|
155
|
+
template-specialize python-template/template/ markdown-up-py/ -k package markdown-up -k name 'Craig A. Hobbs' -k email 'craigahobbs@gmail.com' -k github 'craigahobbs' -k noapi 1
|
|
156
|
+
~~~
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# markdown-up
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/markdown-up/)
|
|
4
|
+
[](https://pypi.org/project/markdown-up/)
|
|
5
|
+
[](https://github.com/craigahobbs/markdown-up-py/blob/main/LICENSE)
|
|
6
|
+
[](https://pypi.org/project/markdown-up/)
|
|
7
|
+
|
|
8
|
+
MarkdownUp is a Markdown viewer.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Install MarkdownUp
|
|
12
|
+
|
|
13
|
+
Use Python's `pip` to install MarkdownUp as follows:
|
|
14
|
+
|
|
15
|
+
~~~
|
|
16
|
+
pip install markdown-up
|
|
17
|
+
~~~
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## View Markdown Files
|
|
21
|
+
|
|
22
|
+
To start MarkdownUp, open a terminal and run the `markdown-up` application:
|
|
23
|
+
|
|
24
|
+
~~~
|
|
25
|
+
markdown-up
|
|
26
|
+
~~~
|
|
27
|
+
|
|
28
|
+
The `markdown-up` application opens the web browser to the MarkdownUp file browser, which allows you
|
|
29
|
+
to view Markdown or HTML files and navigate directories. To view a file, click on its link.
|
|
30
|
+
|
|
31
|
+
You can view a specific file as follows:
|
|
32
|
+
|
|
33
|
+
~~~
|
|
34
|
+
markdown-up README.md
|
|
35
|
+
~~~
|
|
36
|
+
|
|
37
|
+
**Note:** MarkdownUp runs entirely offline. It does not use an external service to render Markdown
|
|
38
|
+
files.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## Running MarkdownUp
|
|
42
|
+
|
|
43
|
+
When you run the `markdown-up` application, in addition to opening the web browser, it starts a
|
|
44
|
+
[chisel](https://pypi.org/project/chisel/)
|
|
45
|
+
backend API application using
|
|
46
|
+
[waitress](https://pypi.org/project/waitress/).
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Automatic HTML for Markdown Files
|
|
50
|
+
|
|
51
|
+
When you run MarkdownUp and click on a Markdown file link, the link navigates to an HTML file that
|
|
52
|
+
renders the Markdown file. Every Markdown file hosted by MarkdownUp has a corresponding `.html` file
|
|
53
|
+
of the same name. For example, if you run MarkdownUp in a directory that has the following Markdown
|
|
54
|
+
files: "README.md" and "CHANGELOG.md". The MarkdownUp service automatically generates "README.html"
|
|
55
|
+
and "CHANGELOG.html" files.
|
|
56
|
+
|
|
57
|
+
The generated `.html` files are HTML stubs for the
|
|
58
|
+
[MarkdownUp frontend application](https://github.com/craigahobbs/markdown-up#readme).
|
|
59
|
+
All Markdown parsing and rendering are done on the client.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Configuration File
|
|
63
|
+
|
|
64
|
+
The
|
|
65
|
+
[MarkdownUp Application Configuration File](https://craigahobbs.github.io/markdown-up-py/config.html#var.vName='MarkdownUpConfig'),
|
|
66
|
+
`markdown-up.json`, allows you to enable release mode, set the number of backend server threads, and more.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Command-Line Arguments
|
|
70
|
+
|
|
71
|
+
The `markdown-up` application has the following command-line arguments:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
usage: markdown-up [-h] [-p N] [-t N] [-n] [-r] [-q] [-c FILE] [path]
|
|
75
|
+
|
|
76
|
+
positional arguments:
|
|
77
|
+
path the file or directory to view (default is ".")
|
|
78
|
+
|
|
79
|
+
options:
|
|
80
|
+
-h, --help show this help message and exit
|
|
81
|
+
-p, --port N the application port (default is 8080)
|
|
82
|
+
-t, --threads N the number of web server threads (default is 8)
|
|
83
|
+
-n, --no-browser don't open a web browser
|
|
84
|
+
-r, --release release mode (cache statics, remove documentation and index)
|
|
85
|
+
-q, --quiet hide access logging
|
|
86
|
+
-c, --config FILE the application config filename (default is "markdown-up.json")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## MarkdownUp Applications
|
|
91
|
+
|
|
92
|
+
With MarkdownUp, you can write client-rendered frontend applications using
|
|
93
|
+
[BareScript](https://craigahobbs.github.io/bare-script/language/).
|
|
94
|
+
MarkdownUp applications are created by adding `markdown-script` fenced code blocks containing
|
|
95
|
+
[BareScript](https://craigahobbs.github.io/bare-script/language/)
|
|
96
|
+
to a Markdown file and viewing it with the MarkdownUp frontend application. When the Markdown file
|
|
97
|
+
is rendered, the BareScript is executed and its results are rendered in place. For example:
|
|
98
|
+
|
|
99
|
+
~~~markdown
|
|
100
|
+
# Frontend Hello World
|
|
101
|
+
|
|
102
|
+
```markdown-script
|
|
103
|
+
markdownPrint('Hello, **World**!!')
|
|
104
|
+
```
|
|
105
|
+
~~~
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### MarkdownUp Application Reference
|
|
109
|
+
|
|
110
|
+
[The BareScript Language](https://craigahobbs.github.io/bare-script/language/)
|
|
111
|
+
|
|
112
|
+
[The BareScript Library](https://craigahobbs.github.io/bare-script/library/)
|
|
113
|
+
|
|
114
|
+
[MarkdownUp Frontend Examples](https://craigahobbs.github.io/#var.vPage='MarkdownUp')
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### MarkdownUp Backend Applications
|
|
118
|
+
|
|
119
|
+
MarkdownUp no longer hosts BareScript backend APIs. To write a backend application in BareScript, use the
|
|
120
|
+
[bare-script](https://pypi.org/project/bare-script/) package's
|
|
121
|
+
[WSGI support](https://craigahobbs.github.io/bare-script-py/wsgi.html).
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
This package is developed using [python-build](https://github.com/craigahobbs/python-build#readme).
|
|
127
|
+
It was started using [python-template](https://github.com/craigahobbs/python-template#readme) as follows:
|
|
128
|
+
|
|
129
|
+
~~~
|
|
130
|
+
template-specialize python-template/template/ markdown-up-py/ -k package markdown-up -k name 'Craig A. Hobbs' -k email 'craigahobbs@gmail.com' -k github 'craigahobbs' -k noapi 1
|
|
131
|
+
~~~
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "markdown-up"
|
|
7
|
-
version = "3.
|
|
7
|
+
version = "3.3.0"
|
|
8
8
|
description = "MarkdownUp is a Markdown viewer"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -26,7 +26,6 @@ classifiers = [
|
|
|
26
26
|
"Topic :: Utilities"
|
|
27
27
|
]
|
|
28
28
|
dependencies = [
|
|
29
|
-
"bare-script >= 5.1.0, < 5.2.0",
|
|
30
29
|
"chisel >= 2.4.0, < 2.5.0",
|
|
31
30
|
"waitress >= 3.0.0"
|
|
32
31
|
]
|
|
@@ -13,8 +13,6 @@ import urllib.parse
|
|
|
13
13
|
|
|
14
14
|
import chisel
|
|
15
15
|
|
|
16
|
-
from .api import load_api_requests
|
|
17
|
-
|
|
18
16
|
|
|
19
17
|
class MarkdownUpApplication(chisel.Application):
|
|
20
18
|
"""
|
|
@@ -24,7 +22,7 @@ class MarkdownUpApplication(chisel.Application):
|
|
|
24
22
|
__slots__ = ('root', 'release', 'add_request_lock')
|
|
25
23
|
|
|
26
24
|
|
|
27
|
-
def __init__(self, root, config=None
|
|
25
|
+
def __init__(self, root, config=None):
|
|
28
26
|
super().__init__()
|
|
29
27
|
self.root = root
|
|
30
28
|
self.release = config.get('release', False) if config else False
|
|
@@ -53,10 +51,6 @@ class MarkdownUpApplication(chisel.Application):
|
|
|
53
51
|
self.add_static('index.html', content_type='text/html; charset=utf-8', urls=(('GET', '/'),))
|
|
54
52
|
self.add_static('markdownUpIndex.bare')
|
|
55
53
|
|
|
56
|
-
# Add the backend APIs
|
|
57
|
-
if api_config:
|
|
58
|
-
self.add_requests(load_api_requests(root, config, api_config))
|
|
59
|
-
|
|
60
54
|
|
|
61
55
|
def add_static(self, filename, content_type=None, urls=(('GET', None),), doc_group='MarkdownUp File Browser'):
|
|
62
56
|
with importlib.resources.files('markdown_up.static').joinpath(filename).open('rb') as fh:
|
|
@@ -13,7 +13,7 @@ import sys
|
|
|
13
13
|
import threading
|
|
14
14
|
import webbrowser
|
|
15
15
|
|
|
16
|
-
from
|
|
16
|
+
from schema_markdown import parse_schema_markdown, validate_type
|
|
17
17
|
import waitress
|
|
18
18
|
|
|
19
19
|
from .app import HTML_EXTS, MARKDOWN_EXTS, MarkdownUpApplication
|
|
@@ -41,14 +41,8 @@ def main(argv=None):
|
|
|
41
41
|
help="release mode (cache statics, remove documentation and index)")
|
|
42
42
|
parser.add_argument('-q', '--quiet', action='store_true',
|
|
43
43
|
help="hide access logging")
|
|
44
|
-
parser.add_argument('-d', '--debug', action='store_true', default=None,
|
|
45
|
-
help='backend debug mode')
|
|
46
|
-
parser.add_argument('-v', '--var', nargs=2, action='append', metavar=('VAR', 'EXPR'), default = [],
|
|
47
|
-
help='set a backend global variable')
|
|
48
44
|
parser.add_argument('-c', '--config', metavar='FILE', default='markdown-up.json',
|
|
49
45
|
help='the application config filename (default is "markdown-up.json")')
|
|
50
|
-
parser.add_argument('-a', '--api', metavar='FILE', default='markdown-up-api.json',
|
|
51
|
-
help='the API config filename (default is "markdown-up-api.json")')
|
|
52
46
|
args = parser.parse_args(args=argv)
|
|
53
47
|
|
|
54
48
|
# Verify the path exists
|
|
@@ -71,27 +65,13 @@ def main(argv=None):
|
|
|
71
65
|
config_path = os.path.normpath(os.path.join(root, args.config))
|
|
72
66
|
if os.path.isfile(config_path):
|
|
73
67
|
with open(config_path, 'r', encoding='utf-8') as config_file:
|
|
74
|
-
config =
|
|
68
|
+
config = validate_type(CONFIG_TYPES, 'MarkdownUpConfig', json.load(config_file))
|
|
75
69
|
else:
|
|
76
70
|
config = {}
|
|
77
71
|
|
|
78
|
-
#
|
|
79
|
-
api_path = os.path.normpath(os.path.join(root, args.api))
|
|
80
|
-
if os.path.isfile(api_path):
|
|
81
|
-
with open(api_path, 'r', encoding='utf-8') as api_file:
|
|
82
|
-
api_config = schema_validate(CONFIG_TYPES, 'MarkdownUpAPIConfig', json.load(api_file))
|
|
83
|
-
else:
|
|
84
|
-
api_config = None
|
|
85
|
-
|
|
86
|
-
# Add argumentsg to the config
|
|
87
|
-
config['debug'] = args.debug if args.debug is not None else config.get('debug', False)
|
|
72
|
+
# Add arguments to the config
|
|
88
73
|
config['release'] = args.release if args.release is not None else config.get('release', False)
|
|
89
74
|
config['threads'] = max(1, args.threads if args.threads is not None else config.get('threads', 8))
|
|
90
|
-
if args.var:
|
|
91
|
-
if 'globals' not in config:
|
|
92
|
-
config['globals'] = {}
|
|
93
|
-
for key, value in args.var:
|
|
94
|
-
config['globals'][key] = value
|
|
95
75
|
|
|
96
76
|
# Construct the URL
|
|
97
77
|
host = '127.0.0.1'
|
|
@@ -112,7 +92,7 @@ def main(argv=None):
|
|
|
112
92
|
webbrowser_thread.start()
|
|
113
93
|
|
|
114
94
|
# Create the WSGI application
|
|
115
|
-
wsgiapp = MarkdownUpApplication(root, config
|
|
95
|
+
wsgiapp = MarkdownUpApplication(root, config)
|
|
116
96
|
wsgiapp_wrap = wsgiapp if args.quiet else partial(_wsgiapp_log_access, wsgiapp)
|
|
117
97
|
|
|
118
98
|
# Host the application
|
|
@@ -131,7 +111,7 @@ def _wsgiapp_log_access(wsgiapp, environ, start_response):
|
|
|
131
111
|
|
|
132
112
|
|
|
133
113
|
# The backend configuration schema
|
|
134
|
-
CONFIG_TYPES =
|
|
114
|
+
CONFIG_TYPES = parse_schema_markdown('''\
|
|
135
115
|
group "Application Configuration"
|
|
136
116
|
|
|
137
117
|
|
|
@@ -141,45 +121,6 @@ struct MarkdownUpConfig
|
|
|
141
121
|
# If true, run in release mode. Default is false.
|
|
142
122
|
optional bool release
|
|
143
123
|
|
|
144
|
-
# If true, run in debug mode. Default is false.
|
|
145
|
-
optional bool debug
|
|
146
|
-
|
|
147
124
|
# The number of backend server threads. Default is 8.
|
|
148
125
|
optional int threads
|
|
149
|
-
|
|
150
|
-
# Global variables
|
|
151
|
-
optional string{} globals
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
group "API Configuration"
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
# The MarkdownUp API configuration (e.g. `markdown-up-api.json`)
|
|
158
|
-
struct MarkdownUpAPIConfig
|
|
159
|
-
|
|
160
|
-
# The API schema markdown POSIX file paths
|
|
161
|
-
string[] schemas
|
|
162
|
-
|
|
163
|
-
# The API BareScript POSIX file paths
|
|
164
|
-
string[] scripts
|
|
165
|
-
|
|
166
|
-
# The APIs
|
|
167
|
-
MarkdownUpAPI[] apis
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
group
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
# An API
|
|
174
|
-
struct MarkdownUpAPI
|
|
175
|
-
|
|
176
|
-
# The schema action name
|
|
177
|
-
string name
|
|
178
|
-
|
|
179
|
-
# The script function name. If unspecified, use the schema action name.
|
|
180
|
-
optional string function
|
|
181
|
-
|
|
182
|
-
# If true, the API function has a WSGI respone (e.g. `["200 Status", [["Content-Type": "text/plain"]], "Hello!"]`)
|
|
183
|
-
# Default is false.
|
|
184
|
-
optional bool wsgi
|
|
185
126
|
''')
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: markdown-up
|
|
3
|
+
Version: 3.3.0
|
|
4
|
+
Summary: MarkdownUp is a Markdown viewer
|
|
5
|
+
Author-email: "Craig A. Hobbs" <craigahobbs@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/craigahobbs/markdown-up-py
|
|
8
|
+
Keywords: Markdown,viewer
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: chisel<2.5.0,>=2.4.0
|
|
23
|
+
Requires-Dist: waitress>=3.0.0
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# markdown-up
|
|
27
|
+
|
|
28
|
+
[](https://pypi.org/project/markdown-up/)
|
|
29
|
+
[](https://pypi.org/project/markdown-up/)
|
|
30
|
+
[](https://github.com/craigahobbs/markdown-up-py/blob/main/LICENSE)
|
|
31
|
+
[](https://pypi.org/project/markdown-up/)
|
|
32
|
+
|
|
33
|
+
MarkdownUp is a Markdown viewer.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Install MarkdownUp
|
|
37
|
+
|
|
38
|
+
Use Python's `pip` to install MarkdownUp as follows:
|
|
39
|
+
|
|
40
|
+
~~~
|
|
41
|
+
pip install markdown-up
|
|
42
|
+
~~~
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## View Markdown Files
|
|
46
|
+
|
|
47
|
+
To start MarkdownUp, open a terminal and run the `markdown-up` application:
|
|
48
|
+
|
|
49
|
+
~~~
|
|
50
|
+
markdown-up
|
|
51
|
+
~~~
|
|
52
|
+
|
|
53
|
+
The `markdown-up` application opens the web browser to the MarkdownUp file browser, which allows you
|
|
54
|
+
to view Markdown or HTML files and navigate directories. To view a file, click on its link.
|
|
55
|
+
|
|
56
|
+
You can view a specific file as follows:
|
|
57
|
+
|
|
58
|
+
~~~
|
|
59
|
+
markdown-up README.md
|
|
60
|
+
~~~
|
|
61
|
+
|
|
62
|
+
**Note:** MarkdownUp runs entirely offline. It does not use an external service to render Markdown
|
|
63
|
+
files.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## Running MarkdownUp
|
|
67
|
+
|
|
68
|
+
When you run the `markdown-up` application, in addition to opening the web browser, it starts a
|
|
69
|
+
[chisel](https://pypi.org/project/chisel/)
|
|
70
|
+
backend API application using
|
|
71
|
+
[waitress](https://pypi.org/project/waitress/).
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### Automatic HTML for Markdown Files
|
|
75
|
+
|
|
76
|
+
When you run MarkdownUp and click on a Markdown file link, the link navigates to an HTML file that
|
|
77
|
+
renders the Markdown file. Every Markdown file hosted by MarkdownUp has a corresponding `.html` file
|
|
78
|
+
of the same name. For example, if you run MarkdownUp in a directory that has the following Markdown
|
|
79
|
+
files: "README.md" and "CHANGELOG.md". The MarkdownUp service automatically generates "README.html"
|
|
80
|
+
and "CHANGELOG.html" files.
|
|
81
|
+
|
|
82
|
+
The generated `.html` files are HTML stubs for the
|
|
83
|
+
[MarkdownUp frontend application](https://github.com/craigahobbs/markdown-up#readme).
|
|
84
|
+
All Markdown parsing and rendering are done on the client.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
### Configuration File
|
|
88
|
+
|
|
89
|
+
The
|
|
90
|
+
[MarkdownUp Application Configuration File](https://craigahobbs.github.io/markdown-up-py/config.html#var.vName='MarkdownUpConfig'),
|
|
91
|
+
`markdown-up.json`, allows you to enable release mode, set the number of backend server threads, and more.
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Command-Line Arguments
|
|
95
|
+
|
|
96
|
+
The `markdown-up` application has the following command-line arguments:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
usage: markdown-up [-h] [-p N] [-t N] [-n] [-r] [-q] [-c FILE] [path]
|
|
100
|
+
|
|
101
|
+
positional arguments:
|
|
102
|
+
path the file or directory to view (default is ".")
|
|
103
|
+
|
|
104
|
+
options:
|
|
105
|
+
-h, --help show this help message and exit
|
|
106
|
+
-p, --port N the application port (default is 8080)
|
|
107
|
+
-t, --threads N the number of web server threads (default is 8)
|
|
108
|
+
-n, --no-browser don't open a web browser
|
|
109
|
+
-r, --release release mode (cache statics, remove documentation and index)
|
|
110
|
+
-q, --quiet hide access logging
|
|
111
|
+
-c, --config FILE the application config filename (default is "markdown-up.json")
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
## MarkdownUp Applications
|
|
116
|
+
|
|
117
|
+
With MarkdownUp, you can write client-rendered frontend applications using
|
|
118
|
+
[BareScript](https://craigahobbs.github.io/bare-script/language/).
|
|
119
|
+
MarkdownUp applications are created by adding `markdown-script` fenced code blocks containing
|
|
120
|
+
[BareScript](https://craigahobbs.github.io/bare-script/language/)
|
|
121
|
+
to a Markdown file and viewing it with the MarkdownUp frontend application. When the Markdown file
|
|
122
|
+
is rendered, the BareScript is executed and its results are rendered in place. For example:
|
|
123
|
+
|
|
124
|
+
~~~markdown
|
|
125
|
+
# Frontend Hello World
|
|
126
|
+
|
|
127
|
+
```markdown-script
|
|
128
|
+
markdownPrint('Hello, **World**!!')
|
|
129
|
+
```
|
|
130
|
+
~~~
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### MarkdownUp Application Reference
|
|
134
|
+
|
|
135
|
+
[The BareScript Language](https://craigahobbs.github.io/bare-script/language/)
|
|
136
|
+
|
|
137
|
+
[The BareScript Library](https://craigahobbs.github.io/bare-script/library/)
|
|
138
|
+
|
|
139
|
+
[MarkdownUp Frontend Examples](https://craigahobbs.github.io/#var.vPage='MarkdownUp')
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
### MarkdownUp Backend Applications
|
|
143
|
+
|
|
144
|
+
MarkdownUp no longer hosts BareScript backend APIs. To write a backend application in BareScript, use the
|
|
145
|
+
[bare-script](https://pypi.org/project/bare-script/) package's
|
|
146
|
+
[WSGI support](https://craigahobbs.github.io/bare-script-py/wsgi.html).
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
This package is developed using [python-build](https://github.com/craigahobbs/python-build#readme).
|
|
152
|
+
It was started using [python-template](https://github.com/craigahobbs/python-template#readme) as follows:
|
|
153
|
+
|
|
154
|
+
~~~
|
|
155
|
+
template-specialize python-template/template/ markdown-up-py/ -k package markdown-up -k name 'Craig A. Hobbs' -k email 'craigahobbs@gmail.com' -k github 'craigahobbs' -k noapi 1
|
|
156
|
+
~~~
|