Try   HackMD

在筆記中嵌入另一篇筆記

嵌入筆記的好處

  1. 「模組化」您的筆記,並重複使用共用的內容。
  2. 用嵌入的方式,將單篇筆記分成多篇筆記,以繞過單篇筆記十萬字元的上限。

舉例來說,您在寫一系列的部落格貼文,而您想要在每篇貼文裡面都放入下面這個提示區塊:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
提示:歡迎留言提問!

嵌入筆記功能讓您可以節省在每篇貼文裡都重複寫入同樣的文字的時間。而且,如果您稍後想要更改這個提示的內容,也可以不用進入每篇貼文裡面改寫。

 

操作步驟

  1. 開一篇新筆記,將想要重複使用的區塊放入,並取得該篇筆記的 ID(即該篇筆記的網址)。
    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →
  2. 在您想要嵌入筆記的地方,輸入嵌入 iframe 的語法:{} 選擇嵌入 hackmd 筆記,並輸入剛才取得的筆記 ID。
    Image Not Showing Possible Reasons
    • The image was uploaded to a note which you don't have access to
    • The note which the image was originally uploaded to has been deleted
    Learn More →

示範:

您可以點擊右上角的鉛筆

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →
進入 【編輯模式】,來檢視下面的範例是如何實現的喔!

 

嵌入筆記主題

更酷的是,你可以在 HackMD 自訂筆記的樣式,改變筆記呈現的樣貌、套用喜歡的主題。

知道如何嵌入筆記之後,我們可以更靈活地運用這個功能:

運用 HTML 的 <style>...</style> 元素,來設定頁面元素的樣式。

改變筆記呈現方式

HackMD 的筆記支援部分的 HTML 和 CSS,可用來自訂筆記的樣式。寫在 <style> 標籤裡是最直接的方法。

可以參考:

嵌入文字直書主題

{%hackmd hackmd-vertical-writing-theme %}

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

嵌入其他顏色主題

{%hackmd @debbylin/theme-matcha %}

主題: https://hackmd.io/@debbylin/theme-matcha-book

{%hackmd @debbylin/theme-matcha-book %}

我們可以把常套用的主題存在一篇筆記裡,再用嵌入筆記功能引用到另一篇筆記裡,這樣就可以套用主題顏色了。

請試試看,把底下這段文字複製到你的筆記裡:

{%hackmd @themes/dracula %}

這段文字的意思是告訴 HackMD:「請到 @themes
這個空間,找到永久連結(permalink)網址最末段為 dracula 的筆記,將其內容引用到目前的筆記。