Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure all code snippets use language tags #654

Open
loopiezlol opened this issue Mar 20, 2018 · 7 comments
Open

Make sure all code snippets use language tags #654

loopiezlol opened this issue Mar 20, 2018 · 7 comments
Labels

Comments

@loopiezlol
Copy link
Member

loopiezlol commented Mar 20, 2018

This also applies to code snippets in footnotes, revisionQuestion, practiceQuestion, not only content.

All code snippets should have language tags:

``` -> not cool
```javascript -> cool

At the moment I've applied a hack that will put these by default to bash if they lack one. However, we need to fix these,

@loopiezlol loopiezlol added the bug label Mar 20, 2018
@mardapol
Copy link

mardapol commented Apr 2, 2018

I've started to insert tags for some of the code snippets and I stumbled on a few, that look like this:

'''java
$ jconsole
It's inside the Java section, but it's not a Java snippet. Is it still supposed to say java, due to the category it's in or is it supposed to say shell, bash or something like that?

Also: Most of the exercises do not have tags, are they supposed to have them as well?

(If there is a documentation on this, that I missed, I'm happy to have a look there. :) )

@noahbrenner
Copy link
Contributor

noahbrenner commented May 1, 2018

I have a followup question for you, @loopiezlol, for some (relatively frequent) edge cases:

How should code blocks be tagged that aren't in any programming language? Some examples are:

  • Example output printed to the console (e.g. "Hello, world!")
  • Simple diagrams using text (there are many of these in the Comp. Sci. section)

Another class of special cases would be things like the revision question in the Python insight Indentation and Commenting. This asks the user to identify the correct commenting syntax, but syntax highlighting would give the answer away rather than relying on the user's understanding of the syntax. For this specific code block, I would want to intentionally omit a language tag.

Would text be a good "language" to specify for these types of cases to show that the choice was intentional, as opposed to not specifying a language at all?

@noahbrenner
Copy link
Contributor

@lizTheDeveloper, any thoughts on the questions that Marvin and I asked here?

@nem035
Copy link
Member

nem035 commented Jun 17, 2018

@noahbrenner, @MarvinPollock these are good points. I would tend to agree that we would actually need generic code block elements that aren't syntax highlighted (and you both gave good examples).

I think we might need to stay with our fork of remark-stringify @loopiezlol and update the code visitor to stringify with backticks

@noahbrenner
Copy link
Contributor

@nem035 it is also true that there are a ton of code blocks that should have language tags but don't currently.

Would it make any sense to define a specific language tag that means "no highlighting"? That could make the source files easier to lint, since any block without an explicit language tag would clearly be incorrect. There wouldn't be a question every time as to whether a language tag was just forgotten or if it was intentionally omitted.

Since there are a number of existing code blocks marked with text as the language, that could be a good choice (if you go that route), since there are a decent number of existing code blocks that already align with that usage.

@nem035
Copy link
Member

nem035 commented Jun 17, 2018

@noahbrenner true, using a designated tag like text for this would also work. That also might be the simplest solution. I like it. Let's see what @loopiezlol and @lizTheDeveloper think about it.

@noahbrenner
Copy link
Contributor

Any updates on this topic? It would be great to know the official preferred way of handling these types of code blocks.

@enkidevs enkidevs deleted a comment Nov 17, 2021
@enkidevs enkidevs deleted a comment Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants