From 754b628ce8d7c4e33527a66f46a32003d0c843fa Mon Sep 17 00:00:00 2001 From: Ryosuke Igarashi Date: Tue, 20 Aug 2024 17:33:58 +0900 Subject: [PATCH 01/11] =?UTF-8?q?fix:=20=E8=A8=98=E8=BF=B0=E3=81=8C?= =?UTF-8?q?=E5=8F=A4=E3=81=8F=E3=80=81=E9=96=8B=E7=99=BA=E8=80=85=E5=90=91?= =?UTF-8?q?=E3=81=91=E3=83=89=E3=82=AD=E3=83=A5=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=A8=E9=87=8D=E8=A4=87=E3=81=99=E3=82=8B=E3=81=AE=E3=81=A7?= =?UTF-8?q?=E5=89=8A=E9=99=A4=E3=81=97=E3=81=BE=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CONTRIBUTING.md | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 730dc7c2..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,48 +0,0 @@ -# Contribution Guide - -## Issues - -- zenn.dev に関する問題や改善提案は[zenn-community](https://github.com/zenn-dev/zenn-community/issues)の Issues をご利用ください。 -- zenn-cli に関する問題や改善の提案については[zenn-community](https://github.com/zenn-dev/zenn-community/issues) もしくは 本リポジトリの Issues をご利用ください。 - -## Pull Requests - -- レビューに時間がかかる場合やマージを行わずにクローズする場合があります。特に機能追加に関してはあらかじめ Issues で議論させていただければと思います。 - -### PR 作成時の注意点 - -- `canary`ブランチに対して作成してください。 - -## リリースフロー - -#### canary バージョン(α 版)のリリース - -- canary ブランチに変更をマージすると`canary`バージョンが自動リリースされます -- canary バージョンは`npm install zenn-cli@canary`で試すことができます - -#### latest バージョン(正式版)のリリース - -- canary ブランチから main ブランチに PR を作成します(release ラベルを付与) -- main ブランチにマージされると`latest`バージョンが自動リリースされます -- ユーザーは `npm install zenn-cli@latest` でインストールできます - -## 構成 - -lerna を使ったモノレポ管理をしています - -- **zenn-cli**: ローカルの markdown ファイルを管理/プレビュー -- **zenn-content-css**: コンテンツ本文の CSS(ZennCLI および zenn.dev で使用) -- **zenn-embed-elements**: KaTeX記法を有効化するためのCustom Elements(ZennCLI および zenn.dev で使用) -- **zenn-markdown-html**: マークダウンから HTML への変換を行う(Zenn CLI および zenn.dev で使用) - -### Develop - -#### zenn-cli - -WIP - -- `src/client`: `zenn preview`時のクライアント - - ビルドされたファイルをpublishするため、依存はdevDependenciesに指定する -- `src/server`: `zenn preview`時のサーバー(クライアントから参照するAPI) - - From 7439d0185ed7bf8418d972df43598987496038b5 Mon Sep 17 00:00:00 2001 From: Ryosuke Igarashi Date: Tue, 20 Aug 2024 17:37:45 +0900 Subject: [PATCH 02/11] =?UTF-8?q?fix:=20Contribution=20Guide=E3=81=AEURL?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 91ac99c3..4a135c7f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,7 +8,7 @@ Resolves # プルリクエストを作成いただく際、お手数ですが以下の内容についてご確認をお願いします。 -- [ ] :book: [Contribution Guide](https://github.com/zenn-dev/zenn-editor/blob/main/CONTRIBUTING.md) を読んだ +- [ ] :book: [Contribution Guide](https://zenn-dev.github.io/zenn-docs-for-developers/contribution) を読んだ - [ ] :woman_technologist: `canary` ブランチに対するプルリクエストである - [ ] zenn-cli で実行して正しく動作しているか確認する - [ ] 不要なコードが含まれていないか( コメントやログの消し忘れに注意 ) From 6ed6868ec787319f7131347ee4e10ffddb354e46 Mon Sep 17 00:00:00 2001 From: cm-dyoshikawa Date: Thu, 12 Sep 2024 16:53:47 +0900 Subject: [PATCH 03/11] =?UTF-8?q?=E3=83=89=E3=82=AF=E3=82=BB=E3=83=AB?= =?UTF-8?q?=E5=9F=8B=E3=82=81=E8=BE=BC=E3=81=BF=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zenn-cli/articles/305-example-embed-others.md | 8 ++++++++ packages/zenn-content-css/src/_embed.scss | 1 + packages/zenn-markdown-html/src/embed.ts | 12 +++++++++++- packages/zenn-markdown-html/src/utils/url-matcher.ts | 4 ++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/packages/zenn-cli/articles/305-example-embed-others.md b/packages/zenn-cli/articles/305-example-embed-others.md index b1fc833e..4cb6d130 100644 --- a/packages/zenn-cli/articles/305-example-embed-others.md +++ b/packages/zenn-cli/articles/305-example-embed-others.md @@ -56,6 +56,14 @@ published: true @[speakerdeck](4f926da9cb4cd0001f00a1ff) +## docswell + +@[docswell](https://www.docswell.com/slide/LK7J5V/embed) + +### embed用でないdocswell URL + +@[docswell](https://www.docswell.com/s/ku-suke/LK7J5V-hello-docswell) + ## jsfiddle @[jsfiddle](https://jsfiddle.net/9wkngdue/embedded) diff --git a/packages/zenn-content-css/src/_embed.scss b/packages/zenn-content-css/src/_embed.scss index 91b199bd..ef10f705 100644 --- a/packages/zenn-content-css/src/_embed.scss +++ b/packages/zenn-content-css/src/_embed.scss @@ -8,6 +8,7 @@ span.embed-block { } .embed-slideshare, .embed-speakerdeck, +.embed-docswell, .embed-codepen, .embed-jsfiddle, .embed-youtube, diff --git a/packages/zenn-markdown-html/src/embed.ts b/packages/zenn-markdown-html/src/embed.ts index 50e400e8..695f63e9 100644 --- a/packages/zenn-markdown-html/src/embed.ts +++ b/packages/zenn-markdown-html/src/embed.ts @@ -1,7 +1,10 @@ import type { MarkdownOptions } from './types'; import { escapeHtml } from 'markdown-it/lib/common/utils'; -import { extractYoutubeVideoParameters } from './utils/url-matcher'; +import { + extractYoutubeVideoParameters, + isDocswellUrl, +} from './utils/url-matcher'; import { sanitizeEmbedToken, generateEmbedServerIframe, @@ -25,6 +28,7 @@ export type EmbedType = | 'slideshare' | 'speakerdeck' | 'jsfiddle' + | 'docswell' | 'codepen' | 'codesandbox' | 'stackblitz' @@ -77,6 +81,12 @@ export const embedGenerators: Readonly = { key )}" scrolling="no" allowfullscreen allow="encrypted-media" loading="lazy">`; }, + docswell(str) { + if (!isDocswellUrl(str)) { + return 'Docswellのembed用のURLを指定してください'; + } + return ``; + }, jsfiddle(str) { if (!isJsfiddleUrl(str)) { return 'jsfiddleのURLが不正です'; diff --git a/packages/zenn-markdown-html/src/utils/url-matcher.ts b/packages/zenn-markdown-html/src/utils/url-matcher.ts index 73ac988d..217c2556 100644 --- a/packages/zenn-markdown-html/src/utils/url-matcher.ts +++ b/packages/zenn-markdown-html/src/utils/url-matcher.ts @@ -47,6 +47,10 @@ export function isJsfiddleUrl(url: string): boolean { return /^(http|https):\/\/jsfiddle\.net\/[a-zA-Z0-9_,/-]+$/.test(url); } +export function isDocswellUrl(url: string): boolean { + return /^https:\/\/www\.docswell\.com\/[a-zA-Z0-9_,/-]+\/embed$/.test(url); +} + export function isYoutubeUrl(url: string): boolean { return [ /^https?:\/\/youtu\.be\/[\w-]+(?:\?[\w=&-]+)?$/, From 297f875295921a8e258dabf41a80f1d6a4ae614f Mon Sep 17 00:00:00 2001 From: cm-dyoshikawa Date: Thu, 12 Sep 2024 17:05:23 +0900 Subject: [PATCH 04/11] =?UTF-8?q?=E3=83=89=E3=82=AF=E3=82=BB=E3=83=AB?= =?UTF-8?q?=E5=9F=8B=E3=82=81=E8=BE=BC=E3=81=BF=E5=AF=BE=E5=BF=9C=20?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom-syntax/embed/docswell.test.ts | 20 +++++++++++ .../__tests__/matchers/isDocswellUrl.test.ts | 34 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts create mode 100644 packages/zenn-markdown-html/__tests__/matchers/isDocswellUrl.test.ts diff --git a/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts b/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts new file mode 100644 index 00000000..79707792 --- /dev/null +++ b/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts @@ -0,0 +1,20 @@ +import { describe, test, expect } from 'vitest'; +import markdownToHtml from '../../../src/index'; + +describe('Docswell', () => { + test('should generate docswell html', () => { + const html = markdownToHtml( + '@[docswell](https://www.docswell.com/slide/LK7J5V/embed)' + ); + expect(html).toContain( + '' + ); + }); + + test('should not generate docswell html with invalid url', () => { + const html = markdownToHtml( + '@[docswell](https://www.docswell.com/s/ku-suke/LK7J5V-hello-docswell)' + ); + expect(html).toContain('Doscwellのembed用のURLを指定してください'); + }); +}); diff --git a/packages/zenn-markdown-html/__tests__/matchers/isDocswellUrl.test.ts b/packages/zenn-markdown-html/__tests__/matchers/isDocswellUrl.test.ts new file mode 100644 index 00000000..158c8887 --- /dev/null +++ b/packages/zenn-markdown-html/__tests__/matchers/isDocswellUrl.test.ts @@ -0,0 +1,34 @@ +import { isDocswellUrl } from '../../src/utils/url-matcher'; +import { describe, test, expect } from 'vitest'; + +describe('isDocswellUrlのテスト', () => { + describe('Docswellの埋め込み用URLのとき', () => { + test('trueを返すこと', () => { + const docswellEmbedUrl = 'https://www.docswell.com/slide/LK7J5V/embed'; + expect(isDocswellUrl(docswellEmbedUrl)).toBe(true); + }); + }); + + describe('Docswellの他の画面のURLのとき', () => { + test('falseを返すこと', () => { + const docswellUrls = [ + 'https://www.docswell.com/', + 'https://www.docswell.com/s/ku-suke/LK7J5V-hello-docswell', + ]; + + docswellUrls.forEach((url) => { + expect(isDocswellUrl(url)).toBe(false); + }); + }); + }); + + describe('他のサイトのURLのとき', () => { + test('falseを返すこと', () => { + const otherSiteUrls = ['https://zenn.dev/', 'https://github.com/']; + + otherSiteUrls.forEach((url) => { + expect(isDocswellUrl(url)).toBe(false); + }); + }); + }); +}); From c7b7cbb6a86d2c16884b17e58ec24494a5281ced Mon Sep 17 00:00:00 2001 From: cm-dyoshikawa Date: Thu, 12 Sep 2024 17:16:18 +0900 Subject: [PATCH 05/11] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__tests__/custom-syntax/embed/docswell.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts b/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts index 79707792..ffe66190 100644 --- a/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts +++ b/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts @@ -7,7 +7,7 @@ describe('Docswell', () => { '@[docswell](https://www.docswell.com/slide/LK7J5V/embed)' ); expect(html).toContain( - '' + '' ); }); @@ -15,6 +15,6 @@ describe('Docswell', () => { const html = markdownToHtml( '@[docswell](https://www.docswell.com/s/ku-suke/LK7J5V-hello-docswell)' ); - expect(html).toContain('Doscwellのembed用のURLを指定してください'); + expect(html).toContain('Docswellのembed用のURLを指定してください'); }); }); From da86e1b100e390845c39aa53c4682d6cd61ee5a2 Mon Sep 17 00:00:00 2001 From: cm-dyoshikawa Date: Fri, 13 Sep 2024 10:33:57 +0900 Subject: [PATCH 06/11] =?UTF-8?q?import=E3=82=92=E3=81=BE=E3=81=A8?= =?UTF-8?q?=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/zenn-markdown-html/src/embed.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/zenn-markdown-html/src/embed.ts b/packages/zenn-markdown-html/src/embed.ts index 695f63e9..d175ec13 100644 --- a/packages/zenn-markdown-html/src/embed.ts +++ b/packages/zenn-markdown-html/src/embed.ts @@ -1,10 +1,6 @@ import type { MarkdownOptions } from './types'; import { escapeHtml } from 'markdown-it/lib/common/utils'; -import { - extractYoutubeVideoParameters, - isDocswellUrl, -} from './utils/url-matcher'; import { sanitizeEmbedToken, generateEmbedServerIframe, @@ -20,6 +16,8 @@ import { isBlueprintUEUrl, isFigmaUrl, isValidHttpUrl, + isDocswellUrl, + extractYoutubeVideoParameters, } from './utils/url-matcher'; /* 埋め込み要素の種別 */ From 454eb98b23dba4079d3e981138392a2983ea669a Mon Sep 17 00:00:00 2001 From: cm-dyoshikawa Date: Fri, 13 Sep 2024 12:04:10 +0900 Subject: [PATCH 07/11] =?UTF-8?q?=E9=80=9A=E5=B8=B8=E3=81=AE=E5=85=AC?= =?UTF-8?q?=E9=96=8B=E7=94=A8URL=E3=82=82=E4=BD=BF=E3=81=88=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../articles/305-example-embed-others.md | 2 -- packages/zenn-markdown-html/src/embed.ts | 10 +++++++-- .../src/utils/url-matcher.ts | 22 ++++++++++++++++++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/packages/zenn-cli/articles/305-example-embed-others.md b/packages/zenn-cli/articles/305-example-embed-others.md index 4cb6d130..1d13f5f7 100644 --- a/packages/zenn-cli/articles/305-example-embed-others.md +++ b/packages/zenn-cli/articles/305-example-embed-others.md @@ -60,8 +60,6 @@ published: true @[docswell](https://www.docswell.com/slide/LK7J5V/embed) -### embed用でないdocswell URL - @[docswell](https://www.docswell.com/s/ku-suke/LK7J5V-hello-docswell) ## jsfiddle diff --git a/packages/zenn-markdown-html/src/embed.ts b/packages/zenn-markdown-html/src/embed.ts index d175ec13..4d25b6be 100644 --- a/packages/zenn-markdown-html/src/embed.ts +++ b/packages/zenn-markdown-html/src/embed.ts @@ -18,6 +18,7 @@ import { isValidHttpUrl, isDocswellUrl, extractYoutubeVideoParameters, + extractDocswellEmbedUrl, } from './utils/url-matcher'; /* 埋め込み要素の種別 */ @@ -80,10 +81,15 @@ export const embedGenerators: Readonly = { )}" scrolling="no" allowfullscreen allow="encrypted-media" loading="lazy">`; }, docswell(str) { + const errorMessage = 'DocswellのスライドURLが不正です'; if (!isDocswellUrl(str)) { - return 'Docswellのembed用のURLを指定してください'; + return errorMessage; } - return ``; + const slideUrl = extractDocswellEmbedUrl(str); + if (!slideUrl) { + return errorMessage; + } + return ``; }, jsfiddle(str) { if (!isJsfiddleUrl(str)) { diff --git a/packages/zenn-markdown-html/src/utils/url-matcher.ts b/packages/zenn-markdown-html/src/utils/url-matcher.ts index 217c2556..0414fe2a 100644 --- a/packages/zenn-markdown-html/src/utils/url-matcher.ts +++ b/packages/zenn-markdown-html/src/utils/url-matcher.ts @@ -47,8 +47,15 @@ export function isJsfiddleUrl(url: string): boolean { return /^(http|https):\/\/jsfiddle\.net\/[a-zA-Z0-9_,/-]+$/.test(url); } +const docswellNormalUrlRegex = + /^https:\/\/www\.docswell\.com\/s\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/; +const docswellEmbedUrlRegex = + /^https:\/\/www\.docswell\.com\/slide\/[a-zA-Z0-9_-]+\/embed$/; + export function isDocswellUrl(url: string): boolean { - return /^https:\/\/www\.docswell\.com\/[a-zA-Z0-9_,/-]+\/embed$/.test(url); + return [docswellNormalUrlRegex, docswellEmbedUrlRegex].some((pattern) => + pattern.test(url) + ); } export function isYoutubeUrl(url: string): boolean { @@ -84,6 +91,19 @@ export function extractYoutubeVideoParameters( return { videoId, start }; } +export function extractDocswellEmbedUrl(url: string): string | null { + // Embed用URLの場合、そのまま返す + if (docswellEmbedUrlRegex.test(url)) { + return url; + } + // Embed用URLでない場合 https://www.docswell.com/s/:username/{slideId}-hello-docswell のslideIdを抽出する + const slideId = new URL(url).pathname.split('/').at(3)?.split('-').at(0); + if (!slideId) { + return null; + } + return `https://www.docswell.com/slide/${slideId}/embed`; +} + /** * 参考: https://blueprintue.com/ * 生成されるURLをもとに正規表現を定義した From 65e60e2f07c1b5c40e015d0e89d495e2481ef997 Mon Sep 17 00:00:00 2001 From: cm-dyoshikawa Date: Tue, 17 Sep 2024 17:18:47 +0900 Subject: [PATCH 08/11] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom-syntax/embed/docswell.test.ts | 39 +++++++++++++------ .../__tests__/matchers/isDocswellUrl.test.ts | 19 +++++---- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts b/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts index ffe66190..003e98ca 100644 --- a/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts +++ b/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts @@ -2,19 +2,34 @@ import { describe, test, expect } from 'vitest'; import markdownToHtml from '../../../src/index'; describe('Docswell', () => { - test('should generate docswell html', () => { - const html = markdownToHtml( - '@[docswell](https://www.docswell.com/slide/LK7J5V/embed)' - ); - expect(html).toContain( - '' - ); + describe('Docswellの埋め込み用URLの場合', () => { + test('Docswellのiframeを返すこと', () => { + const html = markdownToHtml( + '@[docswell](https://www.docswell.com/slide/LK7J5V/embed)' + ); + expect(html).toContain( + '' + ); + }); }); - test('should not generate docswell html with invalid url', () => { - const html = markdownToHtml( - '@[docswell](https://www.docswell.com/s/ku-suke/LK7J5V-hello-docswell)' - ); - expect(html).toContain('Docswellのembed用のURLを指定してください'); + describe('DocswellのスライドURLの場合', () => { + test('Docswellのiframeを返すこと', () => { + const html = markdownToHtml( + '@[docswell](https://www.docswell.com/slide/LK7J5V/embed)' + ); + expect(html).toContain( + '' + ); + }); + }); + + describe('DocswellのURLが不正な場合', () => { + test('エラーメッセージを返すこと', () => { + const html = markdownToHtml( + '@[docswell](https://www.docswell.com/invalid)' + ); + expect(html).toContain('DocswellのスライドURLが不正です'); + }); }); }); diff --git a/packages/zenn-markdown-html/__tests__/matchers/isDocswellUrl.test.ts b/packages/zenn-markdown-html/__tests__/matchers/isDocswellUrl.test.ts index 158c8887..22ec1f35 100644 --- a/packages/zenn-markdown-html/__tests__/matchers/isDocswellUrl.test.ts +++ b/packages/zenn-markdown-html/__tests__/matchers/isDocswellUrl.test.ts @@ -2,19 +2,24 @@ import { isDocswellUrl } from '../../src/utils/url-matcher'; import { describe, test, expect } from 'vitest'; describe('isDocswellUrlのテスト', () => { - describe('Docswellの埋め込み用URLのとき', () => { + describe('Docswellの埋め込み用URLの場合', () => { test('trueを返すこと', () => { const docswellEmbedUrl = 'https://www.docswell.com/slide/LK7J5V/embed'; expect(isDocswellUrl(docswellEmbedUrl)).toBe(true); }); }); - describe('Docswellの他の画面のURLのとき', () => { + describe('DocswellのスライドURLの場合', () => { + test('trueを返すこと', () => { + const docswellSlideUrl = + 'https://www.docswell.com/s/ku-suke/LK7J5V-hello-docswell'; + expect(isDocswellUrl(docswellSlideUrl)).toBe(true); + }); + }); + + describe('Docswellの他の画面のURLの場合', () => { test('falseを返すこと', () => { - const docswellUrls = [ - 'https://www.docswell.com/', - 'https://www.docswell.com/s/ku-suke/LK7J5V-hello-docswell', - ]; + const docswellUrls = ['https://www.docswell.com/']; docswellUrls.forEach((url) => { expect(isDocswellUrl(url)).toBe(false); @@ -22,7 +27,7 @@ describe('isDocswellUrlのテスト', () => { }); }); - describe('他のサイトのURLのとき', () => { + describe('他のサイトのURLの場合', () => { test('falseを返すこと', () => { const otherSiteUrls = ['https://zenn.dev/', 'https://github.com/']; From 7461dacda15ae25464a0ace976baede58d524abf Mon Sep 17 00:00:00 2001 From: cm-dyoshikawa Date: Tue, 17 Sep 2024 17:26:03 +0900 Subject: [PATCH 09/11] =?UTF-8?q?=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF?= =?UTF-8?q?=E3=82=BF=E3=83=AA=E3=83=B3=E3=82=B0=20new=20URL=E3=82=92?= =?UTF-8?q?=E4=BD=BF=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/zenn-markdown-html/src/utils/url-matcher.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/zenn-markdown-html/src/utils/url-matcher.ts b/packages/zenn-markdown-html/src/utils/url-matcher.ts index 0414fe2a..b2be34ec 100644 --- a/packages/zenn-markdown-html/src/utils/url-matcher.ts +++ b/packages/zenn-markdown-html/src/utils/url-matcher.ts @@ -101,7 +101,10 @@ export function extractDocswellEmbedUrl(url: string): string | null { if (!slideId) { return null; } - return `https://www.docswell.com/slide/${slideId}/embed`; + return new URL( + `/slide/${slideId}/embed`, + 'https://www.docswell.com' + ).toString(); } /** From 32a4876c30cfda52baa8a8c94710fa9c6319c440 Mon Sep 17 00:00:00 2001 From: cm-dyoshikawa Date: Wed, 18 Sep 2024 09:45:54 +0900 Subject: [PATCH 10/11] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E7=94=A8?= =?UTF-8?q?=E3=81=AEURL=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__tests__/custom-syntax/embed/docswell.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts b/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts index 003e98ca..fe47bd6c 100644 --- a/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts +++ b/packages/zenn-markdown-html/__tests__/custom-syntax/embed/docswell.test.ts @@ -16,7 +16,7 @@ describe('Docswell', () => { describe('DocswellのスライドURLの場合', () => { test('Docswellのiframeを返すこと', () => { const html = markdownToHtml( - '@[docswell](https://www.docswell.com/slide/LK7J5V/embed)' + '@[docswell](https://www.docswell.com/s/ku-suke/LK7J5V-hello-docswell)' ); expect(html).toContain( '' From 89e17a1cba55486a666a1a2d2e9a16769227f8c6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 18 Sep 2024 00:53:46 +0000 Subject: [PATCH 11/11] v0.1.156-alpha.0 --- lerna.json | 2 +- packages/zenn-cli/package.json | 2 +- packages/zenn-content-css/package.json | 2 +- packages/zenn-embed-elements/package.json | 2 +- packages/zenn-markdown-html/package.json | 2 +- packages/zenn-model/package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lerna.json b/lerna.json index e81c43d9..4237e103 100644 --- a/lerna.json +++ b/lerna.json @@ -2,6 +2,6 @@ "packages": [ "packages/*" ], - "version": "0.1.155", + "version": "0.1.156-alpha.0", "npmClient": "pnpm" } diff --git a/packages/zenn-cli/package.json b/packages/zenn-cli/package.json index d9475b72..d8f887d2 100644 --- a/packages/zenn-cli/package.json +++ b/packages/zenn-cli/package.json @@ -1,6 +1,6 @@ { "name": "zenn-cli", - "version": "0.1.155", + "version": "0.1.156-alpha.0", "description": "Preview Zenn content locally.", "repository": { "type": "git", diff --git a/packages/zenn-content-css/package.json b/packages/zenn-content-css/package.json index d4b7d4a5..918259cd 100644 --- a/packages/zenn-content-css/package.json +++ b/packages/zenn-content-css/package.json @@ -1,6 +1,6 @@ { "name": "zenn-content-css", - "version": "0.1.155", + "version": "0.1.156-alpha.0", "license": "MIT", "description": "Zenn flavor content style.", "repository": { diff --git a/packages/zenn-embed-elements/package.json b/packages/zenn-embed-elements/package.json index 44413157..158598e2 100644 --- a/packages/zenn-embed-elements/package.json +++ b/packages/zenn-embed-elements/package.json @@ -1,6 +1,6 @@ { "name": "zenn-embed-elements", - "version": "0.1.155", + "version": "0.1.156-alpha.0", "license": "MIT", "description": "Web components for embedded contents.", "repository": { diff --git a/packages/zenn-markdown-html/package.json b/packages/zenn-markdown-html/package.json index f83dd117..d251c864 100644 --- a/packages/zenn-markdown-html/package.json +++ b/packages/zenn-markdown-html/package.json @@ -1,6 +1,6 @@ { "name": "zenn-markdown-html", - "version": "0.1.155", + "version": "0.1.156-alpha.0", "license": "MIT", "description": "Convert markdown to zenn flavor html.", "main": "lib/index.js", diff --git a/packages/zenn-model/package.json b/packages/zenn-model/package.json index 4d8cda39..b2640e9f 100644 --- a/packages/zenn-model/package.json +++ b/packages/zenn-model/package.json @@ -1,6 +1,6 @@ { "name": "zenn-model", - "version": "0.1.155", + "version": "0.1.156-alpha.0", "license": "MIT", "description": "Model utils for Zenn contents", "main": "lib/index.js",