* Describe the bug
When rendering output in a markdown block that implments the NocoBase i18n methodology of using t()
- that output remains encoded if it’s coming from field contents - whereas it’s typically converted elsewhere. As you can see in the screenshot - data is appearing with the handlebars, rather than being converted.
* Environment
- NocoBase version: v1.6.17
- Database type and version: Postgres 17
- OS: Debian
- Deployment Methods: Docker Swarm
- Docker image version: nocobase/nocobase:latest@sha256:6636f516b4b1e66ee3b89a659c3c28e122c559ba413ce6f496bd5c2e3bbbd9da
- NodeJS version:
* How To Reproduce
Using this in the markdown block to render database values using markdown/html/css:
<a href="/admin/p8dr5c0klhy?site={{$nRecord.area.site.id}}">{{$nRecord.area.site.name}}</a> | <a href="/admin/q0v2ktkop0l?area={{$nRecord.area.id}}">{{$nRecord.area.name}}</a>
{{!-- 1. If no levels, do nothing (or show a simple message) --}}
{{#if (or (eq (length $nRecord.f_structure_levels) 0) (not $nRecord.f_structure_levels))}}
<p>No levels defined.</p>
{{!-- 2. If exactly one level, just show it --}}
{{else if (eq (length $nRecord.f_structure_levels) 1)}}
{{#each $nRecord.f_structure_levels}}
<p>Only one level: <strong>{{name}}</strong> at {{offset_level}}mm</p>
{{/each}}
{{!-- 3. If more than one, do the "ruler" --}}
{{else}}
<h1>{{$nRecord.name}} Levels</h1>
{{!-- A 300px-high line, each level placed at a % of that line --}}
<div style="position: relative; border-left: 2px solid black; width: 500px; height: 500px; margin-bottom: 1em;" id="structureheights">
{{#with (sortBy $nRecord.f_structure_levels "offset_level" 1) as |sorted|}}
{{#if sorted}}
{{#with (get 'offset_level' (first sorted)) as |lowest|}}
{{#with (get 'offset_level' (last sorted)) as |highest|}}
<div style="position: relative; width: 100%; height: 400px; margin-bottom: 2em;">
{{!-- Vertical Ruler Line --}}
<div style="position: absolute; left: 50px; top: 20px; bottom: 20px; width: 2px; background: black;">
{{!-- Highest offset at top --}}
<div style="position: absolute; top: -10px; left: -5px; transform: translateX(-100%);
background: black; color: white; padding: 2px 5px; font-size: 12px;">
{{highest}}mm
</div>
{{!-- Lowest offset at bottom --}}
<div style="position: absolute; bottom: -10px; left: -5px; transform: translateX(-100%);
background: black; color: white; padding: 2px 5px; font-size: 12px;">
{{lowest}}mm
</div>
{{!-- Vertical Structure Name on right side --}}
<div style="position: absolute; right: -10px; top: 50%; transform: translate(100%, -50%) rotate(-90deg);
transform-origin: right center; font-weight: bold; white-space: nowrap;">
{{$nRecord.name}}
</div>
</div>
{{!-- Individual Levels --}}
{{#each sorted as |level|}}
<div id="structure_level_{{level.id}}" style="
position: absolute;
left: 60px;
top: calc(20px + {{multiply 360 (divide (minus highest level.offset_level) (minus highest lowest))}}px);
transform: translateY(-50%);
white-space: nowrap;
">
{{!-- Colored line behind label --}}
{{#if level.type.color}}
<div style="
position: absolute; left: 0; top: 50%; transform: translateY(-50%);
height: 8px; width: 120px; background: {{level.type.color}};
opacity: 0.6; z-index: -1;">
</div>
{{/if}}
<strong>{{level.name}}</strong> ({{level.offset_level}}mm) [{{level.type.name}}]
</div>
{{/each}}
</div>
{{/with}}
{{/with}}
{{else}}
<p>No levels defined.</p>
{{/if}}
{{/with}}
</div>
{{/if}}
Expected behavior
Content coming from the database should come to the markdown renderer “pre-rendered”, that is to say, it should already have been converted from potential handlebars (for i18n implementation) into it’s final form.