Welcome to Codidact Meta!
Codidact Meta is the meta-discussion site for the Codidact community network and the Codidact software. Whether you have bug reports or feature requests, support questions or rule discussions that touch the whole network – this is the site for you.
Comments on Syntax highlighting comments break the unsupported tags warning message
Post
Syntax highlighting comments break the unsupported tags warning message
When an HTML tag is used in a post but is not supported by Codidact, a warning message is displayed listing the unsupported tags. However, syntax highlighting hints in the form of HTML comments such as <!-- language-all:lang-python -->
are listed as <undefined>
in the warning message:
This makes it difficult for people to guess which part of their draft is the cause of the problem.
Should we exclude HTML comments from the list?
HTML comments (whether related to syntax highlighting or not) are not expected to be visible in the final post. Should anything that starts in <!--
and ends in -->
be excluded from the list shown in the warning message?
Do language hints affect syntax highlighting?
As far as I can tell, these HTML comment syntax highlighting hints such as <!-- language-all:lang-python -->
have no effect on Codidact.
On Codidact, the language to use for syntax highlighting can instead be defined by surrounding a code block in triple backticks and putting the language name immediately after the opening backticks, like this:
```python
def a():
print("hi")
return 1, 2
```
This is then rendered as coloured text on communities that support syntax highlighting such as Code Golf and Software Development. If testing this by editing, note that syntax highlighting is not currently activated here on Codidact Meta.
Should we also support HTML comment hints?
If anyone wants Codidact to support these HTML comment hints for syntax highlighting, I recommend raising a separate feature request here on Codidact Meta.
Should we link to guidance on using backticks?
Users accustomed to Stack Exchange may expect HTML comment hints to work for syntax highlighting. Should we have a separate warning message that appears when HTML comments are present and links to a guide to using backticks for syntax highlighting, so that people are not surprised that their HTML comment approach is not working?
This might be particularly useful because Codidact will guess the intended language when no language is specified using backticks, resulting in the appearance that HTML comments sometimes work (even though in reality this is just coincidence when Codidact guesses the same language).
1 comment thread