The workflow I use to make these articles is a jury-rigged hairball of a hack (did you expect anything else?)
I start by writing in Microsoft Word, because I’m used to it and I have some content in Word format that I want to bring to the site.
Then I convert the DOCX to MarkDown with Pandoc
pandoc -f docx -t gfm --wrap=none --extract-media images\<section>\<article> -o article.md .\article.docx
The advantages of using Pandoc are many:
- Converts Bold, Italic and Bold-italic in the Markdown equivalents
- Converts links in the MarkDown equivalents without escaping reserved MarkDown characters.
- Keeps the document outline levels (Heading 1, Heading 2) as MarkDown heading levels, which builds the article’s Table Of Contents
- Extracts the images to a folder and inlines the link for the correct path; it also includes the
alt text
field’s content I set in Word, but I tend not to use it.
The .MD is opened in Notepad++ to:
- Remove the blank lines that are inserted between each line
- Search and Replace (shortcodes, paths with / and not \, and others)
I create the article in Hugo:
hugo new content\pt\<section>\<article>.md
Then I edit the FrontMatter and copy the text from Notepad++ to the new .MD
The images are copied to <site>/static/images/<section>/<article>/
The local Hugo is started:
hugo server --buildFuture
I make the necessary adjustments in VScode, where I have a workspace for the site.
The English translation is assisted by a VSCode extension, funkyremi.VScode Google Translate, where I put in the preferences that I want to always translate from Portuguese to English.
I copy the file <article>.MD
to the same place under <site>/content/en/
, open it side-by-side with the Portuguese version (preferably on a second monitor, because it’s easy to confuse the two mid-translation), select the text I want to translate while avoiding technical terms, Alt-Shift-T
and that’s it; it’s not perfect and lots of touching up is necessary, but it saves a lot of work.