Is there any way to comment out text in textile? - markup

LaTeX has %, html has <\!-- to denote that a comment folows.
Does textile have anyway of commenting out text? I couldn't find one, and it seems like it would be a nice feature to have.

Not really. It seems you can do a single line HTML escape sequence containing an HTML comment which is passed through. But you probably want something more like the C Preprocessor comments that are simply stripped out completely?
==<!-- html comment -->==
Or you could do this, which outputs a multiline html comment, but I doubt it's what you want either:
notextile. <!-- test
test
test
-->

The TextPattern version of Textile does support comments.
The syntax is to have a line beginning with three hashes and one or two full stops.
###. This line will be treated as a comment.
So will this.
This line will be displayed.
###.. Blank lines are allowed in comments if you use two full stops.
This line is also a comment.
p. Starting a new block will end the comment.
Currently, the RedCloth and Mylyn implementations of Textile do not support these comments.

Related

Ruby - stop program from executing in certain way

I wrote a parser, which recognizes elements of text based on certain pattern.
My program is able to recognize paragraph, chapter etc. The problem is it shouldn't recognize elements, when there's a quote. For example:
Paragraph 1
Something here...
would be proceed as Paragraph.
And:
Paragraph 1
"Paragraph 2"
shouldn't. But as my program is based on regexp patterns, it looks for the word "Paragraph". I'm going line by line and recognize patterns for each line. I don't know how to tell my program: if you see quotes mark, leave text alone without doing anything? My mentor told me to use raise, but I'm not sure how to do it.
OK, so I'm still a bit of a beginner, I don't know if there is a way to direct the regex to ignore things inside quotes, but if I wanted to solve this problem, I would first make a copy of the text to be parsed, run a regex over that and delete everything inside quotes, then run the parser over the remaining text.
A bit kludgy and inelegant I admit, and may have performance issues over a large enough text, but it would get the job done.
See HERE for link to documentation of ruby regex. About a third of the way down it discusses quotes:
/\p{Pi}/ - 'Punctuation: Initial Quote'
/\p{Pf}/ - 'Punctuation: Final Quote'
You may be able to bake that into the regex with the ^ to direct it to ignore items in quotes.

markdown files don't format properly

I am using using jekyll and markdown for the first time to build a blog site. From what I understand about markdown files, the pound key is what is used to comment lines, except it does the complete opposite for me. Anything with in all of my .md files are commented out, and the things that are supposed to be comments, are actual live text on the page. Here's what I mean:
Does anyone know what the problem is? It was working properly yesterday, so I'm thinking that it may be a problem with my text editor (Atom). Thanks!
From what I understand about markdown files, the pound key is what is used to comment lines, except it does the complete opposite for me.
Nope. Hashes used to represent various levels of header:
Atx-style headers use 1-6 hash characters at the start of the line, corresponding to header levels 1-6. For example:
# This is an H1
## This is an H2
###### This is an H6
Markdown doesn't have the concept of comments, although it does support inline HTML, so you can use HTML comments, e.g.
<!-- This is a comment -->

How can I represent a space at the end of a span of code in markdown?

I'm trying to represent a short inline span of code with a significant space or two at the end, using Markdown. If I were to put it in a stand-alone code block, it might look like this:
cd
Frustratingly, Markdown transforms `cd ` into <code>cd</code>, deleting the space at the end. How can I do it?
Unfortunately, I'm not aware of a way to do this with backticks in vanilla Markdown. If you need to use your current parser, you can use literal <code> HTML tags to generate correct output:
Normal text. <code>Inline code block with a space: </code> Normal text.
If you're able and interested, switching to a more consistent/expanded parser (such as kramdown, which I've tested, but potentially also MultiMarkdown and others) correctly interprets terminal spaces in code blocks and doesn't truncate them.
I don't believe markdown has anything for that specifically but if you use it will add a non breaking space. In your case replace
`cd `
with
`cd `
and it should work as intended.

Inline Code in DokuWiki

I'm looking for a way to include code as part of a paragraph in DokuWiki like I can by adding backtick escapes in StackOverflow like _so_. Simply adding <code>bla</code> puts code on it's own line.
You probably want to use ''%%here is code%%''. This formats it in monospace ('') and prevents any interpretion of possible wiki markup (%%).
I was able to find an answer to my own question. Add quotes around the in-text code ''like this''. Simple, short, and works great.

Markdown to plain text in Ruby?

I'm currently using BlueCloth to process Markdown in Ruby and show it as HTML, but in one location I need it as plain text (without some of the Markdown). Is there a way to achieve that?
Is there a markdown-to-plain-text method? Is there an html-to-plain-text method that I could feel the result of BlueCloth?
RedCarpet gem has a Redcarpet::Render::StripDown renderer which "turns Markdown into plaintext".
Copy and modify it to suit your needs.
Or use it like this:
Redcarpet::Markdown.new(Redcarpet::Render::StripDown).render(markdown)
Converting HTML to plain text with Ruby is not a problem, but of course you'll lose all markup. If you only want to get rid of some of the Markdown syntax, it probably won't yield the result you're looking for.
The bottom line is that unrendered Markdown is intended to be used as plain text, therefore converting it to plain text doesn't really make sense. All Ruby implementations that I have seen follow the same interface, which does not offer a way to strip syntax (only including to_html, and text, which returns the original Markdown text).
It's not ruby, but one of the formats Pandoc now writes is 'plain'. Here's some arbitrary markdown:
# My Great Work
## First Section
Here we discuss my difficulties with [Markdown](http://wikipedia.org/Markdown)
## Second Section
We begin with a quote:
> We hold these truths to be self-evident ...
then some code:
#! /usr/bin/bash
That's *all*.
(Not sure how to turn off the syntax highlighting!) Here's the associated 'plain':
My Great Work
=============
First Section
-------------
Here we discuss my difficulties with Markdown
Second Section
--------------
We begin with a quote:
We hold these truths to be self-evident ...
then some code:
#! /usr/bin/bash
That's all.
You can get an idea what it does with the different elements it parses out of documents from the definition of plainify in pandoc/blob/master/src/Text/Pandoc/Writers/Markdown.hs in the Github repository; there is also a tutorial that shows how easy it is to modify the behavior.

Resources