@quarto/jupyterlab-quarto 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -147,7 +147,16 @@ function renderFrontMatter(tokens, idx) {
147
147
  }
148
148
  };
149
149
  // Read simple values
150
- const eatKeys = ['title', 'subtitle', 'abstract', 'date', 'date-modified', 'doi', 'author', 'authors'];
150
+ const eatKeys = [
151
+ 'title',
152
+ 'subtitle',
153
+ 'abstract',
154
+ 'date',
155
+ 'date-modified',
156
+ 'doi',
157
+ 'author',
158
+ 'authors'
159
+ ];
151
160
  titleBlock.title = readStr('title');
152
161
  titleBlock.subtitle = readStr('subtitle');
153
162
  titleBlock.abstract = readStr('abstract');
@@ -171,9 +180,11 @@ function renderFrontMatter(tokens, idx) {
171
180
  // Use the raw YAML string so we don't end up mutating / round tripping the YAML
172
181
  let eating = false;
173
182
  const outputYaml = [];
174
- const yamlNoDelimiters = token.markup.replace(/---\s*$/, '').replace(/^---\s*/, '');
175
- for (const line of yamlNoDelimiters.split("\n")) {
176
- const eatKey = eatKeys.some((k) => {
183
+ const yamlNoDelimiters = token.markup
184
+ .replace(/---\s*$/, '')
185
+ .replace(/^---\s*/, '');
186
+ for (const line of yamlNoDelimiters.split('\n')) {
187
+ const eatKey = eatKeys.some(k => {
177
188
  const match = line.match(RegExp(`^${k}\\s*:`));
178
189
  return match !== null;
179
190
  });
@@ -187,7 +198,7 @@ function renderFrontMatter(tokens, idx) {
187
198
  }
188
199
  }
189
200
  }
190
- const otherYamlRendered = `<pre class="quarto-frontmatter-container"><code class="cm-s-jupyter language-yaml quarto-frontmatter">${outputYaml.join("\n")}</code></pre>`;
201
+ const otherYamlRendered = `<pre class="quarto-frontmatter-container"><code class="cm-s-jupyter language-yaml quarto-frontmatter">${outputYaml.join('\n')}</code></pre>`;
191
202
  titleLines.push(otherYamlRendered);
192
203
  }
193
204
  return titleLines.join('\n');
@@ -61,16 +61,22 @@ MathJax = {
61
61
  });
62
62
 
63
63
  const markdownNodes = nodes.filter((node) => {
64
- return node.class.contains("jp-MarkdownCell");
64
+ return node.classList.contains("jp-MarkdownCell");
65
65
  }).forEach((node) => {
66
66
  typesetCellObserver.observe(node, { childList: true, subtree: true });
67
67
  });
68
68
 
69
69
  });
70
70
 
71
- const nbContainer = document.querySelector('.jp-Notebook');
72
- if (nbContainer !== null) {
73
- containerObserver.observe(nbContainer, { childList: true });
71
+ const cellEl = document.querySelector('.jp-Cell');
72
+ if (cellEl !== null) {
73
+ const cellParentEl = cellEl.parentElement;
74
+ containerObserver.observe(cellParentEl, { childList: true });
75
+ } else {
76
+ const nbContainer = document.querySelector('.jp-Notebook');
77
+ if (nbContainer !== null) {
78
+ containerObserver.observe(nbContainer, { childList: true, subtree: true });
79
+ }
74
80
  }
75
81
 
76
82
  const mathEls = document.body.querySelectorAll('.quarto-inline-math, .quarto-display-math');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.2.8",
3
2
  "name": "@quarto/jupyterlab-quarto",
3
+ "version": "0.2.9",
4
4
  "description": "Jupyter extension to enable authoring of Quarto documents within Jupyterlab Notebooks.",
5
5
  "keywords": [
6
6
  "jupyter",