mirror of
https://github.com/kou029w/nodejs-hands-on.git
synced 2025-02-03 07:38:44 +00:00
Compare commits
2 commits
970c5e27f1
...
c8688c941e
Author | SHA1 | Date | |
---|---|---|---|
c8688c941e | |||
fca7481ef2 |
4 changed files with 34 additions and 4 deletions
|
@ -1,9 +1,10 @@
|
|||
[book]
|
||||
authors = ["Kohei Watanabe"]
|
||||
language = "ja"
|
||||
title = "Node.jsを使う"
|
||||
authors = ["Kohei Watanabe"]
|
||||
|
||||
[output.html]
|
||||
site-url = "/nodejs-hands-on/"
|
||||
git-repository-url = "https://github.com/kou029w/nodejs-hands-on"
|
||||
additional-js = ["external-links.js", "regexp-search.js"]
|
||||
edit-url-template = "https://github.com/kou029w/nodejs-hands-on/edit/main/{path}"
|
||||
git-repository-url = "https://github.com/kou029w/nodejs-hands-on"
|
||||
site-url = "/nodejs-hands-on/"
|
||||
|
|
13
external-links.js
Normal file
13
external-links.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
// 外部リンクを新しいブラウザーコンテキストで開く
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
const selector = ["http:", "https:"]
|
||||
.map((scheme) => `a[href^="${scheme}"]`)
|
||||
.join(",");
|
||||
|
||||
document.querySelectorAll(selector).forEach((a) => {
|
||||
a.target = "_blank";
|
||||
a.rel = "noreferrer";
|
||||
});
|
||||
});
|
16
regexp-search.js
Normal file
16
regexp-search.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
// 正規表現検索を有効化
|
||||
window.elasticlunr.Index.load = (index) => ({
|
||||
search(keyword) {
|
||||
const regexp = new RegExp(keyword, "gi");
|
||||
|
||||
return [...Object.entries(index.documentStore.docs)].flatMap(
|
||||
([ref, doc]) => {
|
||||
const match = `${doc.title} ${doc.body}`.match(regexp);
|
||||
|
||||
return match ? [{ ref, doc, score: match.length }] : [];
|
||||
},
|
||||
);
|
||||
},
|
||||
});
|
|
@ -11,7 +11,7 @@ VSCodeでNode.jsのプログラムのデバッグを行うには、Auto Attach (
|
|||
|
||||
設定から、Debug › JavaScript: Auto Attach Filter (`debug.javascript.autoAttachFilter`) を変更します (1)。
|
||||
|
||||
`smart` を選択すると、VSCodeターミナルからNode.jsのプロセスを実行したとき[`--inspect`](https://nodejs.org/en/docs/guides/debugging-getting-started)スイッチが有効化され、自動的にデバッグを開始することができます (2)。
|
||||
`smart` を選択すると、VSCodeターミナルからNode.jsのプロセスを実行したとき[`--inspect`](https://nodejs.org/en/learn/getting-started/debugging)スイッチが有効化され、自動的にデバッグを開始することができます (2)。
|
||||
|
||||
自動アタッチを行うにはVSCode内のターミナルを使用しなければなりません。
|
||||
また、Auto Attachを有効にした後、ターミナルを一度再起動する必要があります。これは、ターミナルの右上にある ⚠ アイコンをクリックするか、新しいターミナルを作成することで行えます (3)。
|
||||
|
|
Loading…
Add table
Reference in a new issue