String Utilities 도구 업데이트됨 2일 전

Markdown Normalize Line Breaks

Markdown Normalize Line Breaks converts Windows CRLF and old Mac CR line endings to Unix LF in one click, with an optional Trim trailing spaces setting that removes spaces and tabs from line ends. Counters show input lines, output lines and lines with trailing whitespace. Everything runs in your browser and the clean file downloads as normalized-markdown.md.

항상 무료 사용하기 쉬움 즉각적인 결과 비공개이며 안전합니다

사용법 Markdown Normalize Line Breaks

입력 행
0
출력 행
0
뒤에 붙은 공백 제거됨
0

마크다운 입력

줄 끝 기호가 혼합된 마크다운 붙여넣기
Windows 및CRLF 구형 Mac CR확장자를 Unix 확장자로 변환합니다LF.

정규화된 출력

정제된 LF 마크다운 출력
도구 링크
클립보드에 복사되었습니다.
이 도구를 개선하는 데 도움을 주세요

내용 읽기

이 도구의 작동 방식과 사용 시기를 알아보세요.

One line ending for the whole file

Markdown Normalize Line Breaks converts every line ending in a Markdown document to the Unix style, a single line feed (LF). Files that have passed between Windows, macOS and Linux machines, or that were assembled from copy and paste, often carry a mix of endings: carriage return plus line feed (CRLF) from Windows, a lone carriage return (CR) from very old Mac software, and LF from everything else. The text looks fine on screen, but the mixture causes noisy diffs, confuses some parsers and linters, and can make scripts that split on \n leave stray \r characters behind.

The tool also has one option, Trim trailing spaces, which removes spaces and tabs from the end of every line while it normalises the endings.

The three kinds of line ending

NameCharactersTypical sourceAfter normalising
CRLF\r\nWindows editors, many email clients, some exportsLF
CR\rClassic Mac OS files, some legacy toolsLF
LF\nLinux, macOS, Git with default settingsUnchanged

CRLF pairs are handled first and replaced with a single LF, then any remaining lone CR is replaced with LF. A CRLF never turns into two line breaks.

Runs locally in your browser

The normalisation is done by JavaScript on the page. Nothing is uploaded, there is no server call, and the tool keeps working if your connection drops after the page has loaded. That makes it suitable for internal notes, private drafts or configuration documentation you would rather not send anywhere.

Using the tool

  1. Paste your Markdown into the Input Markdown editor, or use the Paste button in the header or under the editor. If you just want to see what the tool does, click Load sample; it fills the editor with a short document that uses CRLF endings and has trailing spaces and a trailing tab on some lines.
  2. Decide on Trim trailing spaces. The checkbox is ticked by default. Untick it if you only want line endings changed.
  3. Click Normalize (it appears in the header and below the input editor; both do the same thing).
  4. Read the result in Normalized Output.
  5. Click Copy to copy it, or Download to save normalized-markdown.md.
  6. Clear empties both editors.

The three counters

Above the editors you will find Input lines, Output lines and Trailing spaces removed. The line counts treat CRLF, CR and LF all as line breaks, so they normally match: normalising endings does not add or remove lines. The third counter reports how many input lines end in spaces or tabs. It is computed from the input whether or not the checkbox is ticked, so read it as "lines that have trailing whitespace" rather than proof that they were trimmed.

When to tick Trim trailing spaces, and when not to

Trimming is useful in most documentation. Trailing whitespace is invisible, it triggers lint warnings, and it creates pointless changes in pull requests. But there are two cases where you should leave the box unticked:

  • Hard line breaks. Markdown turns two or more spaces at the end of a line into a line break within the paragraph. Addresses, poetry and some tables of contents rely on that. Trimming removes those spaces and the lines will run together when rendered.
  • Whitespace-sensitive code. Trimming applies to every line, including lines inside fenced code blocks. If a code sample must keep trailing spaces (for example a Markdown example that itself demonstrates hard breaks, or test fixtures), untick the option.

With the box unticked, only the line endings change and every other character stays as it was.

Typical situations

  • Git shows every line changed. A teammate saved a README on Windows with an editor that rewrote the endings. Normalise it, commit, and the diff will only show real edits.
  • A static site build warns about stray characters. Some generators and front matter parsers stumble over \r. Converting to LF removes them.
  • Pasting from email or a PDF. Copied text often arrives with CR or CRLF. Normalising first makes later clean-up tools behave predictably.
  • Preparing input for scripts. Command-line tools such as grep, sed or shell loops expect LF. A file with CRLF can make a match fail at the end of every line.

Things not to expect

  • It does not convert to CRLF. The output is always LF. If a Windows-only tool needs CRLF, configure your editor or Git to convert on checkout instead.
  • It does not remove blank lines or collapse them. Use Markdown Remove Empty Lines or Markdown Minifier for that.
  • It does not touch leading indentation, tabs in the middle of a line, or non-breaking spaces.
  • It does not change encoding. Characters stay as they are; only CR and LF are affected, plus spaces and tabs at line ends when trimming is on.

Limitations

  • Trimming is not fence-aware. As noted above, trailing whitespace inside code blocks is removed too when the option is on.
  • Only space and tab count as trailing whitespace. Other invisible characters, such as a non-breaking space or a zero-width space at the end of a line, are not removed.
  • Clipboard permission. The Paste buttons need your browser's permission to read the clipboard. If it is denied, paste with your keyboard instead.
  • Large files are limited only by your browser's memory and editor performance; no size cap is set in the code.

A quick check after normalising

Many editors show the current line ending in the status bar (often labelled CRLF or LF). Open the downloaded file and confirm it shows LF. In Git, running git diff after replacing the file should show only the lines where you trimmed whitespace, or nothing at all if the endings were the only difference and your Git settings ignore them.

Stopping mixed endings from coming back

Normalising a file fixes it once. If several people edit the same repository, the mix can return with the next commit from a differently configured machine. Two habits keep things stable. In Git, a .gitattributes file with a line such as *.md text eol=lf tells Git to store Markdown with LF endings regardless of the editor's behaviour. In your editor, set the default line ending for new files to LF; most code editors expose this as a single setting and show the current value in the status bar. With both in place, this tool becomes something you reach for when text arrives from outside the project, such as a pasted email or an exported document, rather than a routine chore.

Frequently Asked Questions

자주 묻는 질문

사용자가 결과를 신뢰하기 전에 자주 묻는 질문에 대한 간결한 답변.

Windows CRLF and old Mac CR endings are both converted to Unix LF. Lines that already end in LF are left as they are.

No. The conversion runs in JavaScript in your browser and no request is sent to a server.

It removes spaces and tabs at the end of every line. It is ticked by default; untick it to change line endings only.

Yes. Trimming applies to every line, including lines inside fenced code blocks. Untick the option if your code samples must keep trailing whitespace.

Your document used two trailing spaces to force a line break, and trimming removed them. Run the tool again with Trim trailing spaces unticked, or use a backslash at the end of those lines.

No. The output always uses LF line endings.

Normalising does not add or remove lines; it only changes the characters that end them. Matching counts mean nothing was lost.

The Download button saves normalized-markdown.md.

댓글 (0)

사용자 토론, 예외적인 사례 및 추가 팁을 위한 공간입니다.
댓글 남기기
댓글을 제출하면 공개적으로 표시됩니다.
아직 댓글이 없습니다. 가장 먼저 댓글을 남겨보세요!
저희에게 알려주세요!
이 도구와 관련된 문제를 신고하기

발생한 문제를 자세히 설명해 주시면, 저희가 이를 조사하고 도구를 개선할 수 있습니다.

가장 도움이 되는 것은 무엇인가
입력 내용, 예상 결과, 실제 결과, 브라우저/기기 정보를 기재해 주시고, 도움이 될 경우 스크린샷도 첨부해 주세요.
스크린샷 버튼은 브라우저에 표시된 페이지를 캡처하여 생성된 이미지를 이 양식에 첨부합니다.
전체 화면 스크린샷
newisty를 통해 브라우저에서 캡처되었습니다.
아직 스크린샷을 찍지 않았습니다.
도구 보고서