64

github markdown を学んでいましたが、変数とマクロについて質問がありました。

テキストブロックの繰り返し印刷を防ぐ変数またはマクロを定義することは可能ですか?

使用例は、ハイパーリンクの大きなグリッドを生成するテーブルがある場合です。リンクは次のようになります。

http://www.a-big-long-big-big-long-hyperlink/more-long-stuff?id=1234

以下のようなことが一度できればいいのですが:

$link=http://www.a-big-long-big-big-long-hyperlink/more-long-stuff?id

そして、テーブルの各セルで、次のように言うことができます

$link=1234

他のセル

$link=2345

アイデアは次のとおりです。

  • テーブル (最大 10 列と最大 10 行) は、通常の画面で見るのが少し簡単です。現時点では、リンクの接頭辞が非常に長いため、リンクが次の行に折り返されるため、非常に見苦しく見えます。
  • ルート リンクを変更したい場合は、1 か所で変更できます (はい、エディターで検索と置換を実行できることはわかっています!)

乾杯。

4

3 に答える 3

18

以下は、参照リンクを記述するいくつかの方法です。

[I'm an inline-style link](https://www.somewebsite.com)

[I'm an inline-style link with title](https://www.somewebsite.com "somewebsite's Homepage")

[I'm a reference-style link][Arbitrary case-insensitive reference text]

[I'm a relative reference to a repository file](../blob/master/LICENSE)

[You can use numbers for reference-style link definitions][1]

Or leave it empty and use the [link text itself]

Some text to show that the reference links can follow later.

[arbitrary case-insensitive reference text]: https://www.somewebsite.org
[1]: http://somewebsite.org
[link text itself]: http://www.somewebsite.com
于 2015-01-05T17:12:14.757 に答える
4

「参照型リンク」というMarkdownの機能を利用できます。

[link text][id]または[link text]、リンクテキストが一意で、文字、数字、スペース、句読点のみで構成されている場合。大文字と小文字は区別されません。

次に、ドキュメントのどこかで次の内容を定義しますid

[id]: http://example.com/whatever

https://github.com/biserkov/markdown-playground/blob/master/README.mdおよび_

https://raw.githubusercontent.com/biserkov/markdown-playground/master/README.md

于 2014-10-04T20:21:14.307 に答える
-6

GitHub Markdown (.md ファイル用) には、次の変数がありますcapture

{% capture nameOfVariableToCapture %}any markdown here...{% endcapture %}

{{ nameOfVariableToCapture }} -- that prints the content of the variable

またはから{% assign variableName = "text etc." %}

テストとして、 https://github.com/SeLite/SeLite.github.io/blob/master/MarkdownTest.mdを作成しました。その内容は、 http ://selite.github.io/MarkdownTestで確認できます(フレームワークに由来するヘッダーとフッターは無視してください)。

于 2015-05-14T02:19:27.617 に答える