cogneco / typeup

Markdown inspired markup language.
GNU Affero General Public License v3.0
1 stars 1 forks source link

Code #2

Open simonmika opened 8 years ago

simonmika commented 8 years ago

Support inline and code blocks.

simonmika commented 8 years ago

How should we set which color coding to use?

davidhesselbom commented 8 years ago

In GitHub flavored markdown, code blocks are created using three backticks followed by the language's name. This works well, except backticks are inconvenient to type on my SE keyboard.

simonmika commented 8 years ago

I agree it feels somewhat hacky. I would rather use a sign easier to write.

davidhesselbom commented 8 years ago

In Atlassian products, you wrap code blocks in {code}. I never liked that way of doing it, and it's no better than HTML's <code>.

simonmika commented 8 years ago

I agree. What about using one of these symbols instead of `:

  1. §
  2. @
  3. %
  4. +
  5. '
davidhesselbom commented 8 years ago

Well, %, + and ' are all commonly used in code, so you'd need to escape that symbol a lot, depending on what language you're using. I don't know about @, but it's used here on GitHub for tagging people.

I've never seen § used for anything other than legal documents, where § is often the first character on a line, which could cause problems. Like @, it's also kind of "big" ($code block$). I've also been unable to locate the § symbol on many screenshots of US keyboards (which is odd, and important).

simonmika commented 8 years ago

$ should be used for math like in TeX and LaTeX. Single $ surrounding inline math and $$ a block of math.

I kind of like the idea of doing the same with code but just using a different symbol.

simonmika commented 8 years ago

You are right, § is not available on US keyboards, to bad.

I suggest going for %. As far as I can recall it is mostly used for single line comments. As long as we surround inline code with single % and block code with %% it should very seldom be a problem. And when there is a problem one has to use escape characters.

simonmika commented 8 years ago

For configuring syntax highlighting I suggest two ways:

  1. Set a default the default code language for document using code-language = c. It would then be valid from there on until the next assignment.
  2. For blocks it could also be possible to postfix the opening like this: %% c.
davidhesselbom commented 8 years ago

How will you handle links with percent-encoded characters in them, e.g. https://github.com/cogneco/typeup/search?utf8=%E2%9C%93&q=%25? Will % only start a code block if it is preceded by whitespace?

simonmika commented 8 years ago

For inline code we need to think about it. For code block it's not an issue as they are surrounded by %%.