Introduction to .rst file (reStructuredText):
reStructuredText is a file format for Textual data majorly used by Python based communities to develop documentation in an easy way similar to other tools like Javadoc for Java. Most of the docs of Python-based software and libraries are written using reStructuredText and hence it’s important to learn it when contributing to any organization.
Like Python, RST syntax is also sensitive to Indentation.
Example code of reStructuredText:
Some basic syntax and their HTML rendering are given below.
|verbatim||``Some text or code``||
Some text or code
Save the file with .rst extension.
Python Code :
Following is the Python code to convert .rst files to HTML files.
docutils is a predefined library downloaded while Python is installed.
publish_file method is used to convert rst to html by passing file names as parameters.
After running the python code, a HTML file would be made in the same directory as of rst file. The code of HTML is complicated than normal HTML code written by a person since it’s auto generated. The following image shows HTML rendering of reStructuredText shown above.
- Python program to reverse the content of a file and store it in another file
- Create a GUI to convert CSV file into excel file using Python
- Python - Get file id of windows file
- Convert HTML table into CSV file in python
- Python append to a file
- How to read from a file in Python
- Writing to file in Python
- File Objects in Python
- Open a File in Python
- Python | Kivy .kv File
- File Handling in Python
- File Searching using Python
- Python | StackLayout in Kivy using .kv file
- Python | FloatLayout in Kivy using .kv file
- How to delete data from file in Python
- Python | Create checkbox using .kv file
- Python | AnchorLayout in Kivy using .kv file
- How to open and close a file in Python
- Read JSON file using Python
- Python | PageLayout in Kivy using .kv file
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.