The box is now the finished text: bold is bold, a heading is a heading, a
list is a list. No preview pane — a second box beside the first is the
wrong shape on a phone — and nothing is sent anywhere while anybody
types, so the round trip the old «Vista previa» button made on every
press is gone.
Markdown is still the only thing stored, which is what keeps the file in
git, the translation pipeline, Decap and the XSS defence exactly as they
were. The two directions are deliberately not symmetrical:
opening — the server renders the stored markdown into a <template>
the editor adopts, so there is no markdown parser in the
browser and no second opinion about what text means;
saving — the browser walks a closed set of elements back into
markdown. Anything else contributes its text and nothing
more, which is why a paste brings no markup in.
Three heading levels (## ### ####), bold, italic, strikethrough, two
kinds of list, quote, link and clear formatting on the four post boxes;
bold, italic, link and clear on the short ones. A «Markdown» button
swaps to the raw text and back — the escape hatch, and the way to write
a table. With JavaScript off the plain textarea is still there and still
the field that submits; verified by driving the form with scripting
disabled.
Headings had no styles anywhere. `.article-single__body` styled `p` and
nothing else, so three levels would have rendered as three identical
bold lines. Both stylesheets now carry the ladder, along with lists,
quotes and rules.
Two renderer findings, both of which richer writing makes worse:
- config.yaml set Goldmark `unsafe: true`, for WordPress content that
no longer exists — no file under content/ holds a tag. A member's
proposal containing `<img src=x onerror=…>` renders as visible
characters in the moderation queue, which is the one screen a
moderator judges it on, and that flag is what would have run it on
the live site. Off now; the built output is byte-identical.
- A line break meant two things: `breaks: True` here, Goldmark's
hardWraps off there. Turning hardWraps on was the obvious fix and
the wrong one — the files are hard-wrapped at 78 characters, so it
would break every sentence in half. Instead there are two renderers,
one per destination, and the editor writes the hard break CommonMark
means (two spaces) so it survives either way.
Tested by running the serializer itself, in node, against the same
static/board.js the browser loads: 26 cases including the ones that go
wrong — a pasted span, a script, an empty box, a line starting with «-»,
a javascript: href — plus a round trip asserting markdown → HTML →
markdown renders identically for ten real documents.
Then by typing in a browser at 390px with touch emulation, which is what
found the one defect no fixture predicted: pressing Enter in a list
wraps it in a <div>, and reading that as a paragraph ran «uno» and «dos»
together into one word.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
68 lines
2.6 KiB
HTML
68 lines
2.6 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Mi perfil{% endblock %}
|
|
|
|
{% block main %}
|
|
<form class="card" method="post" enctype="multipart/form-data"
|
|
action="{{ url_for('profiles.edit') }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<h1>Mi perfil público</h1>
|
|
|
|
{% if not available %}
|
|
{# The routing gives the static site every collision, so this page would
|
|
simply never load. Better said here than discovered by a friend who
|
|
cannot open the link. #}
|
|
<p class="flash flash--error">
|
|
Tu usuario coincide con una dirección que ya usa el sitio, así que tu
|
|
página no se podría abrir. Pide a un administrador que te cambie el
|
|
nombre de usuario.
|
|
</p>
|
|
{% endif %}
|
|
|
|
<label for="bio">Sobre ti</label>
|
|
<textarea id="bio" data-markdown name="bio" rows="8"
|
|
placeholder="Se puede usar Markdown.">{{ g.member.bio or '' }}</textarea>
|
|
{#- The stored markdown, rendered by the server for the editor to adopt.
|
|
There is no markdown parser in the browser: this is how the box can
|
|
show the formatting without a second opinion about what somebody's
|
|
text means. Ignored entirely when scripting is off. -#}
|
|
<template data-rich-html="bio">{{ to_html(g.member.bio or '') }}</template>
|
|
|
|
<label for="links">Enlaces</label>
|
|
<textarea id="links" name="links" rows="5"
|
|
placeholder="Instagram|https://instagram.com/tu-cuenta">{{ links_text }}</textarea>
|
|
<p class="muted small">
|
|
Uno por línea, con el formato <span class="mono">Nombre|dirección</span>.
|
|
Sólo direcciones que empiecen por http:// o https://.
|
|
</p>
|
|
|
|
<label for="photo">Foto</label>
|
|
<input id="photo" name="photo" type="file" accept="image/*">
|
|
{% if g.member.photo_name %}
|
|
<p class="muted small">Ya tienes una. Subir otra la reemplaza.</p>
|
|
{% endif %}
|
|
<p class="muted small">
|
|
Tu foto aparece en <a href="{{ url_for('members.index') }}">Miembros</a>,
|
|
que sólo ven las personas que han entrado. Fuera del sitio sólo se ve si
|
|
publicas tu página, abajo.
|
|
</p>
|
|
|
|
<label class="check">
|
|
<input type="checkbox" name="published" {{ 'checked' if g.member.profile_published }}>
|
|
Publicar mi página
|
|
</label>
|
|
<p class="muted small">
|
|
Mientras esté publicada, cualquiera puede verla en
|
|
<span class="mono">vienalatina.com{{ address }}</span> y los buscadores
|
|
pueden indexarla. Puedes dejar de publicarla cuando quieras: la página y
|
|
la foto desaparecen en el momento.
|
|
</p>
|
|
|
|
<div class="actions">
|
|
<button class="btn" type="submit">Guardar</button>
|
|
{% if g.member.profile_published %}
|
|
<a class="linkish" href="{{ address }}">Ver mi página</a>
|
|
{% endif %}
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|