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

Markups symbols not working in lib #259

Closed
vlccek opened this issue Sep 12, 2022 · 7 comments
Closed

Markups symbols not working in lib #259

vlccek opened this issue Sep 12, 2022 · 7 comments

Comments

@vlccek
Copy link

vlccek commented Sep 12, 2022

Hi, I'm using discount as a library. I have issues with markdown content in markups (bolt text, italics text). Generation is not working for this content. I am not using any flag. Can you help what i'am doing wrong?

This is the function what i'am using:

char *MKIOT::genHtml(int flags) {
  mkd_compile(mmiot, &flags);
  char *text;
  mkd_document(mmiot, &text);
  return text;
}

**bold text** -> **bold text**

@Orc
Copy link
Owner

Orc commented Sep 12, 2022

Which version are you using, and does other markup work with it?

@vlccek
Copy link
Author

vlccek commented Sep 12, 2022

This repo, the latest version from the main branch. I just find out that links do not work too. Heading works as expected. Cmake.

@Orc
Copy link
Owner

Orc commented Sep 12, 2022

The format of flags has changed in version 3 (I'm working on the documentation rn) and mkd_flag_t is no longer a scalar, but a pointer to a flags blob. It's possible that this is the bug.

Are you doing anything with the headers for c++? I'm going to build a little testcase for this, and want to try and duplicate your code to do it.

@vlccek
Copy link
Author

vlccek commented Sep 12, 2022

Yes i use a basic c++ wrapper, (part of that is your c++ from documentation here)
mkdio++.h:

#ifndef _MKDIO_CXX
#define _MKDIO_CXX

#include <iostream>
#include <string>

extern "C" {
#include <stdio.h>
#include "discount/mkdio.h"
}

class MKIOT {
 protected:
  void *mmiot;
  MKIOT() { mmiot = 0; } /* dummy initializer */

 public:
  MKIOT(const char *text, int size, int flags) { mmiot = mkd_string(text, size, &flags); }
  ~MKIOT() { mkd_cleanup(mmiot); }

  /**
   * Generates html to c string (char*)
   * @param flags
   * @return pointer to char array
   */
  char *genHtml(int flags = 0);

/**
 * Generates html to dynamic std::string, automaticly compile
 * @param flags
 * @return html content
 */
  std::string genHtmldynStr(int flags = 0);

};


#endif/*_MKDIO_CXX*/

mkdio++.cc

//
// Created by jvlk on 10.9.22.
//
#include "mkdio++.h"

char *MKIOT::genHtml(int flags) {
  mkd_compile(mmiot, &flags);
  char *text;
  mkd_document(mmiot, &text);
  return text;
}

std::string MKIOT::genHtmldynStr(int flags) {
  return std::string(genHtml(flags));
}

@Orc
Copy link
Owner

Orc commented Sep 12, 2022

Oh for pete's sake I forgot to update it. Goddamn. It doesn't explain why it's not working for you, but I need to update the class to be compatible with the v3 published interface.

@vlccek
Copy link
Author

vlccek commented Sep 12, 2022

Does v3 discount have flag for disabling bold text,links etc? Or this should be case? I've try to use older version and with that i have no issues. So my only explanation is that i make same mistake with flags. Or did yiu have some others idea?

@Orc
Copy link
Owner

Orc commented Feb 7, 2024

Ugh. I dropped my reply to this on the floor; I don't think I've ever had an option to disable text formatting; are you thinking of the MKD_SAFELINK option that checks for well-known protocols?

@Orc Orc closed this as completed Feb 7, 2024
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

2 participants