This document details how to convert Markdown documents to Textile documents for Redmine.
-
Convert from markdown to textile using Pandoc:
pandoc --from markdown --to textile --no-highlight FILENAME.md > FILENAME.textile -
(Optional) If you find the HTML codes that pop up in lieu of certain punctuations or special characters ugly, you can run a python script to unescape HTML character codes:
python .\unescape_html_char_codes.pyAnd then when prompted, enter exact filename of your textile file. Note that the existing textile file will be overwritten!
Save this snippet as unescape_html_char_codes.py if you want to use it for step 2 above.
import html
# Read in a file and unescape all HTML character codes.
def unescape_html_codes(filename):
with open(filename, 'r', encoding='utf-16') as file:
content = file.read()
unescaped_content = html.unescape(content)
with open(filename, 'w', encoding='utf-8') as output_file:
output_file.write(unescaped_content)
if __name__ == "__main__":
input_filename = input("Enter the filename: ")
unescape_html_codes(input_filename)
print("HTML character codes have been unescaped. Output saved to " + input_filename + "'.")- This does not work well with tables nested in bullet points or otherwise indented.
- Redmine does not like the output for a code block, even though it is technically valid Textile.