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

Wrapping transformed output in additional HTML tags #66

Open
jwr opened this issue Sep 15, 2015 · 1 comment
Open

Wrapping transformed output in additional HTML tags #66

jwr opened this issue Sep 15, 2015 · 1 comment
Labels

Comments

@jwr
Copy link
Contributor

jwr commented Sep 15, 2015

Transformers seem to be designed to process markdown, rather than modify the resulting HTML. I wanted to generate custom code for images, specifically

<figure>
<img src alt…>
<figcaption>
  caption goes here
</figcaption>
</figure>

Having looked at the code, there is no easy way to add that, short of rewriting the (fairly complex) img handling functions. Or post-processing the output with enlive.

I was hoping to be able to write a "transformer" that would get the parsed information about an image and return an HTML string. Sort of like supplying a new markdown.transformers/img function.

Any hints/ideas on how to address this use case?

@yogthos
Copy link
Owner

yogthos commented Sep 15, 2015

The transformers work on a combination of the text and a state map and each line is considered independently. The transfomers are chained together and each one sees the text after the transformations of the previous transformers in the chain have been applied. So, you could add a transformer that can look for any text and replace it with other text.

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

No branches or pull requests

2 participants