باختصار
سيرة ذاتية في صفحة واحدة لمصممة كتب، فيها شريط ملوّن على الجانب الأيسر لبيانات الاتصال والمهارات. وتصطف تواريخ كل وظيفة على اليمين.
ما الذي ستنضده
السيرة الذاتية لـ Irene Salcedo، مصممة كتب متخيَّلة في مدريد، على ورقة A4 واحدة. شريط بنفسجي داكن عرضه 66 مم يمتد على الحافة اليسرى من أعلى الورقة إلى أسفلها. وفي رأسه كومة من الكتب المجلدة بالقماش، مرسومة بالشيفرة، تقف على مستوى خط أساس اسمها. تحتها بيانات الاتصال بها، ومهاراتها وأدواتها في شارات مستديرة الأطراف، ولغاتها وتعليمها وتدريسها، وما تفعله خارج العمل. يتصدر اسمها، بحرف Hedvig Letters Serif بحجم 46 pt، عمود نص عرضه 118 مم فيه نبذة من خمسة أسطر وثلاث وظائف وقائمة بالكتب التي صممتها. يضع عنوان كل وظيفة المسمى على اليسار والتواريخ إلى اليمين على خط الأساس نفسه، واسم جهة العمل مائلًا تحته. ويشترك أول عنوان في الشريط الجانبي في خط أساس واحد مع الصفة المهنية تحت الاسم.
تجيب هذه الوصفة عن
- كيف أصمم تخطيط عمود ونصف، فيه عمود نص عريض وعمود جانبي ضيق؟
- كيف أضيف علامة مائية أو لونًا خفيفًا للخلفية أو صورة زخرفية في كل صفحة؟
- كيف أصنع شارات مضمّنة: مفاتيح لوحة المفاتيح، ووسوم، وبنوك كلمات للتمارين؟
الجواب المختصر
const layout = {
layoutType: 'oneAndHalf',
sideColumnPercent: (SIDE / CONTENT) * 100, // 57 of the 185 mm between the margins
sideColumnSide: 'left',
sideColumnRole: 'floats', // no body text: only boxes fenced with span="side"
gutterWidth: mm(GUTTER), // the text column keeps 185 − 57 − 10 = 118 mm
};
// A side box stands where the text has reached at its fence, so the Markdown opens with it,
// before the name, and it starts at the head of the column (gotcha: side-box-starts-at-fence):
// :::callout{type="sidebar" span="side"}
// :::callout{type="section" title="Contact"} … ::: ← the sections nest inside it
// …
// :::space{lines=2.76} ← last: runs the band to the column's foot; a fifth of a line
// ::: more and the whole box moves to page 2
// # Irene Salcedo {role="Book designer and art director"}
const sidebar = { id: 'sidebar', background: col('band'),
// The first title stands on the role's line. The text starts 10 mm from the trim, the
// left margin plus 1 mm, and stops 10 mm short of the band's right edge.
padding: { top: mm(ROLE_Y), right: mm(10), bottom: pt(0), left: mm(1) },
body: { fontFamily: SANS, fontSize: pt(8.4), lineHeight: pt(12.4), color: col('paper'),
boldColor: col('paper'), paragraphSpacing: false } };
المكونات
- الميزات
- عمود هامشي للعناصر العائمةعمود ونصفملاحظات الهامشإطارات متداخلةإطارات التنبيهمسافة عمودية صريحةالشارات داخل السطرالنصوص والخطوط والمربعات في تصاميم الصفحةالصور في تصاميم الصفحةتثبيت عناصر التصميممستويات العناوينسمات العنوانالقوائم النقطية وقوائم التحققأنماط الفقراتلوحة ألوان دلاليةصفحات على اللوحة (Canvas)
- الخطوط
- Hedvig Letters Serif, Hanken Grotesk (SIL OFL 1.1)
- الأصول
- The stack of books at the head of the sidebar, drawn in code in the page's palette (Ignacio Ferro, CC BY 4.0)
طريقة التحضير
#1 · ضع الأقسام داخل صندوق جانبي واحد
// The sections nest in one side box. As separate side boxes they would stand at least a line
// of paper apart (gotcha: side-boxes-line-apart). A nested box ignores span and flows inside
// its parent (gotcha: nested-callout-limits).
const section = (id, lineHeight) => ({ id, backgroundEnabled: false, // the band shows through
padding: { top: pt(0), right: pt(0), bottom: pt(0), left: pt(0) },
marginTop: mm(10),
titleStyle: { ...caps('glow'), gap: mm(2.4) },
body: { ...sidebar.body, lineHeight: pt(lineHeight) } });
const chipStyles = [{ id: 'skill', fontFamily: SANS, fontSize: pt(7.6), bold: true,
background: col('chip'), color: col('paper'), borderWidth: pt(0),
borderRadius: em(1), // past half the chip's height: a pill
paddingX: em(0.6), paddingY: em(0.22), gap: em(0.3) }];
داخل العمود، الشريط هو الإطار الوارد في الجواب المختصر. تأتي كتلته قبل الاسم، فيضعه span="side" في رأس العمود المخصص للعناصر العائمة. والأقسام إطارات متداخلة داخله، بلا تعبئة خاصة بها، فيمتد البنفسجي متصلًا من Contact إلى Outside work. ولو كانت إطارات جانبية منفصلة لوقفت متباعدة بين 4.7 و9.1 مم، حتى مع marginBottom على 0. ارتفاع الشارات نحو 3.9 مم. ويستعمل قسما Skills وTools نمط أقسام خاصًا بهما، chips، تباعد أسطره 16 pt يترك 1.8 مم بين الصفوف؛ أما 12.4 pt في الأقسام الأخرى فكانت ستترك نصف مليمتر (أنماط الشارات).
#2 · لوّن الهوامش حول العمود
// Header elements are painted after the text, over it, so these stay in the margins, where
// no text runs (gotcha: header-paints-over-text). They repeat on every page.
const BAND_W = LEFT + SIDE; // mm from the trim edge to the band's right edge
const SEAM = 0.5; // mm of overlap with the box, so no hairline of paper shows between them
const REACH = 1; // mm the foot box climbs above the column's foot, over the end of the box
const bandBox = (id, x, y, w, h) => ({ kind: 'box', id, style: { backgroundColor: col('band') },
placement: { ...at('page', 'top-left', x, y), size: { width: mm(w), height: mm(h) } } });
const header = { elements: [
bandBox('head', 0, 0, BAND_W, TOP + SEAM), // above the column: the top margin
bandBox('edge', 0, 0, LEFT + SEAM, TRIM_H), // beside it: the left margin, top to bottom
bandBox('foot', 0, TRIM_H - BOTTOM - REACH, BAND_W, BOTTOM + REACH), // below it
// Painted last, over the box's top padding, where no text runs. The bottom of the stack
// sits on the name's baseline.
{ kind: 'image', id: 'books', resourceId: 'books', placement: {
...at('page', 'top-left', LEFT + 1, TOP + BASELINE - BOOKS.h),
size: { width: mm(BOOKS.w), height: mm(BOOKS.h) } } },
] };
يقع العمود الجانبي داخل هوامش الصفحة، فيتوقف إطار الشريط الجانبي قبل الحافة اليسرى بمقدار 9 مم وقبل الحافة العليا بمقدار 18 مم. تملأ ثلاثة صناديق في الترويسة الهامشَ العلوي فوق العمود، والهامشَ الأيسر من أعلى إلى أسفل، والهامشَ السفلي تحت العمود. تُرسم عناصر الترويسة بعد النص وفوقه، ولذلك تُبقيها الوصفة في الهوامش، حيث لا يجري نص. وهي تتكرر أيضًا في كل صفحة، فسيظهر الشريط في الصفحة الثانية أيضًا (الترويسات والتذييلات). يتراكب الصندوقان العلوي والأيسر مع إطار الشريط الجانبي بمقدار 0.5 مم، ويصعد الصندوق السفلي 1 مم فوق أسفل العمود، فوق نهاية إطار الشريط الجانبي، فلا يظهر خيط رفيع من الورق عند الوصلات. أما :::space الذي يُغلق إطار الشريط الجانبي فيُنزله حتى 278.0 مم، أي 0.8 مم فوق أسفل العمود، بمقدار 2.76 سطر في الإنجليزية و1.76 في الإسبانية.
#3 · ضع الاسم في رأس عمود النص
const nameplate = { enabled: true, slot: { elements: [
{ kind: 'text', id: 'name', content: '{titleText}', fontFamily: SERIF,
fontSize: pt(NAME.size), lineHeight: 1, color: col('ink'),
placement: at('container', 'top-left') },
{ kind: 'text', id: 'role', content: '{attr.role}', ...caps('accent'),
placement: at('#name', 'below', 0, NAME.gap) },
] } };
const nameLevel = { level: 1, // span stays 'column': the name heads the text column only
// No break before the name: the sidebar box is already on the page, and a break would
// move the name and the whole text column to page 2.
breakBefore: { enabled: false },
marginBottom: pt(LEAD), // one grid line of air under the role
advancedDesign: nameplate };
يحتفظ H1 بالقيمة الافتراضية span: 'column'. ومع 'page' يصير صفحة افتتاح عبر العمودين؛ وحين يأتي بعد إطار الشريط الجانبي ينتقل إلى الصفحة 2، وهناك يبدأ العمود الجانبي تحت الاسم، على بعد 45.9 مم من الأعلى. وbreakBefore معطّل لأن إطار الشريط الجانبي موجود في الصفحة أصلًا: مع الانتقال ينتقل الاسم وعمود النص كله إلى الصفحة 2. يبدأ marginBottom الخاص بالمستوى، وهو سطر شبكة واحد، النبذةَ عند 45.9 مم بدلًا من 41.3 مم. والحشوة العلوية لإطار الشريط الجانبي هي ROLE_Y، أي ارتفاع الاسم مضافًا إليه الفجوة تحته، فيشترك أول عنوان في الشريط الجانبي والصفة المهنية في خط أساس واحد، على بعد 39.3 مم من الحافة العليا.
#4 · ضع التواريخ على سطر مسمى الوظيفة
const JOB = 9.8; // pt: the job title, the dates and the employer share the size and leading
const jobText = (id, content, look) => ({ kind: 'text', id, content, fontFamily: SANS,
fontSize: pt(JOB), lineHeight: LEAD / JOB, // the body's leading, as a multiple of the size
align: 'left', ...look }); // without align, design text is centred in its box
const job = { enabled: true, slot: { elements: [
jobText('title', '{titleText}', { fontWeight: 700, color: col('ink'), overflow: 'wrap',
placement: { ...at('container', 'top-left'), size: { width: mm(84) } } }), // clear of dates
jobText('dates', '{attr.dates}', { color: col('muted'),
placement: at('container', 'top-right') }), // the title's top and size, so its baseline
jobText('org', '{attr.org}', { italic: true, color: col('muted'),
placement: at('#title', 'below') }),
] } };
const jobLevel = { level: 3, fontSize: pt(JOB), lineHeight: pt(LEAD), marginTop: pt(9),
marginBottom: pt(0), advancedDesign: job };
// The section head takes 20 pt under 19.6 pt of space, three grid lines, so a job head
// starts the same 9 pt under a grid line after a section head as after a list. The 9 pt
// below it merge with a job head's 9 pt above. Under Selected books they push the list to
// the next grid line, as the default 7 pt would; with 0 it would start one line higher.
const sectionLevel = { level: 2, fontSize: pt(14), lineHeight: pt(20),
marginTop: pt(3 * LEAD - 20), marginBottom: pt(9), advancedDesign: sectionHead };
كل وظيفة عنوان H3 في سماته جهة العمل والتواريخ: ### Art director {org="Ediciones del Albardín, Madrid" dates="2021 – present"} (سمات العنوان). يُربط المسمى والتواريخ بأعلى الحاوية نفسها، كلٌّ في زاوية، بالحجم وتباعد الأسطر نفسيهما، فيقعان على خط أساس واحد. يُحصر المسمى في 84 مم ويُضبط على الالتفاف: المسمى الطويل ينكسر إلى سطر ثانٍ قبل أن يبلغ التواريخ، وتنزل جهة العمل تحته. ومع المسافة فوقه، يملأ كل عنوان قسم ثلاثة أسطر شبكة بالضبط، فيقع كل عنوان وظيفة تحت خط من الشبكة بمقدار 9 pt، سواء جاء بعد عنوان قسم أو بعد قائمة.
الوصفة كاملة
// ═══ Postext Cookbook · Nº 057 · One-page CV with a sidebar ═══════════════════════
// https://postext.dev/en/cookbook/cv-with-sidebar
// Code: MIT · Text: original (CC BY 4.0) · Drawing: made in code (CC BY 4.0)
// Fonts: Hedvig Letters Serif, Hanken Grotesk (SIL OFL 1.1) · Needs postext ≥ 1.25.0
import {
buildDocumentWithFonts, renderPageToCanvas, registerResourceImage,
} from 'https://esm.sh/postext';
const LANG = 'en'; // @lang: the language of the sample document ('en' | 'es')
const RECIPE = 'cv-with-sidebar';
// ─── 1 · Design ─────────────────────────────────────────────────────────────
const palette = {
ink: '#231b22', // text: a plum-tinted near-black
band: '#3a2235', // the sidebar
accent: '#8f3b62', // on paper: the role and the section heads (7.1:1)
glow: '#f1b98f', // on the band: the sidebar titles (8.3:1)
chip: '#744d6c', // on the band: the skill chips
rule: '#d9cdd5', // the hairlines after the section heads
muted: '#6c5f69', // dates, employers, the colophon (6.0:1)
paper: '#ffffff', // the page, and the text on the band (14.4:1)
};
// Each colour carries its hex and the palette entry it follows.
const col = (id) => ({ hex: palette[id], model: 'hex', paletteId: id });
const colorPalette = Object.entries({ ...palette, 'main-color': palette.accent })
.map(([id, hex]) => ({ id, name: id, value: { hex, model: 'hex' } }));
const [SERIF, SANS] = ['Hedvig Letters Serif', 'Hanken Grotesk'];
const PT = 25.4 / 72; // mm in a point
const [TRIM_W, TRIM_H] = [210, 297]; // mm: A4, printed on one side, so nothing is mirrored
const [TOP, LEFT, RIGHT] = [18, 9, 16]; // mm
const LEAD = 13.2; // pt: the body leading
const BOTTOM = TRIM_H - TOP - 56 * LEAD * PT; // mm: the text block holds 56 lines
const CONTENT = TRIM_W - LEFT - RIGHT; // 185 mm between the margins
const [SIDE, GUTTER] = [57, 10]; // mm: the sidebar column, and the white after it
const at = (to, edge, x = 0, y = 0) => ({ anchor: { to, edge }, offset: { x: mm(x), y: mm(y) } });
const LABEL = 7.8; // pt: the role and the sidebar titles, tracked capitals
const caps = (colour) => ({ fontFamily: SANS, fontSize: pt(LABEL), fontWeight: 700,
textTransform: 'uppercase', letterSpacing: pt(LABEL * 0.18), color: col(colour) });
const NAME = { size: 46, gap: 2.6 }; // pt and mm: the name, and the room under it
const ROLE_Y = NAME.size * PT + NAME.gap; // mm under the top margin: the role's line
// mm under the top margin: the name's baseline. Hedvig Letters Serif, set solid, puts it 0.795
// of the size down the line (measured on the page); another face needs its own ratio.
const BASELINE = 0.795 * NAME.size * PT;
const BOOKS = { w: 46, h: 18 }; // mm: the drawing at the head of the band
// #region answer: a float-only column on the left, filled by one box
const layout = {
layoutType: 'oneAndHalf',
يعمل ملف script.js المجمّع كما هو: الصقه في سكربت الوحدة (module) لأي صفحة، أو افتح الوصفة على CodePen. مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)
تنويعات
#أعد تلوين الشريط
كل لون مكتوب مرة واحدة، في palette، ومنه تأخذ صناديق الشريط وإطار الشريط الجانبي والشارات والصفة المهنية والعناوين والرسم ألوانها. هذه الأسطر الثلاثة تجعل الشريط واللون المميز والشارات زرقاء مخضرة.
- band: '#3a2235', // the sidebar
+ band: '#1d3b3a', // the sidebar
- accent: '#8f3b62', // on paper: the role and the section heads (7.1:1)
+ accent: '#2b5f5b', // on paper: the role and the section heads (7.3:1)
- chip: '#744d6c', // on the band: the skill chips
+ chip: '#456d69', // on the band: the skill chips#عوّم الأشكال في العمود نفسه
يضع الكتاب المدرسي ذو عمود الهامش الأشكال والتعليقات الجانبية والشروح في عمود مخصص للعناصر العائمة على الحافة الخارجية لكل صفحة.
أخطاء شائعة
خطأ شائع
يبدأ الإطار الجانبي بمحاذاة الكتلة التي تلي سياجه
في postext 1.4.1 يقف الإطار span: 'side' في العمود الجانبي على الارتفاع الذي بلغه النص عند سياجه، على سطر الشبكة التالي، وتحت أي إطار موجود هناك. ضع سياج الحاشية الجانبية قبل الفقرة التي تشرحها مباشرةً: إذا وضعته بعدها، بدأت الحاشية بجانب الفقرة التالية. والإطار الذي يتجاوز أسفل العمود ينزلق صعودًا حتى يستقر أسفله على أسفل العمود، بقدر ما يسمح الإطار الذي فوقه؛ وما لا يتسع بعد ذلك ينتظر العمود الجانبي في الصفحة التالية. ملاحظات الهامش →
خطأ شائع
الإطارات الجانبية المكدّسة في القناة تُبقي بينها سطرًا من الورق
في postext 1.4.1 يترك الإطار span: 'side' سطر متن واحدًا على الأقل تحته قبل الشيء التالي في القناة، مقرَّبًا صعودًا إلى شبكة خطوط الأساس، أيًّا كانت قيمة marginBottom. لذلك لا تتلامس أبدًا الإطارات التي تتشارك خلفية: تبدو مكدّسةً بطاقاتٍ منفصلة. للحصول على لوحة واحدة متصلة، ضع إطارًا جانبيًا واحدًا وأدرج الأقسام داخله. ملاحظات الهامش →
خطأ شائع
يُحذف :::space في أعلى الإطار أو العمود
يُحذف :::space في أعلى العمود، وفي أعلى مجموعة :::columns، وفي أعلى إطار بلا عنوان له محتوى آخر، وفي أعلى تتمة إطار مقطوع. ومنذ postext 1.5 يكون الإطار المكوَّن من :::space فقط بالارتفاع الذي يطلبه الفراغ (إطار إجابة، مكان للكتابة)، والفراغ الواقع مباشرةً تحت عنوان الإطار يُنزل المتن بذلك القدر. لافتتاح إطار بلا عنوان بفراغ، أعطه عنوانًا أو سطرًا أول ثم أضف الفراغ بعده. مسافة عمودية صريحة →
خطأ شائع
عناصر الترويسة والتذييل تُرسَم فوق النص
تُرسَم عناصر الترويسة والتذييل فوق الصفحة، ولا تُفسح منطقة النص لها مكانًا. أبقِها داخل الهوامش، فالهوامش هي التي تحجز مساحتها. الترويسات وأرقام الصفحات →
خطأ شائع
الإطار المتداخل يتجاهل span وplacement وsnapToGrid
الإطار المتداخل في إطار آخر يتجاهل span وplacement وsnapToGrid وfloatBarrier الخاصة به: يجري دائمًا داخل الإطار الأم، بالعرض الداخلي للأم. إطارات متداخلة →
- اضبط
:::spaceعلى الصفحة. في الطبعة الإنجليزية تُنهي 2.76 سطر الإطارَ 0.8 مم فوق أسفل العمود. ومع 2.96 سطر يتجاوز أسفل العمود بمقدار 0.1 مم وينتقل الشريط الجانبي كله إلى الصفحة 2؛ ومع 2.66 ينفتح شريط من الورق بين الإطار والصندوق السفلي. - الصندوق في تصميم الاسم لا يصلح لرسم الشريط. فالعنوان يحجز ارتفاع الصندوق، والصندوق الذي يساوي الشريط طولًا يجعله يحجز أكثر من ارتفاع العمود البالغ 260.8 مم، فينتقل النص إلى الصفحة 2. ومع
reserve: falseلا يحجز الصندوق شيئًا، لكن التصميم الباقي في العمود يُقصّ عند أسفل العمود، فيبقى الهامش السفلي أبيض.
الحقوق
- الوصفة
- Ignacio Ferro
- النص
- نص أصلي, CC BY 4.0
- الصور
- The stack of books at the head of the sidebar, drawn in code in the page's palette · Ignacio Ferro · CC BY 4.0
- الخطوط
- Hedvig Letters Serif (SIL OFL 1.1) · Hanken Grotesk (SIL OFL 1.1)
- الشيفرة
- MIT، مثل Postext
حرّر هذا الشرح ↗ (يفتح في تبويب جديد)مجلد الوصفة على GitHub ↗ (يفتح في تبويب جديد)


