marksmith 0.1.2 → 0.1.3
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/README.md +32 -1
- data/app/assets/javascripts/list_continuation_controller-full.esm.js +1 -1
- data/app/assets/javascripts/list_continuation_controller-no-stimulus.esm.js +1 -1
- data/app/assets/javascripts/marksmith_controller-full.esm.js +1 -1
- data/app/assets/javascripts/marksmith_controller-no-stimulus.esm.js +1 -1
- data/app/assets/stylesheets/marksmith.css +2 -2
- data/app/components/marksmith/markdown_field/edit_component.rb +5 -4
- data/app/components/marksmith/markdown_field/show_component.rb +3 -2
- data/app/views/marksmith/shared/_editor.html.erb +1 -1
- data/lib/marksmith/engine.rb +5 -0
- data/lib/marksmith/version.rb +1 -1
- metadata +3 -6
- data/app/helpers/marksmith/application_helper.rb +0 -4
- data/app/jobs/marksmith/application_job.rb +0 -4
- data/app/mailers/marksmith/application_mailer.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 138a40e01855d847e9b295185fcf85edc6801e80c9bd94b1d8a55de7efb0b0f7
|
4
|
+
data.tar.gz: d29d99ff35c10fbc9e7deaadc84d7b27fdadb494732364cfda3003c69d397b81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5be1932c6cc7b5054cab6875a38c615977682b4e50f048c1f04ec29df9c46cec911c846e4eb7f2f9413702841b1a801145ea0a91431efd9c7b11c511725c4b09
|
7
|
+
data.tar.gz: 1dd261670a842ca375bc584cf1028b078e4c93d147ee8f0893952704993a741efea93341ea89a6b6b1106e742b1724056684b45a0c0fdd4cf42a9b8ddd1b2eaf
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Marksmith
|
2
2
|
|
3
|
+
[](https://github.com/avo-hq/marksmith/actions/workflows/ci.yml)
|
4
|
+
|
3
5
|
Marksmith is a GitHub-style markdown editor for Rails apps.
|
4
6
|
|
5
|
-
It supports Active Storage attachments and comes with a built-in
|
7
|
+
It supports Active Storage attachments and comes with a built-in markdown preview renderer.
|
6
8
|
|
7
9
|

|
8
10
|
|
@@ -170,6 +172,35 @@ In your `show.html.erb` view or the place where you want to render the compiled
|
|
170
172
|
> sanitize(body, tags: %w(table th tr td span) + ActionView::Helpers::SanitizeHelper.sanitizer_vendor.safe_list_sanitizer.allowed_tags.to_a)
|
171
173
|
> ```
|
172
174
|
|
175
|
+
### Customize the renderer
|
176
|
+
|
177
|
+
You can customize the renderer by overriding the `Marksmith::Renderer` model.
|
178
|
+
|
179
|
+
```ruby
|
180
|
+
# app/models/marksmith/renderer.rb
|
181
|
+
require "redcarpet"
|
182
|
+
|
183
|
+
module Marksmith
|
184
|
+
class Renderer
|
185
|
+
def renderer
|
186
|
+
::Redcarpet::Markdown.new(
|
187
|
+
::Redcarpet::Render::HTML,
|
188
|
+
tables: true,
|
189
|
+
lax_spacing: true,
|
190
|
+
fenced_code_blocks: true,
|
191
|
+
space_after_headers: true,
|
192
|
+
hard_wrap: true,
|
193
|
+
autolink: true,
|
194
|
+
strikethrough: true,
|
195
|
+
underline: true,
|
196
|
+
highlight: true,
|
197
|
+
quote: true,
|
198
|
+
with_toc_data: true
|
199
|
+
)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
```
|
173
204
|
|
174
205
|
## Active Storage
|
175
206
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Marksmith::MarkdownField::EditComponent < Avo::Fields::EditComponent
|
4
|
-
|
5
|
-
|
2
|
+
if defined?(Avo)
|
3
|
+
class Marksmith::MarkdownField::EditComponent < Avo::Fields::EditComponent
|
4
|
+
def unique_id
|
5
|
+
[@field.type, @resource&.singular_route_key, @field.id].compact.join("_")
|
6
|
+
end
|
6
7
|
end
|
7
8
|
end
|
@@ -84,7 +84,7 @@
|
|
84
84
|
<%= content_tag :div, class: "ms:flex ms:flex-1 ms:flex-col ms:size-full", data: { marksmith_target: "fieldContainer" } do %>
|
85
85
|
<%= text_area_tag field_name, value,
|
86
86
|
id: name,
|
87
|
-
class: class_names("ms:flex ms:flex-1 ms:rounded ms:border-none ms:resize-
|
87
|
+
class: class_names("ms:flex ms:flex-1 ms:rounded ms:border-none ms:resize-none ms:focus:outline-none ms:font-mono ms:focus:ring-0 ms:leading-normal ms:p-2 ms:text-sm", classes),
|
88
88
|
rows: rows,
|
89
89
|
data: {
|
90
90
|
action: "drop->marksmith#dropUpload paste->marksmith#pasteUpload",
|
data/lib/marksmith/engine.rb
CHANGED
@@ -53,6 +53,11 @@ module Marksmith
|
|
53
53
|
Avo.asset_manager.register_stimulus_controller "marksmith", "MarksmithController"
|
54
54
|
Avo.asset_manager.register_stimulus_controller "list-continuation", "ListContinuationController"
|
55
55
|
end
|
56
|
+
else
|
57
|
+
# Ignore the markdown_field components if Avo is not defined
|
58
|
+
app.autoloaders.main.ignore(
|
59
|
+
root.join("app", "components", "marksmith", "markdown_field"),
|
60
|
+
)
|
56
61
|
end
|
57
62
|
end
|
58
63
|
end
|
data/lib/marksmith/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marksmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -84,9 +84,6 @@ files:
|
|
84
84
|
- app/frontend/entrypoints/javascript/controllers/index.js
|
85
85
|
- app/frontend/entrypoints/javascript/controllers/list_continuation_controller.js
|
86
86
|
- app/frontend/entrypoints/javascript/controllers/marksmith_controller.js
|
87
|
-
- app/helpers/marksmith/application_helper.rb
|
88
|
-
- app/jobs/marksmith/application_job.rb
|
89
|
-
- app/mailers/marksmith/application_mailer.rb
|
90
87
|
- app/models/marksmith/application_record.rb
|
91
88
|
- app/models/marksmith/renderer.rb
|
92
89
|
- app/views/layouts/marksmith/application.html.erb
|
@@ -127,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
124
|
- !ruby/object:Gem::Version
|
128
125
|
version: '0'
|
129
126
|
requirements: []
|
130
|
-
rubygems_version: 3.5.
|
127
|
+
rubygems_version: 3.5.9
|
131
128
|
signing_key:
|
132
129
|
specification_version: 4
|
133
130
|
summary: Marksmith is a GitHub-style markdown editor for Ruby on Rails applications.
|