tuskyapp / Tusky

An Android client for the microblogging server Mastodon
https://tusky.app
GNU General Public License v3.0
2.49k stars 389 forks source link

[Feature Request] Add markdown support #1840

Open 4k1k0 opened 4 years ago

4k1k0 commented 4 years ago

Hello. It would be nice to have Markdown support like pleroma web app does.

Here are two examples:

WhatsApp Image 2020-06-19 at 1 51 22 PM It would be cool if you can add a Markdown option for your post.

Screenshot_20200619_135945 Here I'm using the web app

WhatsApp Image 2020-06-19 at 1 53 40 PM And this is how the toots looks like. The one from 5s ago is the one I wrote from Tusky without Markdown support and the one from 1m ago was written from the web app with Markdown support enabled.

Thank you :heart:


a1batross commented 4 years ago

I've done it in my fork: https://git.mentality.rip/FWGS/Husky

I'm probably not gonna send a PR to upstream, the fork is Pleroma oriented where is upstream is more about Mastodon.

Tak commented 4 years ago

I think this should be handled on the server side - for example, glitch-soc supports markdown, and as long as you set it as the default post "encoding" in the web app, then markdown posts made using Tusky are marked up correctly

e.g. https://glitch.taks.garden/@Tak/104371129414052634

4k1k0 commented 4 years ago

Thank you very much @a1batross I will check it out asap.

Also, thanks for the information @Tak

:heart:

juin-en-anglais commented 4 years ago

Hi, since some Pleroma users won’t use Husky due to his maintener, and a good amount of glitch-soc users use Tusky. Please, could you consider this feature-request to enhance our Tusky’s experience ? It would be great to have the main functions we love on our servers in our client.

Thanks for considerating ♥

Aldarone commented 3 years ago

I think this should be handled on the server side - for example, glitch-soc supports markdown, and as long as you set it as the default post "encoding" in the web app, then markdown posts made using Tusky are marked up correctly

That works for Mastodon and its forks but not for Pleroma.

Tusky would need to detect that the account is on a Pleroma instance :

A Pleroma instance can be identified by " (compatible; Pleroma )" present in version field in response from /api/v1/instance

Differences in Mastodon API responses from vanilla Mastodon

And then add a button to toggle the content-type between text/plain and text/markdown

Or add an options somewhere to enable « forks features » and « pleroma features »

Aldarone commented 3 years ago

Soapbox uses feature flags based on backend detection maybe Tusky could do something like this ? :

export const getFeatures = createSelector([
  instance => parseVersion(instance.get('version')),
  instance => instance.getIn(['pleroma', 'metadata', 'features'], ImmutableList()),
  instance => instance.getIn(['pleroma', 'metadata', 'federation'], ImmutableMap()),
], (v, features, federation) => {
  return {
    suggestions: v.software === 'Mastodon' && gte(v.compatVersion, '2.4.3'),
    trends: v.software === 'Mastodon' && gte(v.compatVersion, '3.0.0'),
    emojiReacts: v.software === 'Pleroma' && gte(v.version, '2.0.0'),
    emojiReactsRGI: v.software === 'Pleroma' && gte(v.version, '2.2.49'),
    attachmentLimit: v.software === 'Pleroma' ? Infinity : 4,
    focalPoint: v.software === 'Mastodon' && gte(v.compatVersion, '2.3.0'),
    importMutes: v.software === 'Pleroma' && gte(v.version, '2.2.0'),
    emailList: features.includes('email_list'),
    chats: v.software === 'Pleroma' && gte(v.version, '2.1.0'),
    scopes: v.software === 'Pleroma' ? 'read write follow push admin' : 'read write follow push',
    federating: federation.get('enabled', true), // Assume true unless explicitly false
    richText: v.software === 'Pleroma',
    securityAPI: v.software === 'Pleroma',
    settingsStore: v.software === 'Pleroma',
    accountAliasesAPI: v.software === 'Pleroma',
  };
});

export const parseVersion = version => {
  const regex = /^([\w\.]*)(?: \(compatible; ([\w]*) (.*)\))?$/;
  const match = regex.exec(version);
  return {
    software: match[2] || 'Mastodon',
    version: match[3] || match[1],
    compatVersion: match[1],
  };
};
nikclayton commented 1 year ago

Note to self: When testing Markdown rendering, https://mastodon.social/@mia@front-end.social/109633923902216245 is a good status to use.

Tak commented 1 year ago

…this post is not marked up, because mastodon.social doesn't support markdown (nor other markup methods)

CoelacanthusHex commented 1 year ago

Mastodon has supported it but not released. https://github.com/mastodon/mastodon/commit/3a6451c867595fd58998ee1706589b15a69d993b

marek22k commented 1 year ago

Is there any news about this feature request in the meantime?