Currently no "extras" are turned on in the markdown2 conversion of docs such as POLYGLOG_CONFIG.md , fenced-code-blocks are now considered standard part of markdown, so this confuses developers that it is not done correctly in PG3. This also makes is harder to make good docs. (btw: I am using fenced-code-blocks in this GitHub issue)
I have added code to my plugins to pre-process my docs with this on using the included markdown2 library, but a better solution would be to include in the udi-interface so everyone gets the advantage.
Two solutions:
specific solution, just turn it on in the getMarkDownData function
def getMarkDownData(self, fileName):
data = ''
if os.path.isfile(fileName):
data = markdown2.markdown_path(fileName, extras=[fenced-code-blocks, cuddled-lists])
general solution, where you let the user add any extra they want. Below is one non-breaking version of the setCustomParamsDoc & getMarkDownData functions which could work
def setCustomParamsDoc(self, html=None, mdextras=None):
""" Set the configuration help document. """
data = ''
if html == None:
html = self.getMarkDownData(
Interface.CUSTOM_CONFIG_DOCS_FILE_NAME, mdextras)
LOGGER.debug('Sending {} to Polyglot.'.format('customparamsdoc'))
message = {'set': [{'key': 'customparamsdoc', 'value': html}]}
self.send(message, 'custom')
def getMarkDownData(self, fileName, mdextras=None):
data = ''
if os.path.isfile(fileName):
data = markdown2.markdown_path(fileName, extras=mdextras)
return data
Currently no "extras" are turned on in the markdown2 conversion of docs such as POLYGLOG_CONFIG.md , fenced-code-blocks are now considered standard part of markdown, so this confuses developers that it is not done correctly in PG3. This also makes is harder to make good docs. (btw: I am using fenced-code-blocks in this GitHub issue)
see https://github.com/trentm/python-markdown2/wiki/Extras
I have added code to my plugins to pre-process my docs with this on using the included markdown2 library, but a better solution would be to include in the udi-interface so everyone gets the advantage.
Two solutions:
specific solution, just turn it on in the getMarkDownData function
general solution, where you let the user add any extra they want. Below is one non-breaking version of the setCustomParamsDoc & getMarkDownData functions which could work