callstack / callstack/react-native-paper

docs: single-source-of-truth code examples extracted from the Example app

オープン
#4,891 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
feature request
主要言語
TypeScript
スター
14.5k
フォーク
2.2k
平均マージ
5日 23時間
マージ済み PR(30日)
12

説明

**Is your feature request related to a problem? Please describe.**
Code examples shown in the docs are manually maintained as raw JavaScript string literals in docs/src/data/extendedExamples/ (e.g. BottomNavigationBar.js). These are completely disconnected from the real, runnable code in example/src/Examples/. When the Example app is updated, the docs silently drift and there's no mechanism to catch the discrepancy.

**Describe the solution you'd like**
Introduce named region markers in the Example app source files using the standard VS Code folding convention:
```
// #region docs:bottom-nav-static

// #endregion docs:bottom-nav-static
```
At docs build time (inside the existing component-docs-plugin or docusaurus.config.js), a small extraction utility reads those markers and replaces the hand-written string literals in extendedExamples. The rendered output and the component remain unchanged, only the data source changes.

For guide pages (.mdx under docs/docs/guides/), an optional remark plugin could allow inline references:

```
tsx snippet="bottom-nav-static" file="../../example/src/Examples/BottomNavigationExample.tsx"
```

**Additional context**
The repo already has a custom Docusaurus plugin (docs/component-docs-plugin/index.js) that runs at build time and has access to the filesystem, making it the natural place to wire in snippet extraction with minimal new infrastructure.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

docs/component-docs-plugin/index.js と docusaurus.config.js から始め、docs/src/data/extendedExamples/ にある手書きの例を example/src/Examples/ 配下のソースファイルと比較します。提案されているリージョンマーカーを中心に抽出フローを定義し、レンダリングされた出力と コンポーネントが変更されないことを確認します。オプションの MDX remark references は別スコープです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react-native, typescript
領域
documentation, tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。