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

fix(generators): allow html inside html-raw and tokens #9

Open
moki opened this issue Oct 27, 2023 · 0 comments
Open

fix(generators): allow html inside html-raw and tokens #9

moki opened this issue Oct 27, 2023 · 0 comments

Comments

@moki
Copy link
Member

moki commented Oct 27, 2023

src/generators

we want to parse and render html syntax inside html raw and tokens generators.

pass allowHTML: true to the transform function inside generators.

html generator:

function generateHTML(input: string) {
try {
return transform(input).result.html;
} catch (e) {
console.error(e);
return '';
}
}

tokens generator:

function generateTokens(input: string) {
const {parse} = transformMarkdown({});
try {
const tokens = parse(input);
return tokens?.length ? JSON.stringify(tokens, null, 4) : '';
} catch (e) {
console.error(e);
return '';
}
}

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

No branches or pull requests

1 participant