inkblot 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/.build.yml +29 -0
- data/.rspec_status +3 -0
- data/Rakefile +5 -1
- data/docs/inkblot.yml +7 -2
- data/docs/pages/docs/getting-started.md +55 -0
- data/docs/pages/docs/install.md +14 -0
- data/docs/pages/docs/tailwind.md +8 -0
- data/docs/pages/index.md +3 -1
- data/docs/pages/test.md +4 -0
- data/docs/pages/test2.md +4 -0
- data/lib/inkblot/cli.rb +34 -27
- data/lib/inkblot/layout.rb +11 -6
- data/lib/inkblot/markdown_page.rb +2 -3
- data/lib/inkblot/pages.rb +21 -0
- data/lib/inkblot/version.rb +1 -1
- data/tailwind.css +2 -0
- metadata +11 -3
- data/docs/tailwind.css +0 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ef19b45336c7174cad3412dc52d59f47452511f55ab5af05ed789e7a867cdc58
|
|
4
|
+
data.tar.gz: cebcdc588d7ad2cee92fc6b4f985ed27832c6e265c7d0184234de7b0ac4b368f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42f956ed1b6f3ac8e7be061a581a7854da276f2b09f5550d5389c446cf9ca4bee960637c266960500540a6d29a1d053492cf8fd19e9ec92a3aaf790076f80fe9
|
|
7
|
+
data.tar.gz: ae6d6e445e77e5aca6d6e00c3c1183599979290c736570b496fed96c85efb94423a28ee50a459f1958b5830601fb47f2b8ce0eac73d57bf00db5da039a2e146f
|
data/.build.yml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
image: alpine/latest
|
|
2
|
+
packages:
|
|
3
|
+
- hut
|
|
4
|
+
- nodejs
|
|
5
|
+
- npm
|
|
6
|
+
- musl-dev
|
|
7
|
+
- libffi-dev
|
|
8
|
+
- yaml-dev
|
|
9
|
+
- ruby
|
|
10
|
+
- ruby-dev
|
|
11
|
+
- ruby-bundler
|
|
12
|
+
oauth: "pages.sr.ht/PAGES:RW"
|
|
13
|
+
environment:
|
|
14
|
+
site: farthergate.com
|
|
15
|
+
TAILWINDCSS_INSTALL_DIR: node_modules/.bin
|
|
16
|
+
tasks:
|
|
17
|
+
- test: |
|
|
18
|
+
cd inkblot
|
|
19
|
+
npm i tailwindcss @tailwindcss/cli @tailwindcss/typography
|
|
20
|
+
bundle install --path vendor/bundle
|
|
21
|
+
bundle exec rake || true
|
|
22
|
+
- site: |
|
|
23
|
+
cd inkblot/docs
|
|
24
|
+
bundle exec ../exe/inkblot build
|
|
25
|
+
- package: |
|
|
26
|
+
cd inkblot/docs/_build
|
|
27
|
+
tar -cvz . > ../../../site.tar.gz
|
|
28
|
+
- upload: |
|
|
29
|
+
hut pages publish -d $site site.tar.gz
|
data/.rspec_status
ADDED
data/Rakefile
CHANGED
data/docs/inkblot.yml
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: getting-started
|
|
3
|
+
title: Getting Started
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Getting Started
|
|
7
|
+
|
|
8
|
+
Start by initializing a new project:
|
|
9
|
+
|
|
10
|
+
~~~ sh
|
|
11
|
+
inkblot init
|
|
12
|
+
~~~
|
|
13
|
+
|
|
14
|
+
From that, you'll find an `inkblot.yml`, a `.gitignore`, and a `pages/index.md` file.
|
|
15
|
+
|
|
16
|
+
Run the development server:
|
|
17
|
+
|
|
18
|
+
~~~ sh
|
|
19
|
+
inkblot dev
|
|
20
|
+
~~~
|
|
21
|
+
|
|
22
|
+
And visit <http://localhost:3000> to see your documentation.
|
|
23
|
+
|
|
24
|
+
## General Structure
|
|
25
|
+
|
|
26
|
+
Let's take a look around your project.
|
|
27
|
+
|
|
28
|
+
First of all, the `inkblot.yml` file describes general information about your site, along with navigation. The default looks like this:
|
|
29
|
+
|
|
30
|
+
~~~ yaml
|
|
31
|
+
---
|
|
32
|
+
title: Documentation
|
|
33
|
+
nav:
|
|
34
|
+
- :Documentation:
|
|
35
|
+
- index
|
|
36
|
+
~~~
|
|
37
|
+
|
|
38
|
+
_If this looks a little strange for YAML, it's the default dump output from Ruby's Psych — you can just write normal YAML._
|
|
39
|
+
|
|
40
|
+
You're going to want to change the site title. When you want to add a page, add its `id` frontmatter property to a section in the `nav` key.
|
|
41
|
+
|
|
42
|
+
`pages/index.md` should look something like this:
|
|
43
|
+
|
|
44
|
+
~~~ markdown
|
|
45
|
+
---
|
|
46
|
+
id: index
|
|
47
|
+
title: Home
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
# Home
|
|
51
|
+
~~~
|
|
52
|
+
|
|
53
|
+
Again, the `id` is what you'll reference it by in the navigation, and the `title` will show up in the navigation and in the page title.
|
|
54
|
+
|
|
55
|
+
Just write Markdown (Kramdown-flavored) as you usually would anywhere under `pages/`, and use `inkblot build` to build the site to `_build/`.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: tailwind
|
|
3
|
+
title: TailwindCSS
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TailwindCSS
|
|
7
|
+
|
|
8
|
+
Inkblot comes with prebuilt Tailwind-based styles for its own UI, but if you want to style your own content as well, you can add a `tailwind.css` file, which will be automatically picked up and automatically built.
|
data/docs/pages/index.md
CHANGED
data/docs/pages/test.md
ADDED
data/docs/pages/test2.md
ADDED
data/lib/inkblot/cli.rb
CHANGED
|
@@ -8,11 +8,12 @@ require "psych"
|
|
|
8
8
|
require "fileutils"
|
|
9
9
|
require "rouge"
|
|
10
10
|
|
|
11
|
+
require_relative "pages"
|
|
11
12
|
require_relative "markdown_page"
|
|
12
13
|
|
|
13
14
|
module Inkblot
|
|
14
15
|
class << self
|
|
15
|
-
attr_accessor :config
|
|
16
|
+
attr_accessor :config, :navigation
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
class Cli < Phlexite::Cli::Cli
|
|
@@ -20,44 +21,50 @@ module Inkblot
|
|
|
20
21
|
def init(path = ".")
|
|
21
22
|
FileUtils.mkdir_p path
|
|
22
23
|
write_tmpl(path, ".gitignore", "_build")
|
|
23
|
-
|
|
24
|
+
|
|
25
|
+
write_tmpl(path, "inkblot.yml", Psych.dump({
|
|
26
|
+
"title" => "Documentation",
|
|
27
|
+
"nav" => [
|
|
28
|
+
{ "Documentation": ["index"] }
|
|
29
|
+
]
|
|
30
|
+
}))
|
|
24
31
|
|
|
25
32
|
FileUtils.mkdir_p File.join(path, "pages")
|
|
26
|
-
write_tmpl(path, "pages/index.md",
|
|
33
|
+
write_tmpl(path, "pages/index.md", "---\nid: index\ntitle: Home\n---\n\n# Home")
|
|
27
34
|
end
|
|
28
35
|
|
|
29
36
|
def build
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"Home" => "/"
|
|
40
|
-
}
|
|
37
|
+
spin do
|
|
38
|
+
Phlexite::Site.new do |s|
|
|
39
|
+
Inkblot.config = Psych.load_file "inkblot.yml" if File.file? "inkblot.yml"
|
|
40
|
+
|
|
41
|
+
Inkblot.config ||= {
|
|
42
|
+
"title" => "Documentation",
|
|
43
|
+
"nav" => [
|
|
44
|
+
{ "Documentation": ["index"] }
|
|
45
|
+
]
|
|
41
46
|
}
|
|
42
|
-
}
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
Inkblot.navigation = Inkblot.config["nav"] || {}
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
content = Phlexite::Content::Collection.new("pages/**/*.md", Inkblot::MarkdownPage, prefix: "pages")
|
|
51
|
+
Pages.populate content
|
|
52
|
+
content.build(s)
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
Rouge::Themes::Base16.make_dark!
|
|
50
|
-
Rouge::Themes::Base16.style(Rouge::Token::Tokens::Text, bg: "#00000000")
|
|
51
|
-
Rouge::Themes::Base16.new(scope: "pre > code").render
|
|
52
|
-
}
|
|
54
|
+
Tailwindcss::Phlexite.build s, "tailwind.css", "tailwind.css" if File.file? "tailwind.css"
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
File.read(File.join(File.expand_path(File.dirname(File.dirname(__FILE__))), "inkblot.min.css"))
|
|
56
|
-
}
|
|
56
|
+
s.mount "assets", on: "/" if File.file? "assets"
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
s.page "syntax.css", proc {
|
|
59
|
+
Rouge::Themes::Base16.make_dark!
|
|
60
|
+
Rouge::Themes::Base16.style(Rouge::Token::Tokens::Text, bg: "#00000000")
|
|
61
|
+
Rouge::Themes::Base16.new(scope: "pre > code").render
|
|
62
|
+
}
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
s.page "inkblot.min.css", proc {
|
|
65
|
+
File.read(File.join(File.expand_path(File.dirname(File.dirname(__FILE__))), "inkblot.min.css"))
|
|
66
|
+
}
|
|
67
|
+
end
|
|
61
68
|
end
|
|
62
69
|
end
|
|
63
70
|
|
data/lib/inkblot/layout.rb
CHANGED
|
@@ -4,8 +4,9 @@ require "phlex"
|
|
|
4
4
|
|
|
5
5
|
module Inkblot
|
|
6
6
|
class Layout < ::Phlex::HTML
|
|
7
|
-
def initialize(title)
|
|
7
|
+
def initialize(title, id)
|
|
8
8
|
@title = title
|
|
9
|
+
@id = id
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def nav_link(url, klass = "", &block)
|
|
@@ -14,7 +15,7 @@ module Inkblot
|
|
|
14
15
|
end
|
|
15
16
|
end
|
|
16
17
|
|
|
17
|
-
def pages = Inkblot.
|
|
18
|
+
def pages = Inkblot.navigation || {}
|
|
18
19
|
def nav_end = Inkblot.config["nav-end"] || {}
|
|
19
20
|
|
|
20
21
|
def view_template(&block)
|
|
@@ -34,10 +35,14 @@ module Inkblot
|
|
|
34
35
|
aside(class: "p-5 min-w-[15%] border-r border-gray-200 bg-gray-100 dark:bg-[#131314] dark:border-stone-700 fixed top-0 left-0 h-screen") do
|
|
35
36
|
nav(style: "display: flex; flex-direction: column; justify-content: space-between; height: 100%;") do
|
|
36
37
|
ul do
|
|
37
|
-
pages.each do |section
|
|
38
|
-
li(class: "font-bold text-gray-500 dark:text-gray-400 py-2 text-sm") { section }
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
pages.each do |section|
|
|
39
|
+
li(class: "font-bold text-gray-500 dark:text-gray-400 py-2 text-sm") { section.keys[0] }
|
|
40
|
+
section.values[0].each do |page|
|
|
41
|
+
title = Pages.pages[page][:fm]["title"]
|
|
42
|
+
cur_page = (@id ? @id == page : @title == title)
|
|
43
|
+
nav_link(Pages.pages[page][:out], cur_page ? "text-gray-900" : "") do
|
|
44
|
+
Pages.pages[page][:fm]["title"]
|
|
45
|
+
end
|
|
41
46
|
end
|
|
42
47
|
end
|
|
43
48
|
end
|
|
@@ -4,11 +4,10 @@ require "kramdown"
|
|
|
4
4
|
require_relative "layout"
|
|
5
5
|
|
|
6
6
|
module Inkblot
|
|
7
|
+
###
|
|
7
8
|
class MarkdownPage < ::Phlex::HTML
|
|
8
|
-
def initialize; end
|
|
9
|
-
|
|
10
9
|
def view_template
|
|
11
|
-
render Layout.new(@front_matter["title"]) do
|
|
10
|
+
render Layout.new(@front_matter["title"], @front_matter["id"]) do
|
|
12
11
|
div(class: "prose dark:prose-invert mx-auto pb-10") do
|
|
13
12
|
raw safe Kramdown::Document.new(@content, { syntax_highlighter: :rouge }).to_html
|
|
14
13
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Inkblot
|
|
4
|
+
###
|
|
5
|
+
module Pages
|
|
6
|
+
class << self
|
|
7
|
+
attr_accessor :pages
|
|
8
|
+
|
|
9
|
+
def populate(content)
|
|
10
|
+
self.pages = {}
|
|
11
|
+
content.entries.each do |f|
|
|
12
|
+
fm = f.read.front_matter
|
|
13
|
+
pages[fm["id"] || f.out_path] = {
|
|
14
|
+
fm: fm,
|
|
15
|
+
out: f.out_path
|
|
16
|
+
}
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/inkblot/version.rb
CHANGED
data/tailwind.css
ADDED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inkblot
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aleks Rutins
|
|
@@ -114,23 +114,31 @@ executables:
|
|
|
114
114
|
extensions: []
|
|
115
115
|
extra_rdoc_files: []
|
|
116
116
|
files:
|
|
117
|
+
- ".build.yml"
|
|
117
118
|
- ".rspec"
|
|
119
|
+
- ".rspec_status"
|
|
118
120
|
- ".rubocop.yml"
|
|
119
121
|
- LICENSE.txt
|
|
120
122
|
- README.md
|
|
121
123
|
- Rakefile
|
|
122
124
|
- docs/.gitignore
|
|
123
125
|
- docs/inkblot.yml
|
|
126
|
+
- docs/pages/docs/getting-started.md
|
|
127
|
+
- docs/pages/docs/install.md
|
|
128
|
+
- docs/pages/docs/tailwind.md
|
|
124
129
|
- docs/pages/index.md
|
|
125
|
-
- docs/
|
|
130
|
+
- docs/pages/test.md
|
|
131
|
+
- docs/pages/test2.md
|
|
126
132
|
- exe/inkblot
|
|
127
133
|
- lib/inkblot.min.css
|
|
128
134
|
- lib/inkblot.rb
|
|
129
135
|
- lib/inkblot/cli.rb
|
|
130
136
|
- lib/inkblot/layout.rb
|
|
131
137
|
- lib/inkblot/markdown_page.rb
|
|
138
|
+
- lib/inkblot/pages.rb
|
|
132
139
|
- lib/inkblot/version.rb
|
|
133
140
|
- sig/inkblot.rbs
|
|
141
|
+
- tailwind.css
|
|
134
142
|
homepage: https://inkblot.farthergate.com
|
|
135
143
|
licenses:
|
|
136
144
|
- MIT
|
|
@@ -152,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
152
160
|
- !ruby/object:Gem::Version
|
|
153
161
|
version: '0'
|
|
154
162
|
requirements: []
|
|
155
|
-
rubygems_version:
|
|
163
|
+
rubygems_version: 4.0.3
|
|
156
164
|
specification_version: 4
|
|
157
165
|
summary: A documentation generator for Phlexite
|
|
158
166
|
test_files: []
|
data/docs/tailwind.css
DELETED