Open robertmarkbram opened 5 years ago
I am using the following in a bash script as a pre-processing step to achieve this atm.
rm -r temp.md
touch temp.md
echo -e "\n\nTOC\n" >> temp.md
IFS=$'\n';
for line in $(cat README.md | grep -E '^#+ ') ; do
heading=$(echo "${line}" | sed -re 's/[ \t]*$//' -e 's/^#+ (.*)$/\1/')
link=$(echo "${line}" | sed -re 's/[ \t]*$//' -e 's/^#+ (.*)/\1/' -e 's/ /-/g' -e 's/.*/\L&/g')
bullet=$(echo "${line}" | sed -re 's/^(#*)# .*/\1- /' -e 's/#/ /g')
echo "${bullet}[${heading}](#${link})" >> temp.md
done
echo -e "\n" >> temp.md
cat README.md >> temp.md
grip temp.md --export readme.html
Is there a way to generate a table of contents when using
--export
?Love this tool btw.