Skip to content

コードブロックの言語指定ガイドラインを追加しました#1056

Merged
suin merged 1 commit into
masterfrom
755-code-block-language-guideline
Jan 9, 2026
Merged

コードブロックの言語指定ガイドラインを追加しました#1056
suin merged 1 commit into
masterfrom
755-code-block-language-guideline

Conversation

@suin

@suin suin commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

概要

コードブロックの言語指定について、執筆者向けガイドラインをdocs/writing/markdown.mdに追加しました。

変更内容

  • コードブロックは常にts twoslashを使用することを明記
  • TypeScriptでコンパイルエラーになるJSコードには// @noErrorsを使用
  • @noErrorsでも回避できない場合に限りjsを使用(最終手段)

背景

#733 の対応中に、JSコードのコードブロックをjsとするかtsとするかが話題になりました。twoslashを使うとビルド時にTypeScriptコンパイラによるエラーチェックが行われ、サンプルコードの品質を保てるため、基本的にts twoslashを使う方針としました。

Close #755


Note

Adds authoring guidelines for code block language selection in docs/writing/markdown.md.

  • Introduces コードブロックの言語指定 section mandating ts twoslash for all code samples (including JS) to enable TS compile-time checks
  • Documents using // @noErrors for JS-valid but TS-erroring snippets, and allowing js only as a last resort when errors can't be avoided
  • Provides concise examples and a tip summary table outlining the decision flow

Written by Cursor Bugbot for commit 1ba9ef1. This will update automatically on new commits. Configure here.

## 概要

コードブロックの言語指定について、執筆者向けガイドラインを`docs/writing/markdown.md`に追加しました。

## 変更内容

- コードブロックは常に`ts twoslash`を使用することを明記
- TypeScriptでコンパイルエラーになるJSコードには`// @noErrors`を使用
- `@noErrors`でも回避できない場合に限り`js`を使用(最終手段)

## 背景

#733 の対応中に、JSコードのコードブロックを`js`とするか`ts`とするかが話題になりました。twoslashを使うとビルド時にTypeScriptコンパイラによるエラーチェックが行われ、サンプルコードの品質を保てるため、基本的に`ts twoslash`を使う方針としました。

Close #755
@vercel

vercel Bot commented Jan 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
book Ready Ready Preview, Comment Jan 9, 2026 11:01am

@suin suin merged commit d7b955d into master Jan 9, 2026
7 checks passed
@suin suin deleted the 755-code-block-language-guideline branch January 9, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JavaScriptのコードブロックをjsとするかtsとするか?について執筆者向けドキュメントを書く

1 participant