docs
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
19
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
[**中文教學**](/c/tutorials-tw/%2Fs%2Flink-with-github-tw) {%hackmd rJ_1SdPkxx %} # How to Sync a Note You can link a HackMD note with a Markdown file on GitHub to keep all your documentation in sync. ## 【New :fire: 】Copy Version Link Now you can directly copy the saved version of a record. There is a copy link button on the top right, click it to copy the version link and share it with others. As long as the other person has read access, they can view it. ![image](https://hackmd.io/_uploads/SyQEYCOyxg.png) :::success Learn more about reading and editing permission in [Tutorial - Note permission](https://hackmd.io/@docs/note-permission-en) ::: ## Build connection with GitHub repo You can sync your note from the editor of an empty note, or from the <i class="fa fa-history fa-fw"></i> **Versions and GitHub Sync** panel. Then, choose the version you want to Push or Pull. ![image](https://hackmd.io/_uploads/HJD7xahJeg.png) ![open GitHub sync modal](https://hackmd.io/_uploads/HJLQMpn1lg.gif) :::success :sparkles: The free plan can be used 20 times per month, [upgrade to the HackMD Prime plan](https://hackmd.io/@docs/Personal-Prime-subscription-management-en) for unlimited pushes and pulls. ::: ## Authorize HackMD on GitHub On your first time linking HackMD with GitHub, you will be asked to authorize HackMD GitHub App to access your GitHub account AND the repos you want HackMD to link to. There are two levels of authorization needed: the account and the repositories. :::info :warning: HackMD cannot verify users through GitHub APP due to its limitations. So please connect to GitHub with the account that has Admin permission to the repo. For a team's notes, *team admin*, *team member* and *invitee admin* permissions will do. ::: ### 1. Account Level Authorization HackMD GitHub App needs your authorization to see the repos you have access to, including your personal repos and those of Organizations you belong to. ### 2. Repo Level Authorization (Installation) Once you authorize the HackMD GitHub App to see which repos you have access to, GitHub would let you choose which repos you would authorize, or "install", the app on. Install on as many repos as you like, or come back later to authorize more repos. >[!Note] Hint >Install HackMD GitHub App [on GitHub](https://github.com/apps/hackmd-hub) ## Link a Note for the First Time On your first time pushing a note to or pulling a file from GitHub, you will choose which repo, branch, and file you want to link with the current HackMD note. You can also create a new target branch or file to push the note to by simply typing the name of the branch or file to create them. ![Pusg to GitHub](https://hackmd.io/_uploads/SJuS_Thkel.gif) >[!Warning] >You will most likely be asked to switch your line break rendering rules in this step. [Learn more about line break rendering rules](#Line-Break-Rendering-Rules). > >![image](https://hackmd.io/_uploads/SkTvXa3kle.png =400x) >[!Note]ℹ️ >You can sync and edit .md/.mdx/.rmd/.markdown files in HackMD. However, HackMD does not support rendering of MDX and R syntax. ## Keep your note sync with GitHub After you link the note, the target repo and file will show on the <i class="fa fa-history fa-fw"></i> **Versions and GitHub Sync** panel. You can always push further changes to, pull from, or unlink the note from GitHub in the <i class="fa fa-history fa-fw"></i> **Versions and GitHub Sync** panel. ![image](https://hackmd.io/_uploads/B1p7Y63Jee.png) ### Add GitHub badge After linking the note, you can add a badge to the top of the note by clicking the <i class="fa fa-link fa-18"></i> **Add badge** button in the <i class="fa fa-history fa-fw"></i> **Versions and GitHub Sync** panel. When pushed to GitHub, the badge shows your community where to participate the discussion or contribute to the documentation. ![image](https://hackmd.io/_uploads/HkcIFa3klg.png) ### Push to GitHub You can choose which named versions to push to GitHub before the push. Each named version would be pushed as a "commit" in Git, while the version name and description will be used as its commit message. [Learn How to Save a Version](/s/how-to-save). ![CHoose the version want to sync GitHub](https://hackmd.io/_uploads/rJiHo621el.gif) :::info :bulb: **Hint:** HackMD doesn't track which versions had been pushed, for this information would be misleading should someone else messes with the branch from GitHub, which HackMD could not know. ::: ### Pull from GitHub You can also pull from GitHub and choose the branch you want to pull from. Moreover, you can choose which chunk of revisions to merge into your note, or apply all changes. ![Pull from GitHub](https://hackmd.io/_uploads/r1K1Rpnklg.gif) :::info :bulb: **Hint:** HackMD will automatically save a version before you merge and name it `before pull from <branch_name>`. Because HackMD doesn't lock the note when applying changes, it is possible that someone else edit your note while you're merging, therefore, "undoing" the merge has to be done in the editor. ::: --- ## Install the App on More Repos If you cannot find the repo you want to link to, cancel the synchronization first. ![image](https://hackmd.io/_uploads/B1gv9Tnklg.png) Then, you can re-authorize the app on more repos. ![image](https://hackmd.io/_uploads/rJOy5Thygg.png =350x) :::info :bulb: **Hint:** Remember to refresh the repo list after you authorize new repos. ::: ## Revoke Authorization and Un-installation If you ever want to revoke the account level authorization, this is where you would find the option: [Click here](https://github.com/settings/apps/authorizations) If you ever want to un-install the app for your personal repos, find it here: [Click here](https://github.com/settings/installations) For un-installing your organization repos, find it here, you obviously need adequate permissions: [Click here](https://github.com/organizations/your_organization_name/settings/installations) :::warning :warning: **Note:** Note that your account authorization and repo installation are separated. You could have revoked the account authorization (and the app could no longer see what repos you have access to), yet keep the app installed on your repos (and you can still push to and pull from the repo). ::: --- ## Line Break Rendering Rules HackMD follows the [CommonMark Spec](https://spec.commonmark.org/0.29/) (the Spec) to render Markdown syntax so your notes would be compatible with other platforms. Yet there's one thing HackMD handles slightly differently: line breaks. ### What are line breaks? #### Hard line breaks When you hit the <kbd>Enter</kbd> (or <kbd>Return</kbd>) key on your keyboard, you type a "newline" character. Since you most likely expect to start a new line, *HackMD* lets you continue on a new line (by rendering that "newline" character with a HTML break tag `<br />`). This rendering behavior is called [**hard line break**](https://spec.commonmark.org/0.29/#hard-line-breaks) in the Spec. ![Hard line break](https://hackmd.io/_uploads/Sk6wxR31xg.gif) #### Soft line breaks There's another way to render the "newline" character: the [**soft line break**](https://spec.commonmark.org/0.29/#soft-line-breaks) (or just line break). The newline character will be rendered as a <kbd>Space</kbd> in the HTML, instead of a new line. This is how **GitHub** and some other services handle line breaks. ![Soft line break](https://hackmd.io/_uploads/Bk4we03kle.gif) Under this way, when you want to start on a new line (hard line break), you could: **1. Type two or more spaces at the end of the line, before the newline character:** > foo <kbd>Space</kbd> <kbd>Space</kbd> <kbd>Enter</kbd> > bar **2. Type a backslash at the end of the line, before the newline character:** > foo <kbd>\ </kbd> <kbd>Enter</kbd> > bar :::info :bulb: **Hint** - Line breaks take effect only within the containing paragraph. If you want to start a new paragraph, just hit <kbd>Enter</kbd> (or <kbd>Return</kbd>) twice. - Technically HackMD is compliant with the Spec, according to the Spec: [【A renderer may also provide an option to render soft line breaks as hard line breaks.】](https://spec.commonmark.org/0.29/#soft-line-breaks) ::: ### Should I care? Since HackMD and GitHub renders line breaks differently, Your notes would look differently on the two platforms if the line break rendering rules are different. But if a note won't ever be pushed to GitHub, you don't have to worry about this. ### How do I change my line break rendering rule? 1. You can change your default line break rendering for all your future notes in your [<i class="fa fa-gear fa-fw"></i> **settings**](https://hackmd.io/settings#note). 2. You can click the <kbd>Breaks</kbd> button at the bottom of the editor to choose your line break rendering rule. ![Change Line break rules](https://hackmd.io/_uploads/HyijiT3kel.gif)

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully