@quartz-community/obsidian-flavored-markdown 2.0.0 → 2.1.0

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8575260: Highlights render as in Obsidian: `==text==` becomes `<mark class="text-highlight">` and keeps what's inside it. Formatting in a highlight no longer deletes text (`==**bold** and *italic*==` rendered only " and "), and links and tags in a highlight work. Coloured highlights (Obsidian 1.14) now work too: a highlight that starts with a colour emoji (🔴 🟠 🟡 🟢 🔵 🟣, or the matching squares) is coloured and the emoji removed, e.g. `==🔴 urgent==`.
8
+
3
9
  ## 2.0.0
4
10
 
5
11
  ### Major Changes
package/dist/index.js CHANGED
@@ -37922,6 +37922,9 @@ var embeds_inline_default = 'article object[type="image/svg+xml"] {\n max-width
37922
37922
  // src/styles/tags.inline.scss
37923
37923
  var tags_inline_default = 'article span.tag-link {\n background-color: var(--highlight);\n padding: 0 0.1rem;\n border-radius: 5px;\n line-height: 1.4rem;\n}\narticle span.tag-link::before {\n content: "#";\n}';
37924
37924
 
37925
+ // src/styles/highlights.inline.scss
37926
+ var highlights_inline_default = "mark.text-highlight {\n color: inherit;\n}\n\nmark.text-highlight[data-highlight] {\n background-color: color-mix(in srgb, var(--highlight-colour) 30%, transparent);\n}\n\nmark.text-highlight[data-highlight=red] {\n --highlight-colour: #e93147;\n}\n\nmark.text-highlight[data-highlight=orange] {\n --highlight-colour: #ec7500;\n}\n\nmark.text-highlight[data-highlight=yellow] {\n --highlight-colour: #e0ac00;\n}\n\nmark.text-highlight[data-highlight=green] {\n --highlight-colour: #08b94e;\n}\n\nmark.text-highlight[data-highlight=blue] {\n --highlight-colour: #086ddd;\n}\n\nmark.text-highlight[data-highlight=purple] {\n --highlight-colour: #7852ee;\n}";
37927
+
37925
37928
  // node_modules/mdast-util-to-hast/lib/handlers/blockquote.js
37926
37929
  function blockquote3(state, node2) {
37927
37930
  const result = {
@@ -39763,13 +39766,6 @@ var markdownImageSizeRegex = /^(?<alt>.*?)\|\s*(?<width>\d+)(?:x(?<height>\d+))?
39763
39766
  function escapeAttribute2(value2) {
39764
39767
  return value2.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
39765
39768
  }
39766
- var getLiteralValue = (child) => {
39767
- const literalChild = child;
39768
- if (typeof literalChild.value === "string") {
39769
- return literalChild.value;
39770
- }
39771
- return "";
39772
- };
39773
39769
  var mdastToHtml = (ast) => {
39774
39770
  const hast = toHast(ast, { allowDangerousHtml: true });
39775
39771
  return toHtml(hast, { allowDangerousHtml: true });
@@ -39954,15 +39950,13 @@ var ObsidianFlavoredMarkdown = (userOpts) => {
39954
39950
  visit3(
39955
39951
  tree,
39956
39952
  (node2) => node2.type === "highlight",
39957
- (node2, index2, parent) => {
39958
- if (parent == null || index2 == null) return;
39953
+ (node2) => {
39959
39954
  const highlightNode = node2;
39960
- const text8 = highlightNode.children?.map(getLiteralValue).join("") ?? "";
39961
- parent.children[index2] = {
39962
- type: "html",
39963
- value: `<span class="text-highlight">${text8}</span>`
39955
+ highlightNode.data = {
39956
+ ...highlightNode.data,
39957
+ hName: "mark",
39958
+ hProperties: { className: ["text-highlight"] }
39964
39959
  };
39965
- return SKIP3;
39966
39960
  }
39967
39961
  );
39968
39962
  }
@@ -40036,7 +40030,7 @@ var ObsidianFlavoredMarkdown = (userOpts) => {
40036
40030
  if (opts.highlight) {
40037
40031
  node2.value = node2.value.replace(
40038
40032
  /==((?!=).+?)==/g,
40039
- `<span class="text-highlight">$1</span>`
40033
+ `<mark class="text-highlight">$1</mark>`
40040
40034
  );
40041
40035
  }
40042
40036
  if (opts.parseTags) {
@@ -40171,6 +40165,12 @@ var ObsidianFlavoredMarkdown = (userOpts) => {
40171
40165
  inline: true
40172
40166
  });
40173
40167
  }
40168
+ if (opts.highlight) {
40169
+ css.push({
40170
+ content: highlights_inline_default,
40171
+ inline: true
40172
+ });
40173
+ }
40174
40174
  if (opts.parseTags) {
40175
40175
  css.push({
40176
40176
  content: tags_inline_default,