-
Notifications
You must be signed in to change notification settings - Fork 27
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
add renderMarkdown to ICompiler #16
Conversation
just the markdown piece, useful for plugins that don't need full `renderBlock`
for syntax highlighting
@adidahiya mind reviewing this as @themadcreator is out today? |
though i suppose it could wait till monday |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't inject map's this
context
src/plugins/kss.ts
Outdated
@@ -57,18 +65,19 @@ export class KssPlugin implements IPlugin<IKssPluginData> { | |||
} | |||
} | |||
|
|||
function convertSection(section: kss.ISection): IKssExample { | |||
function convertSection(this: ICompiler, section: kss.ISection): IKssExample { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using map's this
context in this fashion is pretty hacky. I know it's more performant than using a lambda in the map above, but just one more arg and this doesn't work.
I think i'd prefer to just use an explicit argument and a lambda in the map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it's so damn clever 👩🔬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, and kudos. But simple and clear is better, IMO
src/plugins/kss.ts
Outdated
markup: section.markup() || "", | ||
modifiers: section.modifiers().map(convertModifier), | ||
markupHtml: this.renderMarkdown(`\`\`\`html\n${section.markup() || ""}\n\`\`\``), | ||
modifiers: section.modifiers().map(convertModifier, this), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And again =(
/** | ||
* Render a string of markdown to HTML, using the options from `Documentalist`. | ||
*/ | ||
renderMarkdown: (markdown: string) => string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
3ce09f6
to
de6d198
Compare
use lambda instead of this contextPreview: docs |
KssPlugin markdownifies documentation + markup for syntax highlighting