marksmith 0.4.8 → 0.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd114ef023d1bb2bf2a4c1e530269cef7f7dda64fbd46c6da455798dc7384675
4
- data.tar.gz: 2fe6423eab7d334177cdc13583536f1c64624bed78aa17181f222bbadae6b636
3
+ metadata.gz: c7d7e167d0588789f99d5724ef2749ccd44ead4a37a208d20a3c8679f524e709
4
+ data.tar.gz: 4c0287ece0c3816d067c2097127bc95f24ef48973266778830106056d7242e40
5
5
  SHA512:
6
- metadata.gz: 697bb4e1f8920cd111321b6fe46f14d6bfb6da573acbb56290b5560baef8f9de362d26bf60da7cbb20ce10be4ebf587b8d2de9a4d387d91aa358f08e7aef3292
7
- data.tar.gz: 61367cf4b06f4fc1b9ca92dd4aa70426ec79e41659aacc8d6349e469debefadaa86a7e2af0bb1affb9b1afe02a96c6cb4e974639a29038a9ef5a00701fd21400
6
+ metadata.gz: 6cb08ac2c4dc6f87b23d0e500e46fac5018812e6ced49ce0c3ec4b728db8bd5a508059bc7026c822edc035ad93bea119601cb1e74bbbd87ec6bf25cb9136ec10
7
+ data.tar.gz: 89864c05c85ed0c8d10793dfddfc6bd664e75d56dbc684a3d8fdaf150887b7711de29bc63a0ff97e0e50fb198ea76c7ac4212eda8daba576c6438e3cca8d8939
data/README.md CHANGED
@@ -23,6 +23,13 @@ Temporary live demo here, under the description field: [https://main.avodemo.com
23
23
 
24
24
  ## Installation
25
25
 
26
+ #### Prerequisites
27
+
28
+ Marksmith integrates with Rails apps using Stimulus controllers and Turbo Streams, so the following must already be installed and configured:
29
+ - [`@hotwired/stimulus` package](https://github.com/hotwired/stimulus)
30
+ - [`@hotwired/turbo` package](https://github.com/hotwired/turbo)
31
+ - [`turbo-rails` gem](https://github.com/hotwired/turbo-rails)
32
+
26
33
  #### 1. Add `marksmith` to your `Gemfile`
27
34
 
28
35
  Have Bundler add it by running this command:
@@ -187,6 +194,30 @@ Marksmith.configure do |config|
187
194
  end
188
195
  ```
189
196
 
197
+ If you're using `redcarpet`, you can override the default parser flags through configuration. The defaults match the built-in behavior.
198
+
199
+ ```ruby
200
+ # config/initializers/marksmith.rb
201
+ Marksmith.configure do |config|
202
+ config.parser = "redcarpet"
203
+ config.redcarpet_options = {
204
+ underline: false,
205
+ highlight: false
206
+ }
207
+ end
208
+ ```
209
+
210
+ Or override individual flags directly:
211
+
212
+ ```ruby
213
+ # config/initializers/marksmith.rb
214
+ Marksmith.configure do |config|
215
+ config.parser = "redcarpet"
216
+ config.redcarpet_options.underline = false
217
+ config.redcarpet_options.highlight = false
218
+ end
219
+ ```
220
+
190
221
  ### Add your own renderer
191
222
 
192
223
  You can completely customize the renderer by overriding the `Marksmith::Renderer` model.
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" role="img" class="ms:inline ms:size-4"><script xmlns="" src="chrome-extension://hoklmmgfnpapgjgcpechhaamimifchmp/frame_ant/frame_ant.js"/><title>Markdown icon</title><path d="M22.269 19.385H1.731a1.73 1.73 0 0 1-1.73-1.73V6.345a1.73 1.73 0 0 1 1.73-1.73h20.538a1.73 1.73 0 0 1 1.73 1.73v11.308a1.73 1.73 0 0 1-1.73 1.731zm-16.5-3.462v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.461v7.847zM21.231 12h-2.308V8.077h-2.307V12h-2.308l3.461 4.039z"/></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" role="img" class="ms:inline ms:size-4"><title>Markdown icon</title><path d="M22.269 19.385H1.731a1.73 1.73 0 0 1-1.73-1.73V6.345a1.73 1.73 0 0 1 1.73-1.73h20.538a1.73 1.73 0 0 1 1.73 1.73v11.308a1.73 1.73 0 0 1-1.73 1.731zm-16.5-3.462v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.461v7.847zM21.231 12h-2.308V8.077h-2.307V12h-2.308l3.461 4.039z"/></svg>
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Marksmith 0.4.8
2
+ Marksmith 0.5.1
3
3
  */
4
4
  var ListContinuationController = (function () {
5
5
  'use strict';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Marksmith 0.4.8
2
+ Marksmith 0.5.1
3
3
  */
4
4
  var ListContinuationController = (function (stimulus) {
5
5
  'use strict';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Marksmith 0.4.8
2
+ Marksmith 0.5.1
3
3
  */
4
4
  var MarksmithController = (function () {
5
5
  'use strict';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Marksmith 0.4.8
2
+ Marksmith 0.5.1
3
3
  */
4
4
  var MarksmithController = (function (stimulus) {
5
5
  'use strict';
@@ -373,9 +373,6 @@
373
373
  .ms\:pointer-events-none {
374
374
  pointer-events: none;
375
375
  }
376
- .ms\:-my-px {
377
- margin-block: -1px;
378
- }
379
376
  .ms\:prose {
380
377
  color: var(--tw-prose-body);
381
378
  max-width: 65ch;
@@ -791,6 +788,12 @@
791
788
  margin-bottom: 0;
792
789
  }
793
790
  }
791
+ .ms\:-mt-px {
792
+ margin-top: -1px;
793
+ }
794
+ .ms\:-mb-px {
795
+ margin-bottom: -1px;
796
+ }
794
797
  .ms\:-ml-px {
795
798
  margin-left: -1px;
796
799
  }
@@ -817,8 +820,8 @@
817
820
  width: 100%;
818
821
  height: 100%;
819
822
  }
820
- .ms\:h-\[calc\(100\%\+3px\)\] {
821
- height: calc(100% + 3px);
823
+ .ms\:h-\[calc\(100\%\+2px\)\] {
824
+ height: calc(100% + 2px);
822
825
  }
823
826
  .ms\:min-h-60 {
824
827
  min-height: calc(var(--ms-spacing) * 60);
@@ -881,6 +884,9 @@
881
884
  .ms\:rounded-md {
882
885
  border-radius: var(--ms-radius-md);
883
886
  }
887
+ .ms\:rounded-none {
888
+ border-radius: 0;
889
+ }
884
890
  .ms\:rounded-t-md {
885
891
  border-top-left-radius: var(--ms-radius-md);
886
892
  border-top-right-radius: var(--ms-radius-md);
@@ -1133,6 +1139,11 @@
1133
1139
  border-color: var(--ms-color-neutral-500);
1134
1140
  }
1135
1141
  }
1142
+ .ms\:\[\.active\]\:border-b-transparent {
1143
+ &:is(.active) {
1144
+ border-bottom-color: transparent;
1145
+ }
1146
+ }
1136
1147
  .ms\:\[\.active\]\:bg-white {
1137
1148
  &:is(.active) {
1138
1149
  background-color: var(--ms-color-white);
@@ -42,11 +42,11 @@ module Marksmith
42
42
  "marksmith-toggle-button ms:text-sm ms:hover:bg-neutral-300 ms:text-sm ms:font-medium ms:cursor-pointer ms:text-neutral-500 ms:px-3",
43
43
  # borders
44
44
  "ms:bg-transparent ms:hover:bg-transparent",
45
- "ms:-my-px ms:-ml-px ms:border ms:border-transparent",
46
- "ms:h-[calc(100%+3px)] ms:border-b-none",
45
+ "ms:-mt-px ms:-mb-px ms:-ml-px ms:border ms:border-transparent",
46
+ "ms:h-[calc(100%+2px)] ms:border-b-none",
47
47
  # "ms:border-b-neutral-00",
48
48
  # active classes
49
- "ms:[.active]:bg-white ms:[.active]:text-neutral-900 ms:dark:[.active]:text-neutral-300 ms:[.active]:dark:bg-neutral-800 ms:[.active]:dark:border-neutral-500 ms:[.active]:rounded-t-md ms:[.active]:border-neutral-500",
49
+ "ms:[.active]:bg-white ms:[.active]:text-neutral-900 ms:dark:[.active]:text-neutral-300 ms:[.active]:dark:bg-neutral-800 ms:[.active]:dark:border-neutral-500 ms:[.active]:rounded-t-md ms:[.active]:border-neutral-500 ms:[.active]:border-b-transparent",
50
50
 
51
51
  )
52
52
  end
@@ -23,17 +23,7 @@ module Marksmith
23
23
  def render_redcarpet
24
24
  ::Redcarpet::Markdown.new(
25
25
  ::Redcarpet::Render::HTML,
26
- tables: true,
27
- lax_spacing: true,
28
- fenced_code_blocks: true,
29
- space_after_headers: true,
30
- hard_wrap: true,
31
- autolink: true,
32
- strikethrough: true,
33
- underline: true,
34
- highlight: true,
35
- quote: true,
36
- with_toc_data: true
26
+ Marksmith.configuration.redcarpet_options.to_h
37
27
  ).render(@body)
38
28
  end
39
29
 
@@ -2,7 +2,7 @@
2
2
  <%= text_area_tag editor.field_name, editor.value,
3
3
  id: editor.textarea_id,
4
4
  class: class_names(
5
- "marksmith-textarea ms:flex ms:flex-1 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 ms:field-sizing-content ms:min-h-60",
5
+ "marksmith-textarea ms:flex ms:flex-1 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 ms:field-sizing-content ms:min-h-60 ms:rounded-none",
6
6
  "ms:dark:bg-neutral-800 ms:dark:text-neutral-200",
7
7
  editor.classes
8
8
  ),
@@ -1,8 +1,53 @@
1
1
  module Marksmith
2
2
  class Configuration
3
+ class RedcarpetOptions
4
+ DEFAULTS = {
5
+ tables: true,
6
+ lax_spacing: true,
7
+ fenced_code_blocks: true,
8
+ space_after_headers: true,
9
+ hard_wrap: true,
10
+ autolink: true,
11
+ strikethrough: true,
12
+ underline: true,
13
+ highlight: true,
14
+ quote: true,
15
+ with_toc_data: true
16
+ }.freeze
17
+
18
+ DEFAULTS.each do |name, default|
19
+ class_attribute name, default: default
20
+ end
21
+
22
+ def self.merge(options)
23
+ options.to_h.each do |key, value|
24
+ writer = "#{key}="
25
+
26
+ unless respond_to?(writer)
27
+ raise ArgumentError, "Unknown Redcarpet option: #{key}"
28
+ end
29
+
30
+ public_send(writer, value)
31
+ end
32
+
33
+ self
34
+ end
35
+
36
+ def self.to_h
37
+ DEFAULTS.keys.each_with_object({}) do |key, hash|
38
+ hash[key] = public_send(key)
39
+ end
40
+ end
41
+ end
42
+
3
43
  class_attribute :automatically_mount_engine, default: true
4
44
  class_attribute :mount_path, default: "/marksmith"
5
45
  class_attribute :parser, default: "commonmarker"
46
+ class_attribute :redcarpet_options, default: RedcarpetOptions
47
+
48
+ def redcarpet_options=(options)
49
+ self.class.redcarpet_options = redcarpet_options.merge(options.to_h)
50
+ end
6
51
  end
7
52
 
8
53
  def self.configuration
@@ -56,7 +56,7 @@ module Marksmith
56
56
  require "marksmith/fields/markdown_field"
57
57
 
58
58
  ActiveSupport.on_load(:avo_boot) do
59
- Avo.plugin_manager.register :marksmith_field
59
+ Avo.plugin_manager.register :marksmith
60
60
 
61
61
  Avo.plugin_manager.register_field :markdown, Marksmith::Fields::MarkdownField
62
62
  Avo.plugin_manager.register_field :marksmith, Marksmith::Fields::MarkdownField
@@ -1,3 +1,3 @@
1
1
  module Marksmith
2
- VERSION = "0.4.8"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marksmith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-06-02 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: activesupport
@@ -102,6 +103,7 @@ metadata:
102
103
  homepage_uri: https://github.com/avo-hq/marksmith
103
104
  source_code_uri: https://github.com/avo-hq/marksmith
104
105
  changelog_uri: https://github.com/avo-hq/marksmith/releases
106
+ post_install_message:
105
107
  rdoc_options: []
106
108
  require_paths:
107
109
  - lib
@@ -116,7 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
118
  - !ruby/object:Gem::Version
117
119
  version: '0'
118
120
  requirements: []
119
- rubygems_version: 3.6.9
121
+ rubygems_version: 3.5.22
122
+ signing_key:
120
123
  specification_version: 4
121
124
  summary: Marksmith is a GitHub-style markdown editor for Ruby on Rails applications.
122
125
  test_files: []