Recommended way to use Padrino helpers in extensions?

I want to use some Padrino helpers (tag, content_tag etc.) in a helper file of my extension to generate some HTML.
What is the proper way to do this? I dug through the Middleman source and found some places where it’s done like this:

if !defined?(::Padrino::Helpers)
  require 'vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/support_lite'
  require 'vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers'
end

[...]

include Padrino::Helpers::TagHelpers

But that doesn’t seem like a future-proof way to do it. If the version of padrino-core or padrino-helpers changes, it will break…

What’s the recommended way to access Padrino (helpers) in extensions?

Padrino Helpers will be going away in v4.0, which probably won’t be for a while, but we’re trying not to rely on them internally.

For “future-proofing”, I’d suggest simply using the templating language to generate tags. Otherwise, the approach above is correct.

Thanks for the clarification!
Could you give a quick example of how to use the templating language, e.g. to create a link?

Something like:

<a href="<%= some_url %>">Some title</a>

Then using ERB

ERB.new(File.read("my_templat_file")).result

Ah, ok. Then you’d have to create a separate template file for every HTML snippet you want to generate, right?
Also, you’d probably have to pass in any variables that should be used in the template via a binding to #result.
I would probably go with simply building the string in the Ruby file and returning it.

I forgot to mention that link_to is a Middleman helper and will continue to work whether we depend on Padrino or not.

I ran into another problem related to Padrino helpers (or rather a user of my gem middleman-bootstrap-navbar did).
I am using html_safe in the helpers of that gem to generate HTML, relying on the method to be available, but that doesn’t always seem to be the case.
If you have a minute: https://github.com/krautcomputing/middleman-bootstrap-navbar/issues/1
Any suggestion on how to avoid this?
(as I mention in the ticket, I’m working on a rewrite that won’t use string concatenation, so this shouldn’t be a problem anymore, but it would be nice to quickly fix this now) Thanks!