世間のイケてるエンジニアたちはマークダウンという書式を好んで利用している方も多いようです。
マークダウンとは、例えば見出しは行頭に「#」を付けるだとか、文字の強調は「*強調*」のように「*」で文字を囲むだとか、そうした記号を使った簡単な記述で書くだけでサーバーやクライアントのソフトウェアが良い感じに HTML に直してくれてブラウザで閲覧できるというものです。
代表的なものでは GitHub や Qiita などで利用されていますね。
基本的な書き方とフォーマットの構文 – GitHub ヘルプ
https://help.github.com/ja/github/writing-on-github/basic-writing-and-formatting-syntax
Markdown記法 チートシート – Qiita
https://qiita.com/Qiita/items/c686397e4a0f4f11683d
こうしたマークダウンで記述されたテキストファイルの拡張子は「.md」なのですが、この拡張子のファイルを SharePoint Online や OneDrive for Business に保存するとちょっと便利だったので書いておきます。
.md ファイルを作る
マークダウンのファイルを作るのは簡単です。任意のテキストエディターを開き、次のようなテキストを入力し、.md の拡張子でファイルを保存するだけです。このとき文字コードは UTF-8 にします。
# Markdown(マークダウン)
## Headers
```
# This is H1
## This is H2
### This is H3
#### This is H4
##### This is H5
###### This is H6
```
# This is H1
## This is H2
### This is H3
#### This is H4
##### This is H5
###### This is H6
## Emphasis
```
*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__
_You **can** combine them_
```
*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__
_You **can** combine them_
## Horizontal Rule
```
***
---
___
```
***
---
___
## Lists
### Unordered
```
* Item 1
* Item 2
* Item 2a
* Item 2b
```
* Item 1
* Item 2
* Item 2a
* Item 2b
### Ordered
```
1. Item 1
1. Item 2
1. Item 3
1. Item 3a
1. Item 3b
```
1. Item 1
1. Item 2
1. Item 3
1. Item 3a
1. Item 3b
## Images
```

Format: 
```

## Links
```
[Office 365](https://www.office.com)
```
[Office 365](https://www.office.com)
## Blockquotes
```
> We're living the future so
> the present is our past.
```
> We're living the future so
> the present is our past.
## Inline code
```
I think you should use an `<addr>` element here instead.
```
I think you should use an `<addr>` element here instead.
## Tables
```
First Header | Second Header | Third Header
:------------ | -------------: | :-------------:
Content from cell 1 | Content from cell 2 | Content from cell 3
Content in the first column | Content in the second column | Content in the third column
```
First Header | Second Header | Third Header
:------------ | -------------: | :-------------:
Content from cell 1 | Content from cell 2 | Content from cell 3
Content in the first column | Content in the second column | Content in the third column
## Code
<pre>
```
function office365(arg){
if(arg){
alert('is Great!!')
}
}
```
</pre>
```
function office365(arg){
if(arg){
alert('is Great!!')
}
}
```
このファイルを SharePoint Online のライブラリか OneDrive for Business にアップロードします。
これで準備完了です。
ファイルのプレビュー
ファイルをクリックすると、マークダウンファイルをブラウザでプレビューすることができます。
ざっと眺めてみると、Blockquotes や Inline code の書式がちょっと区別が付きづらかったり、Tables は枠線が表示されないのでちょっと見づらいですね。
とは言え、基本的なところは問題なさそうです。
ファイルの編集
そして、このままブラウザ上でファイルを編集することもできます。左上の [開く] – [テキスト エディターで開く] をクリックします。
すると、次のような編集画面になります。
編集後に「保存」をクリックするか「Ctrl + S キー」を押すことで編集内容を保存できます。
欲を言えば、マークダウンの表示プレビューなどがあるともっと嬉しいですね。
Shift-JIS などの文字コードの場合
ちなみに、文字コードが Shift-JIS になっている場合は、プレビュー画面で文字化けしているのですが、編集画面に切り替えると自動的に文字コードが変換されて文字化けも直ります。
ブラウザ上で自動的に文字コードを直してくれるので、これはちょっと嬉しいです。
さいごに
Office ユーザーにとっては嬉しい人はあまり多くないのかもしれませんが、こうしたテキストファイルであっても SharePoint Online や OneDrive for Business に保存して共有するメリットは少しありそうです。
その他、SharePoint Online や OneDrive for Business では数多くの種類のファイルのプレビューに対応しています。
OneDrive、SharePoint、Teams でのファイルのプレビューがサポートされているファイルの種類
https://support.microsoft.com/ja-jp/office/e054cd0f-8ef2-4ccb-937e-26e37419c5e4
色々なファイルを保存してみると、ちょっと変わった使い方も発見できるかもしれません。





