@astrojs/markdown-remark 0.8.2 → 0.9.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.
- package/CHANGELOG.md +20 -0
- package/astrojs-markdown-remark-0.9.2.tgz +0 -0
- package/dist/remark-expressions.js +0 -6
- package/dist/remark-shiki.js +3 -0
- package/package.json +1 -2
- package/src/remark-expressions.ts +0 -6
- package/src/remark-shiki.ts +7 -0
- package/astrojs-markdown-remark-0.8.2.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @astrojs/markdown-remark
|
|
2
2
|
|
|
3
|
+
## 0.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3152](https://github.com/withastro/astro/pull/3152) [`9ba1f4f8`](https://github.com/withastro/astro/commit/9ba1f4f8251155b69398a8af22d6ab8587b96120) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Fix JSX expression inconsistencies within markdown files
|
|
8
|
+
|
|
9
|
+
## 0.9.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#3108](https://github.com/withastro/astro/pull/3108) [`ef198ff8`](https://github.com/withastro/astro/commit/ef198ff8351ac8fbc868e209f9cd410dc8b6f265) Thanks [@FredKSchott](https://github.com/FredKSchott)! - shiki: Add `diff` symbol handling to disable `user-select` on `+`/`-` symbols.
|
|
14
|
+
|
|
15
|
+
## 0.9.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [`53162534`](https://github.com/withastro/astro/commit/53162534450e160f65b95e7ef1523a106347ca28) Thanks [@FredKSchott](https://github.com/FredKSchott)! - - Removed `renderMarkdownWithFrontmatter` because it wasn't being used
|
|
20
|
+
- All options of `renderMarkdown` are now required — see the exported interface `AstroMarkdownOptions`
|
|
21
|
+
- New types: RemarkPlugin, RehypePlugin and ShikiConfig
|
|
22
|
+
|
|
3
23
|
## 0.8.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
Binary file
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
let mdxExpression;
|
|
2
1
|
let mdxExpressionFromMarkdown;
|
|
3
2
|
let mdxExpressionToMarkdown;
|
|
4
3
|
function remarkExpressions(options) {
|
|
5
4
|
let settings = options || {};
|
|
6
5
|
let data = this.data();
|
|
7
|
-
add("micromarkExtensions", mdxExpression({}));
|
|
8
6
|
add("fromMarkdownExtensions", mdxExpressionFromMarkdown);
|
|
9
7
|
add("toMarkdownExtensions", mdxExpressionToMarkdown);
|
|
10
8
|
function add(field, value) {
|
|
@@ -15,10 +13,6 @@ function remarkExpressions(options) {
|
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
async function loadRemarkExpressions() {
|
|
18
|
-
if (!mdxExpression) {
|
|
19
|
-
const micromarkMdxExpression = await import("micromark-extension-mdx-expression");
|
|
20
|
-
mdxExpression = micromarkMdxExpression.mdxExpression;
|
|
21
|
-
}
|
|
22
16
|
if (!mdxExpressionFromMarkdown || !mdxExpressionToMarkdown) {
|
|
23
17
|
const mdastUtilMdxExpression = await import("mdast-util-mdx-expression");
|
|
24
18
|
mdxExpressionFromMarkdown = mdastUtilMdxExpression.mdxExpressionFromMarkdown;
|
package/dist/remark-shiki.js
CHANGED
|
@@ -17,6 +17,9 @@ const remarkShiki = async ({ langs, theme, wrap }, scopedClassName) => {
|
|
|
17
17
|
let html = highlighter.codeToHtml(node.value, { lang: node.lang ?? "plaintext" });
|
|
18
18
|
html = html.replace('<pre class="shiki"', `<pre is:raw class="astro-code${scopedClassName ? " " + scopedClassName : ""}"`);
|
|
19
19
|
html = html.replace(/style="(background-)?color: var\(--shiki-/g, 'style="$1color: var(--astro-code-');
|
|
20
|
+
if (node.lang === "diff") {
|
|
21
|
+
html = html.replace(/<span class="line"><span style="(.*?)">([\+|\-])/g, '<span class="line"><span style="$1"><span style="user-select: none;">$2</span>');
|
|
22
|
+
}
|
|
20
23
|
if (wrap === false) {
|
|
21
24
|
html = html.replace(/style="(.*?)"/, 'style="$1; overflow-x: auto;"');
|
|
22
25
|
} else if (wrap === true) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/markdown-remark",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "withastro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"mdast-util-mdx-expression": "^1.2.0",
|
|
30
30
|
"mdast-util-mdx-jsx": "^1.2.0",
|
|
31
31
|
"mdast-util-to-string": "^3.1.0",
|
|
32
|
-
"micromark-extension-mdx-expression": "^1.0.3",
|
|
33
32
|
"micromark-extension-mdx-jsx": "^1.0.3",
|
|
34
33
|
"prismjs": "^1.27.0",
|
|
35
34
|
"rehype-raw": "^6.1.1",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Vite bug: dynamically import() modules needed for CJS. Cache in memory to keep side effects
|
|
2
|
-
let mdxExpression: any;
|
|
3
2
|
let mdxExpressionFromMarkdown: any;
|
|
4
3
|
let mdxExpressionToMarkdown: any;
|
|
5
4
|
|
|
@@ -7,7 +6,6 @@ export function remarkExpressions(this: any, options: any) {
|
|
|
7
6
|
let settings = options || {};
|
|
8
7
|
let data = this.data();
|
|
9
8
|
|
|
10
|
-
add('micromarkExtensions', mdxExpression({}));
|
|
11
9
|
add('fromMarkdownExtensions', mdxExpressionFromMarkdown);
|
|
12
10
|
add('toMarkdownExtensions', mdxExpressionToMarkdown);
|
|
13
11
|
|
|
@@ -19,10 +17,6 @@ export function remarkExpressions(this: any, options: any) {
|
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
export async function loadRemarkExpressions() {
|
|
22
|
-
if (!mdxExpression) {
|
|
23
|
-
const micromarkMdxExpression = await import('micromark-extension-mdx-expression');
|
|
24
|
-
mdxExpression = micromarkMdxExpression.mdxExpression;
|
|
25
|
-
}
|
|
26
20
|
if (!mdxExpressionFromMarkdown || !mdxExpressionToMarkdown) {
|
|
27
21
|
const mdastUtilMdxExpression = await import('mdast-util-mdx-expression');
|
|
28
22
|
mdxExpressionFromMarkdown = mdastUtilMdxExpression.mdxExpressionFromMarkdown;
|
package/src/remark-shiki.ts
CHANGED
|
@@ -48,6 +48,13 @@ const remarkShiki = async (
|
|
|
48
48
|
/style="(background-)?color: var\(--shiki-/g,
|
|
49
49
|
'style="$1color: var(--astro-code-'
|
|
50
50
|
);
|
|
51
|
+
// Add "user-select: none;" for "+"/"-" diff symbols
|
|
52
|
+
if (node.lang === 'diff') {
|
|
53
|
+
html = html.replace(
|
|
54
|
+
/<span class="line"><span style="(.*?)">([\+|\-])/g,
|
|
55
|
+
'<span class="line"><span style="$1"><span style="user-select: none;">$2</span>'
|
|
56
|
+
);
|
|
57
|
+
}
|
|
51
58
|
// Handle code wrapping
|
|
52
59
|
// if wrap=null, do nothing.
|
|
53
60
|
if (wrap === false) {
|
|
Binary file
|