Blogger에서 글쓰기 효율을 높이는 Markdown 사용법
- 공유 링크 만들기
- X
- 이메일
- 기타 앱
- 테마 > HTML 수정
- Head 에 다음정보를 넣습니다.
<head> ... <!-- 외부 스크립트 로드 --> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/default.min.css" rel="stylesheet"/> </head>
- Body 내에 아래 코드넣습니다.
<body> ... <!-- Markdown 변환 및 하이라이팅 스크립트 --> <script> document.addEventListener("DOMContentLoaded", function () { var converter = new showdown.Converter({ tables: true, strikethrough: true, openLinksInNewWindow: true });// 각 'pre.markdown' 요소를 Markdown 변환 document.querySelectorAll("pre.markdown").forEach(function (block) { var rawMarkdown = block.innerText; var htmlContent = converter.makeHtml(rawMarkdown);
// 변환된 HTML을 삽입하고 원래 pre 요소 숨기기 var div = document.createElement("div"); div.className = "markdown-content"; div.innerHTML = htmlContent; block.parentNode.insertBefore(div, block); block.style.display = "none"; });
// 하이라이트 적용 document.querySelectorAll("pre code").forEach(function (block) { hljs.highlightElement(block); }); }); </script>
<!-- 추가 CSS: 링크 스타일 명확히 정의 --> <style>
/* 테이블 스타일 */ .markdown-content table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.markdown-content th, .markdown-content td { border: 1px solid #ddd; /* 테두리 색 */ padding: 8px; text-align: left; }
.markdown-content th { background-color: #f2f2f2; /* 헤더 배경색 */ font-weight: bold; }
.markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4, .markdown-content h5, .markdown-content h6 { font-weight: bold; margin-top: 20px; } .markdown-content p { line-height: 1.6; color: #c7c7c7; } .markdown-content pre, .markdown-content code { background-color: #333333; padding: 10px; border-radius: 5px; color: #ffffff; overflow-x: auto; } .markdown-content a { color: #1a73e8; /* 링크 클릭 가능 색상 */ text-decoration: underline; cursor: pointer; } img, video { max-width: 100%; height: auto; } </style> </body>
- 글 쓸때는 다음과 같이 진행합니다. - html 모드
- 본문에 아래포맷 필요 - Body에 아래 젛보 넣습니다.
<pre class="markdown"> # 제목 이곳에 Markdown 형식으로 작성된 콘텐츠가 들어갑니다. 여기 링크 확인 </pre>
예제 및 동작 (Markdown syntax guide)
```
Headers
# This is a Heading h1
This is a Heading h2
###### This is a Heading h6 ```
Headers
# This is a Heading h1
This is a Heading h2
###### This is a Heading 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_
Lists
```
Unordered
* Item 1 * Item 2 * Item 2a * Item 2b
Ordered
1. Item 1 2. Item 2 3. Item 3 1. Item 3a 2. Item 3b ```
Unordered
* Item 1 * Item 2 * Item 2a * Item 2b
Ordered
1. Item 1 2. Item 2 3. Item 3 1. Item 3a 2. Item 3b
Images
```  ```

Links
``` You may be using Markdown Live Preview. ```
You may be using Markdown Live Preview.
Blockquotes
``` > Markdown is a lightweight markup language with plain-text-formatting syntax, created in 2004 by John Gruber with Aaron Swartz. > >> Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor. ```
> Markdown is a lightweight markup language with plain-text-formatting syntax, created in 2004 by John Gruber with Aaron Swartz. > >> Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor.
Tables
``` | Left columns | Right columns | | ------------- |:-------------:| | left foo | right foo | | left bar | right bar | | left baz | right baz | ```
| Left columns | Right columns | | ------------- |:-------------:| | left foo | right foo | | left bar | right bar | | left baz | right baz |
Blocks of code
```` ``` let message = 'Hello world'; alert(message); ``` ````
``` let message = 'Hello world'; alert(message); ```
Inline code
``` This web site is using `markedjs/marked`. ```
This web site is using `markedjs/marked`.
Related Links
댓글
댓글 쓰기