marksmith 0.0.12 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -20
- data/app/assets/config/marksmith_manifest.js +1 -0
- data/app/assets/javascripts/list_continuation_controller-full.esm.js +592 -0
- data/app/assets/javascripts/list_continuation_controller-no-stimulus.esm.js +102 -0
- data/app/assets/javascripts/marksmith_controller-full.esm.js +2939 -0
- data/app/assets/javascripts/marksmith_controller-no-stimulus.esm.js +2449 -0
- data/app/assets/stylesheets/marksmith.css +12 -1
- data/app/components/marksmith/markdown_field/edit_component.html.erb +8 -0
- data/app/components/marksmith/markdown_field/edit_component.rb +4 -0
- data/app/components/marksmith/markdown_field/show_component.html.erb +3 -0
- data/app/components/marksmith/markdown_field/show_component.rb +4 -0
- data/app/views/marksmith/shared/_editor.html.erb +4 -5
- data/lib/marksmith/engine.rb +25 -0
- data/lib/marksmith/fields/markdown_field.rb +15 -0
- data/lib/marksmith/version.rb +1 -1
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0da9e3c49eee802cb04a55505552636af16dd6821180a049bbdcdb51d0664ed6
|
4
|
+
data.tar.gz: 1eddf93578ba14e3b0a79f5915f69efce8a24f28c6ce9cf4f5c94c8764f5c46b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a735566969ff5549736ae7588b20988f24caa424e60df3e41265d9aa9c6934175cebba2e39a51af159be790d91a99283873315beb14fcc080a7f08c7036bea3d
|
7
|
+
data.tar.gz: afab9a21269662a84b2b63e9ea338db62e2e399b4dcf524801510168598413cf37ceba0e8bc0fd21fe9f463d14c4ad1a4c82d04c6f65ace47a778bdddb916e13
|
data/README.md
CHANGED
@@ -27,24 +27,16 @@ Or manually install it.
|
|
27
27
|
Add this line to your application's Gemfile:
|
28
28
|
|
29
29
|
```ruby
|
30
|
+
# Gemfile
|
30
31
|
gem "marksmith"
|
31
32
|
```
|
32
33
|
|
33
|
-
And then execute:
|
34
|
-
|
35
|
-
```bash
|
36
|
-
bundle
|
37
|
-
```
|
38
|
-
|
39
|
-
|
40
34
|
### 2. Install the NPM package to import the StimulusJS controller.
|
41
35
|
|
42
36
|
Install the package.
|
43
37
|
|
44
38
|
```bash
|
45
|
-
yarn add @avo-hq/marksmith
|
46
|
-
# or
|
47
|
-
npm install @avo-hq/marksmith
|
39
|
+
$ yarn add @avo-hq/marksmith
|
48
40
|
```
|
49
41
|
|
50
42
|
Import and register it in your application.
|
@@ -60,16 +52,16 @@ application.register('marksmith', MarksmithController)
|
|
60
52
|
> If you want to manually import those dependencies and import only the controller from the package use the `/controller` path.
|
61
53
|
|
62
54
|
```js
|
63
|
-
// Import just the controller
|
64
|
-
import { MarksmithController } from '@avo-hq/marksmith/core'
|
65
|
-
|
66
|
-
application.register('marksmith', MarksmithController)
|
67
|
-
|
68
55
|
// Manually import Marksmith's dependencies
|
69
56
|
import '@github/markdown-toolbar-element'
|
70
57
|
import { DirectUpload } from '@rails/activestorage'
|
71
58
|
import { post } from '@rails/request.js'
|
72
59
|
import { subscribe } from '@github/paste-markdown'
|
60
|
+
|
61
|
+
// Import just the controller
|
62
|
+
import { MarksmithController } from '@avo-hq/marksmith/core'
|
63
|
+
|
64
|
+
application.register('marksmith', MarksmithController)
|
73
65
|
```
|
74
66
|
|
75
67
|
### 3. Add the style tag to your `application.html` layout
|
@@ -80,16 +72,17 @@ import { subscribe } from '@github/paste-markdown'
|
|
80
72
|
|
81
73
|
### 4. Use it
|
82
74
|
|
83
|
-
Use
|
75
|
+
Use a form helper tag or attach it to your form builder.
|
84
76
|
|
85
77
|
```erb
|
86
78
|
<%= marksmith_tag :body, value: "### This is important" %>
|
87
|
-
|
79
|
+
or
|
80
|
+
<%= @form.marksmith :body %>
|
88
81
|
```
|
89
82
|
|
90
83
|
## Options
|
91
84
|
|
92
|
-
The field supports
|
85
|
+
The field supports a few of the regular options like `disabled`, `placeholder`, `autofocus`, `style`, `class`, `rows`, `data`, and `value`, but also a custom one.
|
93
86
|
|
94
87
|
`extra_preview_params` - Sends extra params to the preview renderer.
|
95
88
|
|
@@ -98,11 +91,25 @@ The field supports some of the regular options like `disabled`, `placeholder`, `
|
|
98
91
|
The renderer is powered by [`Redcarpet`](https://github.com/vmg/redcarpet).
|
99
92
|
It supports basic styles for headings, `strong`, `italic` and others.
|
100
93
|
|
94
|
+
In your `show.html.erb` view or the place where you want to render the compiled markup use the `marksmithed` helper and it will run the content through the renderer.
|
95
|
+
|
96
|
+
```erb
|
97
|
+
<%= marksmithed post.body %>
|
98
|
+
```
|
99
|
+
|
100
|
+
## Using with importmap
|
101
|
+
|
102
|
+
It should be as simple as running this command and have it pinned in your `importmap.rb` file.
|
103
|
+
|
104
|
+
```bash
|
105
|
+
bin/importmap pin @avo-hq/marksmith
|
106
|
+
```
|
107
|
+
|
101
108
|
## Active Storage
|
102
109
|
|
103
110
|
The field supports Actve Storage uploads using drag and drop and pasting files into the field.
|
104
111
|
|
105
|
-
## List
|
112
|
+
## List Continuation
|
106
113
|
|
107
114
|
Marksmith has this great opt-in feature where you can have your lists continued.
|
108
115
|
We need to add the `ListContinuation` controller too.
|
@@ -121,8 +128,13 @@ application.register('list-continuation', ListContinuationController)
|
|
121
128
|
Contribution directions go here.
|
122
129
|
|
123
130
|
## License
|
131
|
+
|
124
132
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
125
133
|
|
134
|
+
## Usage in Avo
|
135
|
+
|
136
|
+
Marksmith work wonderfully in Avo throught the default [markdown field](https://docs.avohq.io/3.0/fields/markdown.html).
|
137
|
+
|
126
138
|
## Other Open-Source Work
|
127
139
|
|
128
140
|
- [`active_storage-blurhash`](https://github.com/avo-hq/active_storage-blurhash) - A plug-n-play [blurhash](https://blurha.sh/) integration for images stored in ActiveStorage
|
@@ -133,7 +145,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
133
145
|
|
134
146
|
## Try Avo ⭐️
|
135
147
|
|
136
|
-
If you enjoyed this gem try out [Avo](https://github.com/avo-hq/avo). It
|
148
|
+
If you enjoyed this gem try out [Avo](https://github.com/avo-hq/avo). It doubles your engineering speed without hiring extra developers. Teams build Internal Tools, Admin Panels, Content Management Systems, CRMs, and other types of Business Apps 10x faster on top of Ruby on Rails using Avo.
|
137
149
|
|
138
150
|
## Troubleshooting
|
139
151
|
|