diff --git a/Gemfile.lock b/Gemfile.lock index a0a44f206..a2e7c4a59 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -132,11 +132,7 @@ PATH remote: /Users/jorge/Work/jorgemanrubia/actiontext-lexical specs: actiontext-lexical (0.1.0) - capybara - cuprite - image_processing rails (>= 8.0.2) - selenium-webdriver GEM remote: https://rubygems.org/ @@ -173,9 +169,6 @@ GEM bigdecimal rexml crass (1.0.6) - cuprite (0.17) - capybara (~> 3.0) - ferrum (~> 0.17.0) date (3.4.1) debug (1.10.0) irb (~> 1.10) @@ -198,12 +191,6 @@ GEM net-http (>= 0.5.0) faraday-retry (2.3.1) faraday (~> 2.0) - ferrum (0.17.1) - addressable (~> 2.5) - base64 (~> 0.2) - concurrent-ruby (~> 1.1) - webrick (~> 1.7) - websocket-driver (~> 0.7) ffi (1.17.2) ffi (1.17.2-arm64-darwin) ffi (1.17.2-x86_64-darwin) @@ -456,7 +443,6 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.9.1) websocket (1.2.11) websocket-driver (0.7.7) base64 diff --git a/app/assets/stylesheets/rich-text-content.css b/app/assets/stylesheets/rich-text-content.css index 86b1d18da..517157dd0 100644 --- a/app/assets/stylesheets/rich-text-content.css +++ b/app/assets/stylesheets/rich-text-content.css @@ -132,6 +132,7 @@ /* Code */ code[data-language] { display: block; + white-space: pre; } code:not([data-language]) { @@ -159,37 +160,77 @@ } /* Syntax token colors */ - .code-token__attr { - color: #b000b5; /* violet-ish for keywords and attributes */ - } + code[data-language] { + /* Keywords and attributes */ + .code-token__attr, + .token.atrule, + .token.attr, + .token.keyword { + color: #d73a49; + } - .code-token__property { - color: #007acc; /* cool blue for numbers, booleans, constants, etc. */ - } + /* Constants, booleans, numbers, properties, tags */ + .code-token__property, + .token.boolean, + .token.constant, + .token.deleted, + .token.number, + .token.property, + .token.symbol, + .token.tag { + color: #005cc5; + } - .code-token__selector { - color: #22863a; /* green for strings, selectors, inserted, etc. */ - } + /* Strings, selectors, and built-in constructs */ + .code-token__selector, + .token.builtin, + .token.char, + .token.inserted, + .token.selector, + .token.string { + color: #032f62; + } - .code-token__comment { - color: #90a4ae; /* soft gray-blue for comments */ - font-style: italic; - } + /* Comments and meta information */ + .code-token__comment, + .token.cdata, + .token.comment, + .token.doctype, + .token.prolog { + color: #6a737d; + font-style: italic; + } - .code-token__operator { - color: #d73a49; /* red for operators, URLs, etc. */ - } + /* Operators and symbolic entities */ + .code-token__operator, + .token.entity, + .token.operator, + .token.url { + color: #d73a49; + } - .code-token__function { - color: #005cc5; /* bold blue for function and class names */ - } + /* Functions and class names */ + .code-token__function, + .token.class, + .token.class-name, + .token.function { + color: #6f42c1; + } - .code-token__variable { - color: #e36209; /* orange for variables, important things */ - } + /* Variables, regex, namespaces, important */ + .code-token__variable, + .token.important, + .token.namespace, + .token.regex, + .token.variable { + color: #e36209; + } - .code-token__punctuation { - color: #607d8b; /* muted blue-gray for punctuation */ + /* Punctuation */ + .code-token__punctuation, + .token.punctuation { + color: #24292e; + } } } } diff --git a/app/javascript/controllers/syntax_highlight_controller.js b/app/javascript/controllers/syntax_highlight_controller.js new file mode 100644 index 000000000..02b66a0f7 --- /dev/null +++ b/app/javascript/controllers/syntax_highlight_controller.js @@ -0,0 +1,8 @@ +import { Controller } from "@hotwired/stimulus" +import { highlightAll } from "actiontext-lexical" + +export default class extends Controller { + connect() { + highlightAll() + } +} diff --git a/app/views/cards/container/_title.html.erb b/app/views/cards/container/_title.html.erb index 837356fb3..4ab8a0dd2 100644 --- a/app/views/cards/container/_title.html.erb +++ b/app/views/cards/container/_title.html.erb @@ -4,7 +4,7 @@

<%= link_to card.title, edit_collection_card_path(card.collection, card), class: "card__title-link" %>

-
+
<%= card.description %>