FFenceLilt
AI coding workspace

Restricted backtick block extraction

FenceLilt provides a Windows project workspace for discussing restricted fenced-text extraction with AI. Compare a compatible model’s suggested parser with the exact marker rules and keep extracted text separate from execution.

● ● ●FenceLilt●
A concrete starting point · Restricted backtick block extraction ×
import re

def fenced_blocks(text):
    if type(text) is not str or len(text) > 4096:
        raise ValueError("fence.input")
    blocks, body, language = [], None, None
    for line in text.splitlines():
        if body is None:
            opening = re.fullmatch(r"```([A-Za-z0-9_-]*)", line)
            if opening:
                body, language = [], opening[1]
        elif line == "```":
            blocks.append((language, "\n".join(body)))
            body = None
        else:
            body.append(line)
    if body is not None:
        raise ValueError("fence.unclosed")
    return blocks
✳Restricted backtick block extraction
✓ ChangesReview before applying ↗
Illustrative workspace
  1. Connection

    Base URL, credentials and a reachable server.

  2. Project

    Test empty blocks and normalized line breaks, reject an unclosed block and leave unsupported Markdown forms uninterpreted without executing code.

  3. Review before applying

    Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Workflows

Restricted backtick block extraction

Workflows ↗
A concrete starting point
import re

def fenced_blocks(text):
    if type(text) is not str or len(text) > 4096:
        raise ValueError("fence.input")
    blocks, body, language = [], None, None
    for line in text.splitlines():
        if body is None:
            opening = re.fullmatch(r"```([A-Za-z0-9_-]*)", line)
            if opening:
                body, language = [], opening[1]
        elif line == "```":
            blocks.append((language, "\n".join(body)))
            body = None
        else:
            body.append(line)
    if body is not None:
        raise ValueError("fence.unclosed")
    return blocks
AI coding workspace

Keep the extraction contract separate from execution

FenceLilt provides a Windows AI coding workspace for developers building small text-processing features with deliberately limited input rules. Open the project and describe what the feature should recognize, what it should leave alone and how it should report incomplete input. The connected model can then inspect the source and propose a change against those boundaries.

Extracting fenced code blocks offers a concrete task. Use the existing example's marker and language-label rules to discuss accepted forms, including empty blocks and line breaks. Ask the assistant to explain how the proposed parser treats an unclosed block before reviewing its implementation. The extracted body is text; choosing to run anything from it would be a different feature with different requirements.

Run exact-output fixtures in your project after inspecting the patch, and include unsupported forms that must not be reinterpreted accidentally. Review the size limit and error handling alongside successful extraction. For AI assistance, configure a supported OpenAI-compatible or Anthropic endpoint with credentials where needed. An unrestricted model may be selected if the service supplies one, while context capacity and tool availability depend on the server. A useful session ends with a change whose accepted language and failure behavior you can describe clearly.

Checking a restricted extraction feature

Does extracting a code block mean running its contents?

No. This task returns text according to a defined marker contract. Keep any later execution decision separate from extraction, and review downstream code so handling a returned body does not unexpectedly invoke commands or evaluate source.

Should this routine accept every Markdown fence style?

The existing example intentionally supports a restricted form. List the markers and labels your application needs, then check them explicitly. Expanding to other Markdown forms is a requirement change, not an automatic consequence of cleaning up the parser.

How should an unclosed block be handled?

State whether incomplete input is rejected before implementing the change. The illustrated task rejects it. Include a fixture that reaches the end while a block is open, and verify the caller presents that outcome appropriately.

Why retain unsupported examples in the tests?

They show where the feature stops. A model-suggested expression may accidentally recognize extra forms, changing behavior without an obvious failure. Check accepted and untouched text together so the implementation preserves the intended boundary.

Get the Windows app ↗

FenceLilt · Updated 2026-10-25