I am trying to put bullet points inside of a GitHub text box for the READme.
I know how to do them separately. For example to create the gray textbox I can do:
```
item1
item2
```
To create bullet points I can do:
* item1
* item2
However if I try and place the bullet points inside of the table, the literal syntax for the bullet points shows up, rather than the bullet points. I have tried escaping the bullet point characters.
How do I get bullet points inside of the table?
The GitHub Flavored Markdown Spec plainly states:
Block-level elements cannot be inserted in a table.
Of course, lists are block-level elements, and therefore they cannot be inserted in a table.
Generally the way to get around such restrictions in Markdown is to use raw HTML. However, a raw HTML list would be a HTML block, which is also a block-level element and not allowed in a table. Therefore, you would need to use raw HTML for the entire table.
Related
I'd like to include an image into a mail merged word document based on the presence of a single value in a column which contains several values.
e.g. if the cell contains the value BOB insert image, if it contains any other value then do nothing.
Most of the {INCLUDEPICTURE} functionality seems built around including a different image based on a filename matching a cell value.
{INCLUDEPICTURE} "MERGEFIELD Selection_identifier).png"\*
MERGEFORMAT \d }
Works provided I translate selection_identifer in the spreadsheet itself, but there has to be a better way. There seems to be little information about this particular usecase online.
If you are only using a single image and it does not vary between merges, you should probably just use
{ IF "{ MERGEFIELD Selection_identifier }" = "BOB" "<the_image>" }
where <the_image> is a copy of the actual image, sized how you want, pasted between those quotation marks. In that case, there would be no need for an INCLUDEPICTURE field or a reference to an external image file.
As usual, all the {} have to be the special field code brace pairs that you can insert on Windows Desktop Word using Carl-F9 or similar.
I have a markdown list like so:
* Question A
- Answer 1
- Answer 2
- Answer 3
I need to ensure that all the answers (1 - 3) appear on the same page as Question A when I convert the markdown document to docx using pandoc. How can I do this?
Use custom styles in your Markdown and then define those styles in a custom docx template.
It's important to note that Pandoc's documentation states (emphasis added):
Because pandoc’s intermediate representation of a document is less
expressive than many of the formats it converts between, one should
not expect perfect conversions between every format and every other.
Pandoc attempts to preserve the structural elements of a document, but
not formatting details...
Of course, Markdown has no concept of "pages" or "page breaks," so that is not something Pandoc can handle by default. However, Pandoc is aware of docx styles. As the documentation explains:
By default, pandoc’s docx output applies a predefined set of styles
for blocks such as paragraphs and block quotes, and uses largely
default formatting (italics, bold) for inlines. This will work for
most purposes, especially alongside a reference.docx file. However, if
you need to apply your own styles to blocks, or match a preexisting
set of styles, pandoc allows you to define custom styles for blocks
and text using divs and spans, respectively.
If you define a div or span with the attribute custom-style, pandoc
will apply your specified style to the contained elements. So, for
example using the bracketed_spans syntax,
[Get out]{custom-style="Emphatically"}, he said.
would produce a docx file with “Get out” styled with character style
Emphatically. Similarly, using the fenced_divs syntax,
Dickinson starts the poem simply:
::: {custom-style="Poetry"}
| A Bird came down the Walk---
| He did not know I saw---
:::
would style the two contained lines with the Poetry paragraph style.
If the styles are not yet in your reference.docx, they will be defined
in the output file as inheriting from normal text. If they are already
defined, pandoc will not alter the definition.
If you don't want to define the style manually, but would like it applied to every list automatically (or perhaps to every list which follows a specific pattern), you could define a custom filter which applied the style(s) to every matching element in the document.
Of course, that only adds the style names to the output. You still need to define the styles (tell Word how to display elements assigned those styles). As the documentation for the --reference-doc option explains :
For best results, the reference docx should be a modified version of a
docx file produced using pandoc. The contents of the reference docx
are ignored, but its stylesheets and document properties (including
margins, page size, header, and footer) are used in the new docx. If
no reference docx is specified on the command line, pandoc will look
for a file reference.docx in the user data directory (see --data-dir).
If this is not found either, sensible defaults will be used.
To produce a custom reference.docx, first get a copy of the default
reference.docx: pandoc --print-default-data-file reference.docx >
custom-reference.docx. Then open custom-reference.docx in Word, modify
the styles as you wish, and save the file.
Of course, when modifying the custom-reference.docx in Word, you can add your new custom style which you have used in your Markdown. As #CindyMeister points out in a comment:
Word would handle this using styles, where the Question style would
have the paragraph setting "Keep with Next". the Answer style would
have this as well. A third style, for the last entry, would NOT have
the setting activated. In addition, all three styles would have the
paragraph setting "Keep together" activated.
Finally, when using pandoc to convert your Markdown to a Word docx file, use the option --reference-doc=custom-reference.docx and your custom style definitions will be included in the generated docx file. As long as you also properly identify which elements in the Markdown document get which styles, your should have a list which doesn't get broken across a page break as long at the entire list fits on one page.
I would like to create a Word document with multiple text boxes that serve as name badges. Each name appears twice, once set normally and once rotated by 180 degrees. Later, they are printed on paper, cut and folded, so they can stand on a table.
I am using docx4j to generate the DOCX file. My idea is to have a fragment in one Word file that serves as a template for a single name badge. I'd like to load that template and fill the placeholders with real names. Multiple fragments are then concatenated and written to a second Word template, so ultimately I have a list with multiple name badges. The paper I use allows two name badges on each page (i.e. four text boxes).
However, I fail implementing this with docxj4. This is what I tried:
(1) First, I tried filling a single name badge. The placeholders got filled correctly, but the rotated text box of my Word template (input) became an ordinary (not rotated) text box in the output file.
(2) I also tried MainDocumentPart#addParagraph(String) and created the entire paragraph myself, using XML code generated in Word (where the text box was rotated). The output generated by docx4j, however, again did not respect the rotation. It created two text boxes, but when I view them in Word now, I even cannot rotate them there anymore. It seems like the generated text boxes are different from those created by Word in the first place.
Long story short, how can I create a rotated text box with docx4j?
It would be very convenient, if I could have a Word template to layout the name badges, but if I would have to create the entire thing programatically, it would be fine, too. Also, other ways of rotating text would be okay for me. But it seems like text boxes are the only objects in Word that can actually be rotated by 180 degrees.
I'm working with Content Controls in MS Word 2010. I add text to the Content Controls using Java. Some of the text contains several sentences and I would like to see each sentence appear as a bullet point. I've managed to define a bullet point style in MS Word. However, I don't know how to make each sentence appear as a bullet point (now the entire text appears as just one bullet point). What is the best way of going about this? I'm considering using VBA but am not sure how to add a VBA macro to a Content Control.
In Word, bullet points are implemented via list numbering.
For list numbering, you need paragraphs (you set the numPr on the pPr).
For a content control to contain paragraphs, you need a block level content control.
So, you need a block level rich text content control, then put your content in it, one paragraph per sentence, formatted using your list numbering (either directly applying the numPr, or a style which uses that numPr).
You can set what the Facebook Share preview says. I would like it to be the first paragraph of my movable type entry. The people who make entries sometimes use
<p>
tags or they use the rich editor which puts in two
<br /><br />
tags to separate paragraphs.
Is there a way I can have movable type detect when the first paragraph end and only display the first paragraph? I would like to add that to my entry template so it will add some information to my head.
EntryBody has a lot of attributes to help format the output of the tag. You can use those to change the content so it shows up correctly in HTML, JavaScript, PHP, XML or other forms of output.
If you understand how to use regular expressions, you can use that and an additional language, say PHP, to break the body up into an array and only output the first paragraph or element of the array.
The simplest thing, though, I would think, would be to do something like
<mt:EntryBody words=100>
That will cut off the entry body after the first 100 words. You could also require users to upload an excerpt with the entry and use the entry excerpt for Facebook, instead.