reStructuredText
![]() | |
파일 확장자 | .rst |
---|---|
인터넷 미디어 타입 |
|
개발 | David Goodger |
발표일 | 2001년 6월 1일[1] |
최신 버전 | Revision 8407 (2019년 10월 29일 ) |
웹사이트 | docutils |
reStructuredText(약칭 RST, ReST, reST)는 텍스트 데이터용 파일 형식이다. 주로 파이썬 프로그래밍 언어 커뮤니티에서 기술 문서를 작성하는 데 사용되고 있다.
파이썬 Doc-SIG(Documentation Special Interest Group)의 Docutils 프로젝트의 일부로, 자바의 Javadoc이나 펄의 플레인 올드 도큐멘테이션과 유사한 Python용 도구 세트를 만드는 것을 목표로 한다. Docutils는 파이썬 프로그램에서 주석과 정보를 추출하고 이를 다양한 형태의 프로그램 문서로 포맷할 수 있다.[2]
Docutils와 같은 문서 처리 소프트웨어가 처리할 수 있으며 파이썬 소스 코드를 읽고 쓰는 인간 프로그래머가 쉽게 읽을 수 있도록 설계된 가벼운 마크업 언어이다.
역사
[편집]reStructuredText는 Zope에서 개발한 StructuredText[3] 라는 가벼운 마크업 언어에서 파생되었으며 StructuredText의 여러 가지 문제를 해결하기 위해 개발되었다.[4] reStructuredText라는 이름은 reST가 "개정, 재작업 및 재해석된 StructuredText"임을 나타내기 위해 정해졌다.[5]
reST 구문의 일부는 1990년대 초반의 Setext 언어에서 영감을 받았으며, RFC822 인터넷 메시지 형식 과 Javadoc 형식의 요소도 설계에 포함되는 것으로 고려되었다.[6]
reStructuredText는 2001년 6월에 처음 출시되었으며,[1] 2002년 파이썬 공동체에서 본격적으로 사용되기 시작했다.[7]
참조 구현
[편집]reST 구문 분석기의 참조 구현은 파이썬의 Docutils 텍스트 처리 프레임워크의 일부지만, 다른 구문 분석기들도 존재하고 있다
Docutils 프로젝트는 reStructuredText에 대한 미디어 타입을 등록하지 않았고 공식으로 지정된 미디어 타입도 없지만 파이썬 웹사이트의 빌드 시스템에서 사용되는 MIME 유형 text/x-rst
를 사실상 공식 미디어 타입으로 사용되고 있다.[8] 리눅스 데스크톱 환경에서 사용되는 freedesktop.org 파일 유형 데이터베이스에서도 동일한 미디어 타입이 사용되고 있다.[9] 2003년 또 다른 MIME 유형인 text/prs.fallenstein.rst
가 2003년에 제3자에 의해 reStructuredText를 나타내기 위한 허영 미디어 타입으로 등록되었으며 reStructuredText에 대한 유일한 IANA 등록 미디어 타입으로 남아 있다.[10] 그러나 Docutils 프로젝트에서는 이를 인정하지 않고 있다.[8]
응용 프로그램
[편집]reStructuredText는 주로 파이썬 라이브러리 문서에와 같은 기술 문서에 사용되지만,[11] 다른 문서에도 사용할 수 있다.
2008년부터 reST는 파이썬 Sphinx 문서 생성 시스템의 핵심 구성 요소가 되었다.
Trac, 깃허브와 빗버킷은 reStructuredText을 지원하고 있다[12].
2016년 7월 리눅스 커널 프로젝트는 닥북 기반 문서에서 reStructuredText 및 Sphinx 툴체인으로 전환하기로 결정했다.[13]
소프트웨어 빌드 도구 CMake는 버전 3.0에서 설명서를 reStructuredText로 전환했다.[14]
예시
[편집]rST | HTML 변환 결과 | 브라우저에서 보이는 모습 |
---|---|---|
================
Document Heading
================
Heading
=======
Sub-heading
-----------
Paragraphs are separated
by a blank line.
|
<h1>Document Heading</h1>
<h2>Heading</h2>
<h3>Sub-heading</h3>
<p>Paragraphs are separated
by a blank line.</p>
|
Paragraphs are separated by a blank line. |
Text attributes *emphasis*, **strong emphasis**, ``monospace``.
Horizontal rule:
----
|
<p>Text attributes <em>emphasis</em>,
<strong>strong emphasis</strong>, <code>monospace</code>.</p>
<p>Horizontal rule:</p>
<hr />
|
Text attributes emphasis,
strong emphasis,
|
Bullet list:
* apples
* oranges
* pears
Numbered list:
1. lather
2. rinse
3. repeat
Nested lists:
1. fruits
* apple
* banana
2. vegetables
* carrot
* broccoli
|
<p>Bullet list:</p>
<ul>
<li>apples</li>
<li>oranges</li>
<li>pears</li>
</ul>
<p>Numbered list:</p>
<ol>
<li>lather</li>
<li>rinse</li>
<li>repeat</li>
</ol>
<p>Nested lists:</p>
<ol>
<li>fruits
<ul>
<li>apple</li>
<li>banana</li>
</ul>
</li>
<li>vegetables
<ul>
<li>carrot</li>
<li>broccoli</li>
</ul>
</li>
</ol>
|
Bullet list:
Numbered list:
Nested lists:
|
An `example <http://example.com>`_.
.. image:: Icon-pictures.png
:alt: Image
If text is indented, it is treated as a block quotation:
Should array indices start at 0 or 1?
My suggested compromise of 0.5 was rejected without, I thought, proper consideration.
-- Stan Kelly-Bootle
reST uses :: at the end of the paragraph prior to a pre-formatted code block::
Y = lambda f: (lambda x: f(x(x)))(lambda x: f(x(x)))
| Multi-line text can
| span in tables
| with a pipe character.
|
<p>An <a href="http://example.com">example</a>.</p>
<p><img alt="Image"src="Icon-pictures.png" /></p>
<p>If text is indented, it is treated as a block quotation, and the final attribution line is handled automatically:</p>
<blockquote>
Should array indices start at 0 or 1?
My suggested compromise of 0.5 was rejected without, I thought, proper consideration.
-- Stan Kelly-Bootle</blockquote>
<p>reST uses :: at the end of the paragraph prior to a pre-formatted code block:</p>
<pre class="literal-block">
Y = lambda f: (lambda x: f(x(x)))(lambda x: f(x(x)))
</pre>
<p>Multi-line text can<br/>span in tables<br/>with a pipe character.</p>
|
An example.
If text is indented, it is treated as a block quotation, and the final attribution line is handled automatically:
reST uses :: at the end of the paragraph prior to a pre-formatted code block: Y = lambda f: (lambda x: f(x(x)))(lambda x: f(x(x))) Multi-line text canspan in tableswith a pipe character. |
각주
[편집]- ↑ 가 나 “Project: reStructuredText - File List”. 《SourceForge》. 2001년 10월 19일에 원본 문서에서 보존된 문서. 2023년 2월 5일에 확인함.
- ↑ Mertz, David (2003년 2월 1일). “XML Matters: reStructuredText”. IBM developerWorks. 2016년 10월 5일에 확인함.
- ↑ “zope.structuredtext Documentation”. 《Read the Docs》. 2022년 8월 16일에 확인함.
- ↑ Goodger, David (2016년 5월 24일). “Problems With StructuredText”. Docutils Project. 2022년 8월 16일에 확인함.
- ↑ Goodger, David (2016년 2월 26일). “Docutils FAQ (Frequently Asked Questions)”. Docutils Project. 2016년 10월 5일에 확인함.
- ↑ Goodger, David (2022년 4월 2일). “A Record of reStructuredText Syntax Alternatives”. 《docutils.sourceforge.io》. Docutils Project. 2022년 8월 16일에 확인함.
- ↑ “Introduction to reStructuredText”. Write The Docs. 2022년 6월 25일에 확인함.
- ↑ 가 나 “What's the official MIME type for reStructuredText data? in Docutils FAQ.”. Docutils Project. 2017년 12월 20일에 확인함.
- ↑ “freedesktop.org.xml.in”. 《shared-mime-info》. freedesktop.org.
- ↑ Fallenstein, Benja (2003년 10월 2일). “text/prs.fallenstein.rst”.
- ↑ Goodger, David (2002년 4월 2일). “PEP 287 -- reStructuredText Docstring Format”. Python Software Foundation. 2016년 10월 5일에 확인함.
- ↑ “reStructuredText Support in Trac”. Trac. 2016년 9월 13일. 2016년 10월 5일에 확인함.
- ↑ “Kernel documentation with Sphinx, part 1: how we got here”. LWN.net. 2016년 7월 6일. 2016년 10월 27일에 확인함.
- ↑ “CMake 3.0.0 Release Notes”. Kitware, Inc. 2014년 6월 10일. 2016년 10월 5일에 확인함.