-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #868 from lean-ja/Seasawher/issue861
Biome で js ファイルのフォーマットなどを行う
- Loading branch information
Showing
6 changed files
with
75 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
"use strict"; | ||
|
||
(function blockPlay() { | ||
Array.from(document.querySelectorAll(".language-lean")).forEach(function (code_block) { | ||
let pre_block = code_block.parentElement; | ||
/** | ||
* lean4 のコードブロック内に、Lean 4 web playground へジャンプするボタンを追加する | ||
*/ | ||
function blockPlay() { | ||
const array = Array.from(document.querySelectorAll(".language-lean")); | ||
for (const code_block of array) { | ||
const pre_block = code_block.parentElement; | ||
|
||
// lean4 web editor へのリンクを生成する | ||
let escaped_code = encodeURIComponent(code_block.textContent); | ||
let url = `https://live.lean-lang.org/#code=${escaped_code}`; | ||
const escaped_code = encodeURIComponent(code_block.textContent); | ||
const url = `https://live.lean-lang.org/#code=${escaped_code}`; | ||
|
||
// ボタンを生成する | ||
let buttons = pre_block.querySelector(".buttons"); | ||
let leanWebButton = document.createElement('button'); | ||
leanWebButton.className = 'fa fa-external-link lean-web-button'; | ||
const buttons = pre_block.querySelector(".buttons"); | ||
const leanWebButton = document.createElement("button"); | ||
leanWebButton.className = "fa fa-external-link lean-web-button"; | ||
leanWebButton.hidden = true; | ||
leanWebButton.title = 'Run on lean4 playground'; | ||
leanWebButton.setAttribute('aria-label', leanWebButton.title); | ||
leanWebButton.title = "Run on lean4 playground"; | ||
leanWebButton.setAttribute("aria-label", leanWebButton.title); | ||
|
||
// ボタンを挿入する | ||
buttons.insertBefore(leanWebButton, buttons.firstChild); | ||
|
||
// ボタンをクリックしたときに、lean4 web editor を開く | ||
leanWebButton.addEventListener('click', function (e) { | ||
leanWebButton.addEventListener("click", (e) => { | ||
open(url); | ||
}); | ||
}); | ||
})(); | ||
} | ||
} | ||
|
||
blockPlay(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"formatter": { | ||
"indentStyle": "space" | ||
} | ||
} |