Giter VIP home page Giter VIP logo

textile-lang-com-website's Introduction

PHP-Textile

Textile reference | Live editor

PHP-Textile is a modern Textile markup language parser for PHP. Textile is a humane web text generator that takes lightweight, readable, plaintext-like markup language and converts it into well formed HTML.

Install

Using Composer:

$ composer require netcarver/textile

Usage

The Textile parser can be accessed through the Netcarver\Textile\Parser class. The class is highly configurable, and actual parsing happens with the parse method:

require './vendor/autoload.php';
$parser = new \Netcarver\Textile\Parser();
echo $parser->parse('h1. Hello World!');

Parsing untrusted input

If you are using PHP-Textile to format user-supplied input, blog comments for instance, remember to enable restricted parser mode:

$parser = new \Netcarver\Textile\Parser();
echo $parser
    ->setRestricted(true)
    ->parse('!bad/image/not/allowed.svg!');

In restricted mode PHP-Textile doesn’t allow more powerful formatting options such as inline styles, and removes any raw HTML.

Parsing single-line fields

If you are using PHP-Textile as a field-level formatter to parse just inline spans and glyphs, use the setBlockTags method to disable block tags:

$parser = new \Netcarver\Textile\Parser();
echo $parser
    ->setBlockTags(false)
    ->parse('Hello *strong* world!');

The above outputs:

Hello <strong>strong</strong> world!

Doctypes

Currently, PHP-Textile can target either XHTML or HTML5 output with XHTML being the default for backward compatibility. The targeted doctype can be changed via the setDocumentType method:

$parser = new \Netcarver\Textile\Parser();
echo $parser
    ->setDocumentType('html5')
    ->parse('HTML(HyperText Markup Language)');

Setting alternate glyphs

Textile’s typographic substitutions can be overridden with the setSymbol method. If you need to setup Textile to do non-standard substitutions, call setSymbol before you parse the input with parse.

$parser = new \Netcarver\Textile\Parser();
$parser
    ->setSymbol('half', '1&#8260;2')
    ->parse('Hello [1/2] World!');

The symbol names you can pass to setSymbol can be found here.

Prefixing relative image and link paths

Setting prefix might be useful if you want to point relative paths to certain consistent location:

$parser = new \Netcarver\Textile\Parser();
$parser
    ->setImagePrefix('/user/uploads')
    ->setLinkPrefix('/')
    ->parse('!image.jpg! "link":page');

Getting in contact

The PHP-Textile project welcomes constructive input and bug reports from users. Please open an issue on the repository for a comment, feature request or bug.

Development

See CONTRIBUTING.textile.

textile-lang-com-website's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar philwareham avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

6s9

textile-lang-com-website's Issues

Copy edit: Endnotes

https://textile-lang.com/doc/auto-numbered-notes

Should be:

The sun is reportedly hot,[#hot] just like freshly baked potatoes.[#hot] Ice is cold.[#cold]

I.e. numbers outside of punctuation.

Of course it depends on what style guide you follow, but in this case nearly all of them say 'outside' (but inside a closing bracket or parenthesis).

Too much info time:

MLA was the only guide I knew of that used to advise inside punctuation, but it looks like even they have changed tune. MLA is one of the American humanities versions (next to Chicago Manual) comparable to Oxford's manual of style, or compatibly, the MHRA, which is what I use in my projects, unless required differently, in conjunction with Oxford's style.

Weird sentence in example about images+links

Describe the bug
There's an ungrammatical sentence at https://textile-lang.com/doc/links and https://textile-lang.com/doc/images:

Combine with a link with an image link:
!/carver.png!:https://textpattern.com/

To reproduce
Steps to reproduce the behaviour:

  1. Go to https://textile-lang.com/doc/links or https://textile-lang.com/doc/images
  2. Scroll down to the "More about" section
  3. See the incorrect sentence in the list

Expected behaviour
I'd expect something like this:

Combine a link with an image:
!/carver.png!:https://textpattern.com/

ps - I tried to look around for that string in the source code, in order to submit a PR proposing a fix, but I couldn't find it. Is the site content sourced from elsewhere?

Misleading Citation Example

The example provided on the page "Citations" incorrectly uses the <cite> tag. Below is the example provided:

??Don’t make something, unless it is both necessary and useful.??
??But if it is both necessary and useful, don't hesitate to make it beautiful.??
-- Shaker lesson

According to the MDN article linked lower on the page, "The <cite> HTML element is used to mark up the title of a cited creative work." Given this description, the example would be more appropriately written as:

Don’t make something, unless it is both necessary and useful.
But if it is both necessary and useful, don't hesitate to make it beautiful.
-- ??The Shaker Design Philosophy??

Now the <cite> element marks the title of the creative work, which respects the semantic meaning of the element.

Random-length HTML comments in HTML results of textile

Like the nice new shiny site 👍 !

I appreciate it's early days (you probably know about it) but I saw that the HTML results of the textiled output includes the following at the end of each block:

<!-- random-length HTML comment: …

I think @petecooper once explained to me that this a security measure (added by nginx?)

Indentation example doesn't display correctly.

Describe the bug
Indentation example doesn't indent in the example box.

To reproduce
Steps to reproduce the behaviour:

  1. Go to Indentation section of the documentation.
  2. See error

Expected behaviour
Text should appear on at various levels of indentation on the left and right of the screen.

Desktop (please complete the following information):

  • OS: Win10
  • Browser [Firefox]
  • Version [84.0.2]

HTML comment handling in the Textile HTML output

Background: #11

Due to the way the HTML output is handled, trailing HTML comments appear in the Textile HTML output.

Where HTML comments are appended by a CMS (for example, Textpattern debug or testing mode) or underlying http server (for example, Nginx's length-hiding module as part of BREACH mitigation), this is included in the output as appended text:

screen shot 2018-12-17 at 12 30 02

It's unnecessary and may also be confusing. Some possible solutions were outlined by @gocom here.

(NTS: If this is accepted as an issue, length-hiding should be re-enabled when appropriate. See textpattern/server-config#28 for reminder.)

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Entry page from Textpattern admin panels

Create a simple 'cheat sheet' page to be served to Textpattern admin control panel pop help item. Reduced screen clutter to accommodate small area.

List the commonly-use Textile syntax. Link to wider site via new window link.

Fix structured data validation errors

Test and fix issues reported by Google's Structured Data Testing Tool

  • Missing publisher
  • Missing mainEntityOfPage
  • Image width/height attributes error

IE11

IE11 is supported according to README, but apparently it isn't (see #19).

Image not found

Describe the bug
A forward slash is missing in the "More about: Alignment" example

To reproduce
Steps to reproduce the behaviour:

  1. Go to the Alignment page.
  2. Copy the example under "More about: Alignment"
  3. Insert into the input box
  4. See error

Expected behaviour
The carver image should be displayed

CSP prevents logo being displayed

Expecting to see the logo at the top of the page. Instead, I see:

Content Security Policy: The page's settings blocked the loading of a resource at data:image/svg+xml;charset=utf-8,%3Csvg … ("img-src").
Content Security Policy: The page's settings blocked the loading of a resource at inline ("script-src").

browser-related issues

Some examples do not display correctly with FF63 or Safari, such as attributes (alignment, indentation, span, CSS styles). The column layout is broken with IE11

Escape vertical bar in a table

vertical bar literal |

vertical bar in decimal &#124;

vertical bar literal in table is rendered as two columns. The desired result is a single column. echo ... grep H.

Sample

| echo "Hello World" | grep H |

Question: Can a vertical bar be escaped in a table?

Question: There is a Unicode Symbol for "CopyRight". (C)

Suggestion: How about a Unicode Symbol for vertical line (V) or (l)?

Here are two revised samples.

Sample with V
| echo "Hello World" (V) grep H |

Sample with l
| echo "Hello World" (l) grep H |

Deprecation error message at the start of every page

The following message is displayed on the top of all pages:

Deprecated: Function get_magic_quotes_gpc() is deprecated in /var/www/vhosts/textile-lang.com/www/live/textpattern/lib/constants.php on line 136

The functionality of the website seems otherwise unaffected.

definition lists problem

in definition lists, when I write with chinese word "文章", that dt will lost. for example:

  • 文章 := 我写了很多文章
  • articles := some articles

will output:

articles
some articles

Tags without angle brackets

Some articles eg. Block code or Spans should have tags in their description, but the angle brackets are not displayed.

Bump to 3.7.0?

Textile 3.7.0 is out, website is using 3.7.0-dev – bump to 3.7.0 now or wait for Textpattern 4.7.2 to drop?

Table data converter does not convert table data

Hi,

first of all: thanks for textile.

I recently suggested using the table data converter at https://textile-lang.com/tools/data-converter for users to convert csv data into textile table syntax. As of now, the conversion only seems to work on the given example data.

The lack of a convert button suggests that the conversion should be instant, e.g. on change or keyup or similar. Obviously thats not triggered correctly. There are no error messages within the console.

I've tested that on a Mac using the latest stable versions of Chrome, Firefox and Opera.

Thanks - Andreas

UI Suggestion

Could we have a Next and Previous bottom at the end of the page? It would certainly help avoid scrolling back to the top to get the link to the next page. Another suggestion I have is to generate a PDF of the entire documentation. It would certainly allow for easier reading. I just came across textile and it seems like the perfect markup tool but the website is hindering my ability to search for the features I'm looking for in the language.

image examples

The examples in the Images "more about" section do not display correctly when pasted into the input box. Apparently, external images cannot be displayed at all, and the carver.png image is not at the right place.

horizontal rule

Hi, I couldn't find horizontal rule section on website :
horizontal-rule
source

You can check it using VS Code:
example-textile

Above textile document gives output:
example-output

Used extensions on VS Code:

  • idleberg.textile
  • michaelnewton.textile-preview

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.