Page MenuHomePhabricator

Add a basic Remarkup document rendering engine
ClosedPublic

Authored by epriestley on Mar 23 2018, 11:04 AM.
Tags
None
Referenced Files
F14066744: D19251.diff
Tue, Nov 19, 11:36 AM
F14055275: D19251.diff
Sat, Nov 16, 10:07 AM
F13975132: D19251.diff
Oct 18 2024, 8:55 AM
F13974019: D19251.id.diff
Oct 18 2024, 3:41 AM
F13970908: D19251.id.diff
Oct 17 2024, 10:28 AM
F13965287: D19251.id46090.diff
Oct 16 2024, 1:05 AM
F13961651: D19251.id46093.diff
Oct 15 2024, 5:48 AM
F13961649: D19251.diff
Oct 15 2024, 5:47 AM
Tokens
"Like" token, awarded by mydeveloperday.

Details

Summary

Ref T13105. Although Markdown is trickier to deal with, we can handle Remarkup easily.

This may need some support for encoding options.

Test Plan

Viewed .remarkup files, got remarkup document presentation by default. Viewed other text files, got an option to render as remarkup.

Diff Detail

Repository
rP Phabricator
Branch
docu1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 19908
Build 26984: Run Core Tests
Build 26983: arc lint + arc unit

Event Timeline

avivey added a subscriber: avivey.

😻

(What's \z in the regexp?)

This revision is now accepted and ready to land.Mar 23 2018, 11:24 AM

\z is a "better" version of $ and should usually be used instead of $:

  • The regular expression /^cat$/ matches the input strings cat and cat\n.
  • The regular expression /^cat\z/ matches only the input string cat.

This usually doesn't matter, but can occasionally be important, as in D8516.

if you were writing a custom DocumentEngine for say .myformat which is perhaps traditionally mapped to the mime type of text/plain, then I'm guessing adding the following, is a good way to get your engine to be picked as the "default" viewer

protected function getContentScore(PhabricatorDocumentRef $ref) {
    $name = $ref->getName();
    if (preg_match('/\\.myformat\z/i', $name)) {
      return 2000;
    }

    return 500;
  }
This revision was automatically updated to reflect the committed changes.