marksmith 0.4.7 → 0.5.1

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: 62f9a5e002be55fbc62e42fc3165b217d7893f979af1f0eb4aa89ef0d166b277
4
- data.tar.gz: 8bce1f20da34493ded4fe5a6e6733eef3959446d5d341dbe7c0e843d407a0075
3
+ metadata.gz: dbea84daf14b0cab90133771f9d26505444de0aa469d28a0f51d2fdb1994d2c9
4
+ data.tar.gz: 754e03293a485251d0b5cac5dc48ee1d5214569a884946e3dda554c691a7d51d
5
5
  SHA512:
6
- metadata.gz: 20b2f362164dbb1f77516357cc6971078dd765af76622ae5a46fb048c5c1922d5f9255ae73a9693a41964ad843fe739790b61fdc1195cef7b9c21c4abedc0767
7
- data.tar.gz: a33663a174af96878c6beb88ce67a94a78260a9bcdfc27434e82c67ffc157185135fbcc11f9f77c38589a7c9735d95ab9b81aaa6d2f386634568cd60a062bdee
6
+ metadata.gz: cfbabde6a50498855311b9dd7a017ac52886387e57b8dfc57d2c0b4c1535beed32f9d4111816ed91904e6cc8873f18ff9b6d5f9f352631a2f3063eb0509ab048
7
+ data.tar.gz: 0757d7e8d1c6d7c479f75e081aaf7a5fede993ae1a15b03217163f864f3f4627e9db8c9561260b1faa1850e0ae61f5e2a2b0a9e28bc6b077e9caec2c4680fb66
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.7
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.7
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.7
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.7
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);
@@ -856,6 +859,9 @@
856
859
  .ms\:items-center {
857
860
  align-items: center;
858
861
  }
862
+ .ms\:justify-between {
863
+ justify-content: space-between;
864
+ }
859
865
  .ms\:gap-1 {
860
866
  gap: calc(var(--ms-spacing) * 1);
861
867
  }
@@ -878,6 +884,9 @@
878
884
  .ms\:rounded-md {
879
885
  border-radius: var(--ms-radius-md);
880
886
  }
887
+ .ms\:rounded-none {
888
+ border-radius: 0;
889
+ }
881
890
  .ms\:rounded-t-md {
882
891
  border-top-left-radius: var(--ms-radius-md);
883
892
  border-top-right-radius: var(--ms-radius-md);
@@ -1130,9 +1139,14 @@
1130
1139
  border-color: var(--ms-color-neutral-500);
1131
1140
  }
1132
1141
  }
1133
- .ms\:\[\.active\]\:bg-neutral-50 {
1142
+ .ms\:\[\.active\]\:border-b-transparent {
1143
+ &:is(.active) {
1144
+ border-bottom-color: transparent;
1145
+ }
1146
+ }
1147
+ .ms\:\[\.active\]\:bg-white {
1134
1148
  &:is(.active) {
1135
- background-color: var(--ms-color-neutral-50);
1149
+ background-color: var(--ms-color-white);
1136
1150
  }
1137
1151
  }
1138
1152
  .ms\:\[\.active\]\:text-neutral-900 {
@@ -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-neutral-50 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,5 +1,5 @@
1
1
  <%= tag.div class: class_names(
2
- "marksmith-toolbar ms:flex-1 ms:flex-col-reverse ms:@md:flex-row ms:grow ms:flex ms:justify-bewteen ms:bg-neutral-50 ms:rounded-t-md ms:gap-y-1",
2
+ "marksmith-toolbar ms:flex-1 ms:flex-col-reverse ms:@md:flex-row ms:grow ms:flex ms:justify-between ms:bg-neutral-50 ms:rounded-t-md ms:gap-y-1",
3
3
  "ms:dark:bg-neutral-700 ms:dark:text-neutral-200"
4
4
  ) do %>
5
5
  <%= render partial: "marksmith/shared/tabs" %>
@@ -1,10 +1,53 @@
1
1
  module Marksmith
2
2
  class Configuration
3
- include ActiveSupport::Configurable
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
4
17
 
5
- config_accessor(:automatically_mount_engine) { true }
6
- config_accessor(:mount_path) { "/marksmith" }
7
- config_accessor(:parser) { "commonmarker" }
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
+
43
+ class_attribute :automatically_mount_engine, default: true
44
+ class_attribute :mount_path, default: "/marksmith"
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
8
51
  end
9
52
 
10
53
  def self.configuration
@@ -1,3 +1,3 @@
1
1
  module Marksmith
2
- VERSION = "0.4.7"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marksmith
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin