Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3.4/drivers/js-reference-database-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Performs a server-side transaction and returns its return value.

A string evaluating to a JavaScript function to be executed on the server.

{% hint 'warning ' %}
{% hint 'warning' %}
This function will be executed on the server inside ArangoDB and can not use
the arangojs driver or any variables other than those passed as _params_.
For accessing the database from within ArangoDB, see the documentation for the
Expand Down
2 changes: 1 addition & 1 deletion 3.5/drivers/js-reference-database-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Performs a server-side transaction and returns its return value.

A string evaluating to a JavaScript function to be executed on the server.

{% hint 'warning ' %}
{% hint 'warning' %}
This function will be executed on the server inside ArangoDB and can not use
the arangojs driver or any variables other than those passed as _params_.
For accessing the database from within ArangoDB, see the documentation for the
Expand Down
18 changes: 11 additions & 7 deletions _plugins/HintBlock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ def render(context)
site = context.registers[:site]
converter = site.find_converter_instance(::Jekyll::Converters::Markdown)

content = converter.convert(super)
# Remove indention based on first actual line (but only spaces)
content = super.sub(/^[\r\n]+/, '')
indent = content.index(/[^ ]/) || 0
content = content.lines.map{ |line| line[[indent, line.index(/[^ ]/) || 0].min..] }.join ''
# Parse Markdown and strip trailing whitespace (especially line breaks).
# Otherwise below <div>s will be wrapped in <p> for some reason!
content = converter.convert(content).sub(/\s+$/, '')

case @type
when "tip"
Expand All @@ -25,12 +31,10 @@ def render(context)
className = "info"
end

return "<div class=\"alert alert-#{className}\" style=\"display: flex\">
<i class=\"fa fa-#{icon}\" style=\"margin-right: 10px; margin-top: 4px;\"></i>
<div>
#{content}
</div>
</div>"
return "<div class=\"alert alert-#{className}\" style=\"display: flex\">" +
"<i class=\"fa fa-#{icon}\" style=\"margin-right: 10px; margin-top: 4px;\"></i>" +
"<div>#{content}</div>" +
"</div>"
end
end
Liquid::Template.register_tag('hint', HintTag)
Expand Down