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

Message formatting #19

Closed
subliun opened this issue Nov 13, 2015 · 21 comments
Closed

Message formatting #19

subliun opened this issue Nov 13, 2015 · 21 comments

Comments

@subliun
Copy link
Contributor

subliun commented Nov 13, 2015

Tox-Archive/Tox-STS#74

Together we can rewrite the STS.

@optimumtact
Copy link
Contributor

👍 to a light markdown support

mainly because it will degrade reasonably gracefully when not implemented.

@tux3
Copy link

tux3 commented Dec 4, 2015

👍 to this, if it's standardized across all clients I'd be much happier to implement it.

@nurupo
Copy link
Member

nurupo commented Dec 5, 2015

@tux3 you are willing to pull webkit as qtox dependency for this? : ) Otherwise how are you going to implement it, I'm curious.

@tux3
Copy link

tux3 commented Dec 5, 2015

@nurupo Technically I think Qt already embeds some Webkit version, but I don't need webkit to grep for pairs of symbols. Light markdown is trivial to parse.

@nurupo
Copy link
Member

nurupo commented Dec 5, 2015

Well, then you should standardize what you mean by "light markdown". Do you allow tables, inline images, raw text blocks, code highlights, etc? Looking at the STS issue, some people were proposing to use gh-flavored markdown.

@tux3
Copy link

tux3 commented Dec 5, 2015

I'm probably not going to do tables, that seem way overkill for a chat client, but basic things like em/strong/strikethrough and maybe raw text are definitely easy to do.

If we want to standardize something, I think it would be a good idea to start small and then maybe think about extending it.
If you require all the clients to support markdown tables and code highlighting, it's obviously not going to work. But if Tox adopts some light markdown formatting, I think it'll be a really cool feature for users.

@stal888
Copy link
Collaborator

stal888 commented Dec 5, 2015

I think bold, italic, and underlines are a good feature set to start with.

@tux3
Copy link

tux3 commented Dec 5, 2015

Underline is nice, but it isn't officially in markdown. What symbol would you use for it?

@GrayHatter
Copy link

_underline_ 
~strikeout~
/italics/
*bold*

@rugk
Copy link

rugk commented Dec 29, 2015

👍 for lightweight markdown

BTW the Ricin client already implements it: RicinApp/Ricin#30

@GrayHatter
Copy link

I suggest we adapt https://help.github.com/articles/markdown-basics/ as our markdown of choice. Per wikipedia, there's no standard, so because we all use github, a lot of the usage/testing will be programmers. Github's flavor is least likely to aggravate us.

@rugk
Copy link

rugk commented Dec 29, 2015

There is no standard, but the basic things were invented by John Gruber (according to Wikipedia) and he documented it here: https://daringfireball.net/projects/markdown/

So anyone can take this as a reference. Of course you can add additional things like GitHub does with GitHub Flavored Markdown, but (except of strikethrough and autolinking of URLs) this is not a thing for a lightweight markdown.
https://help.github.com/articles/markdown-basics/ also shows the basic markdown like it was done by John Gruber.

@TheNain38
Copy link

👍

@GrayHatter
Copy link

@rugk I thought about that, but again per wikipedia, he's no longer maintaining it, so he no longer gets a vote.

@rugk
Copy link

rugk commented Dec 31, 2015

He set the standard and this standard was adopted (and extended) by many organisations, so it does not matter whether he "maintains" it.

BTW where in the Wikipedia article is it stated that he does not maintain it? (Okay the last release of the software was in 2004, but it does not matter as we do not need the source code he wrote anyway - the spec is the thing which matters.)

@SkyzohKey
Copy link

My approach to implement a lite-version of Markdown (which I called LiteMD) was this one (using simple regex):

// Vala code from RicinApp/Ricin by SkyzohKey
public static string render_litemd (string text) {
  var bold = /\B\*\*([^\*\*]*)\*\*\B/.replace (text, -1, 0, "<b>\\1</b>");
  var italic = /\b_([^_]*)_\b/.replace(bold, -1, 0, "<i>\\1</i>");
  var underline = /\B-([^-]*)-\B/.replace(italic, -1, 0, "<u>\\1</u>");
  var striked = /\B~([^~]*)~\B/.replace(underline, -1, 0, "<s>\\1</s>");

  var final_text = striked;
  return final_text;
}

Basically I just replace some expressions by their HTML equivalent (ie. **text** became <b>text</b>) then return the value. GTK do the job to render HTML in the UI widget for messages and it's all.

I think we should provide the following Markdown "tags" :

  • **text** or *text*Bold ;
  • //text// or /text/Italic ;
  • __text__ or _text_Underline ;
  • ~~text~~ or ~text~Strike-through ;

+ Code formatting (using GtkSourceView or the equivalent in Qt) :

``language-to-highlight
var hello = "Hello, world!";
console.log(hello);
``

Lists/Tables would be shitty to implement. I think we shouldn't support them.

+ Maybe that Markdown could be used to have a proper quoting format. Something like:

@SkyzohKey (31 Dec 2015, 13:02 GMT+1)
> This is a nice quoting format, I guess.
> Clients would parse the first line to get all the important data. Then display them.
This line isn't a quote so it's not formatted.

@rugk
Copy link

rugk commented Jan 2, 2016

@SkyzohKey

IMO this is not really such a good implementation as it is not standard markdown. E.g. usually *text results in italic text and not bold one.
Also for code formatting I would use three ``` like it is done in GitHub Flavored Markdown.

Quoting with > is a good idea as it is also standard markdown - except that you need an empty line after a quote to finish it:

> This is a nice quoting format, I guess.
> Clients would parse the first line to get all the important data. Then display them.

This line isn't a quote so it's not formatted.

@DanTheBritish
Copy link

👍 For @SkyzohKey and @GrayHatter standard

@GrayHatter
Copy link

I think he means either. As is, just implement markdown of any kind
On Jan 3, 2016 10:28, "rugk" notifications@github.com wrote:

@lapfox https://github.com/LapFox commented on 3. Jan. 2016, 16:27 MEZ
#19 (comment)
:

image: 👍 For @SkyzohKey https://github.com/SkyzohKey and @GrayHatter
https://github.com/GrayHatter standard

What? As I said the standards @SkyzohKey https://github.com/SkyzohKey
and @GrayHatter https://github.com/GrayHatter suggested are completely
different.


Reply to this email directly or view it on GitHub
#19 (comment)
.

@stal888
Copy link
Collaborator

stal888 commented Jan 3, 2016

We should stay with the GFM or CommonMark specs.

@rugk
Copy link

rugk commented Jan 3, 2016

@stal888 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants