public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Tip: comments in Markdown
@ 2022-06-22 13:53 BPJ
       [not found] ` <CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2=BE2T7kO0GA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: BPJ @ 2022-06-22 13:53 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 1958 bytes --]

I don't know if I or someone else has mentioned this before, but I just
realized that there is (another) simple trick to simulate "markdown
comments" as opposed to HTML comments:

``````markdown
```{=comment}
This won't show up in HTML output!
```

`This neither`{=comment}

<!-- But this will be in HTML -->
``````

Theoretically this might break if there ever is an output format called
"comment" but I guess that is highly unlikely.

It will also probably work with your local language's word(s) for
'comment'; I tried with Swedish "anmärkning" (and the abbreviations
"anmärkn" and "anm") and it seems multi-byte chars in the "format name" is
no problem.

Also if you don't trust Pandoc to automatically reject raw elements with a
bogus format you can use a simple filter:

``````lua
local is_comment = {
  'comment',
  'com',
  'remark',
  'rem',
  'kommentar',
  'komm',
  'anmärkning',
  'anm',
  'athugasemd',
  'aths',
}
-- Turn the list into a set
for i=1,#is_comment do
  is_comment[is_comment[i]] = true
  is_comment[i] = nil
end

local function raw (r)
  if is_comment[r.format] then
    return {}
  else
    return nil
  end
end

return {
  {
    RawBlock = raw,
    RawInline = raw,
  }
}
``````

Notably this filter can be used to remove such "comments" from Markdown
output, while otherwise they will remain when reformatting Markdown source
with Pandoc, which IMO is an advantage over YAML comments.

I hope this is useful for others,

/bpj

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 3709 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tip: comments in Markdown
       [not found] ` <CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2=BE2T7kO0GA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-06-22 13:57   ` William Lupton
       [not found]     ` <CAEe_xxjAwFPZsCP3JMW+qHpfT2csgnei3pyE3RZT+aoUhYVwoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2022-06-22 17:55   ` John MacFarlane
  2022-06-22 19:12   ` Thomas Byskov Dalgaard
  2 siblings, 1 reply; 8+ messages in thread
From: William Lupton @ 2022-06-22 13:57 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 2968 bytes --]

it also works to use YAML comments, e.g.

% cat comment.md
---
# this is a comment
---

text

---
# this is another comment
---

% pandoc comment.md
<p>text</p>

On Wed, 22 Jun 2022 at 14:53, BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> I don't know if I or someone else has mentioned this before, but I just
> realized that there is (another) simple trick to simulate "markdown
> comments" as opposed to HTML comments:
>
> ``````markdown
> ```{=comment}
> This won't show up in HTML output!
> ```
>
> `This neither`{=comment}
>
> <!-- But this will be in HTML -->
> ``````
>
> Theoretically this might break if there ever is an output format called
> "comment" but I guess that is highly unlikely.
>
> It will also probably work with your local language's word(s) for
> 'comment'; I tried with Swedish "anmärkning" (and the abbreviations
> "anmärkn" and "anm") and it seems multi-byte chars in the "format name" is
> no problem.
>
> Also if you don't trust Pandoc to automatically reject raw elements with a
> bogus format you can use a simple filter:
>
> ``````lua
> local is_comment = {
>   'comment',
>   'com',
>   'remark',
>   'rem',
>   'kommentar',
>   'komm',
>   'anmärkning',
>   'anm',
>   'athugasemd',
>   'aths',
> }
> -- Turn the list into a set
> for i=1,#is_comment do
>   is_comment[is_comment[i]] = true
>   is_comment[i] = nil
> end
>
> local function raw (r)
>   if is_comment[r.format] then
>     return {}
>   else
>     return nil
>   end
> end
>
> return {
>   {
>     RawBlock = raw,
>     RawInline = raw,
>   }
> }
> ``````
>
> Notably this filter can be used to remove such "comments" from Markdown
> output, while otherwise they will remain when reformatting Markdown source
> with Pandoc, which IMO is an advantage over YAML comments.
>
> I hope this is useful for others,
>
> /bpj
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxjAwFPZsCP3JMW%2BqHpfT2csgnei3pyE3RZT%2BaoUhYVwoQ%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 5263 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tip: comments in Markdown
       [not found]     ` <CAEe_xxjAwFPZsCP3JMW+qHpfT2csgnei3pyE3RZT+aoUhYVwoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-06-22 17:48       ` BPJ
       [not found]         ` <CADAJKhDDy5y-KFmWcea6BwaL7S9Jk7piw-bf4RbYmBJtVQb2aA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: BPJ @ 2022-06-22 17:48 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 3935 bytes --]

As I said YAML comments aren't preserved when reformatting Markdown source
with pandoc, which as far as I am concerned is a defect.

Den ons 22 juni 2022 15:58William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
skrev:

> it also works to use YAML comments, e.g.
>
> % cat comment.md
> ---
> # this is a comment
> ---
>
> text
>
> ---
> # this is another comment
> ---
>
> % pandoc comment.md
> <p>text</p>
>
> On Wed, 22 Jun 2022 at 14:53, BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>> I don't know if I or someone else has mentioned this before, but I just
>> realized that there is (another) simple trick to simulate "markdown
>> comments" as opposed to HTML comments:
>>
>> ``````markdown
>> ```{=comment}
>> This won't show up in HTML output!
>> ```
>>
>> `This neither`{=comment}
>>
>> <!-- But this will be in HTML -->
>> ``````
>>
>> Theoretically this might break if there ever is an output format called
>> "comment" but I guess that is highly unlikely.
>>
>> It will also probably work with your local language's word(s) for
>> 'comment'; I tried with Swedish "anmärkning" (and the abbreviations
>> "anmärkn" and "anm") and it seems multi-byte chars in the "format name" is
>> no problem.
>>
>> Also if you don't trust Pandoc to automatically reject raw elements with
>> a bogus format you can use a simple filter:
>>
>> ``````lua
>> local is_comment = {
>>   'comment',
>>   'com',
>>   'remark',
>>   'rem',
>>   'kommentar',
>>   'komm',
>>   'anmärkning',
>>   'anm',
>>   'athugasemd',
>>   'aths',
>> }
>> -- Turn the list into a set
>> for i=1,#is_comment do
>>   is_comment[is_comment[i]] = true
>>   is_comment[i] = nil
>> end
>>
>> local function raw (r)
>>   if is_comment[r.format] then
>>     return {}
>>   else
>>     return nil
>>   end
>> end
>>
>> return {
>>   {
>>     RawBlock = raw,
>>     RawInline = raw,
>>   }
>> }
>> ``````
>>
>> Notably this filter can be used to remove such "comments" from Markdown
>> output, while otherwise they will remain when reformatting Markdown source
>> with Pandoc, which IMO is an advantage over YAML comments.
>>
>> I hope this is useful for others,
>>
>> /bpj
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxjAwFPZsCP3JMW%2BqHpfT2csgnei3pyE3RZT%2BaoUhYVwoQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxjAwFPZsCP3JMW%2BqHpfT2csgnei3pyE3RZT%2BaoUhYVwoQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDDy5y-KFmWcea6BwaL7S9Jk7piw-bf4RbYmBJtVQb2aA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 6618 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tip: comments in Markdown
       [not found] ` <CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2=BE2T7kO0GA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2022-06-22 13:57   ` William Lupton
@ 2022-06-22 17:55   ` John MacFarlane
  2022-06-22 19:12   ` Thomas Byskov Dalgaard
  2 siblings, 0 replies; 8+ messages in thread
From: John MacFarlane @ 2022-06-22 17:55 UTC (permalink / raw)
  To: BPJ, pandoc-discuss

BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I don't know if I or someone else has mentioned this before, but I just
> realized that there is (another) simple trick to simulate "markdown
> comments" as opposed to HTML comments:
>
> ``````markdown
> ```{=comment}
> This won't show up in HTML output!
> ```
>
> `This neither`{=comment}
>
> <!-- But this will be in HTML -->
> ``````
>
> Theoretically this might break if there ever is an output format called
> "comment" but I guess that is highly unlikely.

Very nice. I never thought of that.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tip: comments in Markdown
       [not found]         ` <CADAJKhDDy5y-KFmWcea6BwaL7S9Jk7piw-bf4RbYmBJtVQb2aA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-06-22 18:47           ` William Lupton
  0 siblings, 0 replies; 8+ messages in thread
From: William Lupton @ 2022-06-22 18:47 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 4821 bytes --]

Ah, sorry, I didn't read what you'd written sufficiently carefully.

On Wed, 22 Jun 2022, 18:48 BPJ, <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> wrote:

> As I said YAML comments aren't preserved when reformatting Markdown source
> with pandoc, which as far as I am concerned is a defect.
>
> Den ons 22 juni 2022 15:58William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
> skrev:
>
>> it also works to use YAML comments, e.g.
>>
>> % cat comment.md
>> ---
>> # this is a comment
>> ---
>>
>> text
>>
>> ---
>> # this is another comment
>> ---
>>
>> % pandoc comment.md
>> <p>text</p>
>>
>> On Wed, 22 Jun 2022 at 14:53, BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>
>>> I don't know if I or someone else has mentioned this before, but I just
>>> realized that there is (another) simple trick to simulate "markdown
>>> comments" as opposed to HTML comments:
>>>
>>> ``````markdown
>>> ```{=comment}
>>> This won't show up in HTML output!
>>> ```
>>>
>>> `This neither`{=comment}
>>>
>>> <!-- But this will be in HTML -->
>>> ``````
>>>
>>> Theoretically this might break if there ever is an output format called
>>> "comment" but I guess that is highly unlikely.
>>>
>>> It will also probably work with your local language's word(s) for
>>> 'comment'; I tried with Swedish "anmärkning" (and the abbreviations
>>> "anmärkn" and "anm") and it seems multi-byte chars in the "format name" is
>>> no problem.
>>>
>>> Also if you don't trust Pandoc to automatically reject raw elements with
>>> a bogus format you can use a simple filter:
>>>
>>> ``````lua
>>> local is_comment = {
>>>   'comment',
>>>   'com',
>>>   'remark',
>>>   'rem',
>>>   'kommentar',
>>>   'komm',
>>>   'anmärkning',
>>>   'anm',
>>>   'athugasemd',
>>>   'aths',
>>> }
>>> -- Turn the list into a set
>>> for i=1,#is_comment do
>>>   is_comment[is_comment[i]] = true
>>>   is_comment[i] = nil
>>> end
>>>
>>> local function raw (r)
>>>   if is_comment[r.format] then
>>>     return {}
>>>   else
>>>     return nil
>>>   end
>>> end
>>>
>>> return {
>>>   {
>>>     RawBlock = raw,
>>>     RawInline = raw,
>>>   }
>>> }
>>> ``````
>>>
>>> Notably this filter can be used to remove such "comments" from Markdown
>>> output, while otherwise they will remain when reformatting Markdown source
>>> with Pandoc, which IMO is an advantage over YAML comments.
>>>
>>> I hope this is useful for others,
>>>
>>> /bpj
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "pandoc-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxjAwFPZsCP3JMW%2BqHpfT2csgnei3pyE3RZT%2BaoUhYVwoQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxjAwFPZsCP3JMW%2BqHpfT2csgnei3pyE3RZT%2BaoUhYVwoQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDDy5y-KFmWcea6BwaL7S9Jk7piw-bf4RbYmBJtVQb2aA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDDy5y-KFmWcea6BwaL7S9Jk7piw-bf4RbYmBJtVQb2aA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxhzPYAc%3D6mrM7sukroZ%3DR7RoiHMfwkDwxpsVHUci3OANA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 7877 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tip: comments in Markdown
       [not found] ` <CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2=BE2T7kO0GA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2022-06-22 13:57   ` William Lupton
  2022-06-22 17:55   ` John MacFarlane
@ 2022-06-22 19:12   ` Thomas Byskov Dalgaard
       [not found]     ` <332666C5-9B8E-42B1-A9D2-2437FCE7B70E-AHfMSizzl90sTMJHDOTzqX9LOBIZ5rWg@public.gmane.org>
  2 siblings, 1 reply; 8+ messages in thread
From: Thomas Byskov Dalgaard @ 2022-06-22 19:12 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 3036 bytes --]

Wow that would be very cool. Would you mind documenting this in the Pandoc manual?

Will test this to see if it can help me in some very odd cases I have had in the past. Thanks again bpj.

Best regards Thomas 

> Den 22. jun. 2022 kl. 15.53 skrev BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> 
> I don't know if I or someone else has mentioned this before, but I just realized that there is (another) simple trick to simulate "markdown comments" as opposed to HTML comments:
> 
> ``````markdown
> ```{=comment}
> This won't show up in HTML output!
> ```
> 
> `This neither`{=comment}
> 
> <!-- But this will be in HTML -->
> ``````
> 
> Theoretically this might break if there ever is an output format called "comment" but I guess that is highly unlikely.
> 
> It will also probably work with your local language's word(s) for 'comment'; I tried with Swedish "anmärkning" (and the abbreviations "anmärkn" and "anm") and it seems multi-byte chars in the "format name" is no problem.
> 
> Also if you don't trust Pandoc to automatically reject raw elements with a bogus format you can use a simple filter:
> 
> ``````lua
> local is_comment = {
>   'comment',
>   'com',
>   'remark',
>   'rem',
>   'kommentar',
>   'komm',
>   'anmärkning',
>   'anm',
>   'athugasemd',
>   'aths',
> }
> -- Turn the list into a set
> for i=1,#is_comment do
>   is_comment[is_comment[i]] = true
>   is_comment[i] = nil
> end
> 
> local function raw (r)
>   if is_comment[r.format] then
>     return {}
>   else
>     return nil
>   end
> end
> 
> return {
>   { 
>     RawBlock = raw, 
>     RawInline = raw,
>   }
> }
> ``````
> 
> Notably this filter can be used to remove such "comments" from Markdown output, while otherwise they will remain when reformatting Markdown source with Pandoc, which IMO is an advantage over YAML comments.
> 
> I hope this is useful for others,
> 
> /bpj
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/332666C5-9B8E-42B1-A9D2-2437FCE7B70E%40coolfortheblind.dk.

[-- Attachment #2: Type: text/html, Size: 5951 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tip: comments in Markdown
       [not found]     ` <332666C5-9B8E-42B1-A9D2-2437FCE7B70E-AHfMSizzl90sTMJHDOTzqX9LOBIZ5rWg@public.gmane.org>
@ 2022-06-23 10:18       ` BPJ
       [not found]         ` <CADAJKhDBa8sm2VNKdQpdz_SsBvMYOfofJG-6-hjY6XrSL19nPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: BPJ @ 2022-06-23 10:18 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 4272 bytes --]

It's perhaps not proper to include this in the manual because it is an
exploit of a feature for something it wasn't meant for, or if you want to
be charitable you can call it an "emergent feature". Maybe there could be a
section in the manual describing the various alternatives for *simulating*
markdown comments, but it would have to be somewhat carefully worded!

I think a better solution would be to document such borderline "features"
on the GitHub wiki. However I just checked and there is no link to the wiki
in the manual. There probably should be one.

Den ons 22 juni 2022 21:13Thomas Byskov Dalgaard <tbdlist@coolfortheblind.dk>
skrev:

> Wow that would be very cool. Would you mind documenting this in the Pandoc
> manual?
>
> Will test this to see if it can help me in some very odd cases I have had
> in the past. Thanks again bpj.
>
> Best regards Thomas
>
> Den 22. jun. 2022 kl. 15.53 skrev BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>
> I don't know if I or someone else has mentioned this before, but I just
> realized that there is (another) simple trick to simulate "markdown
> comments" as opposed to HTML comments:
>
> ``````markdown
> ```{=comment}
> This won't show up in HTML output!
> ```
>
> `This neither`{=comment}
>
> <!-- But this will be in HTML -->
> ``````
>
> Theoretically this might break if there ever is an output format called
> "comment" but I guess that is highly unlikely.
>
> It will also probably work with your local language's word(s) for
> 'comment'; I tried with Swedish "anmärkning" (and the abbreviations
> "anmärkn" and "anm") and it seems multi-byte chars in the "format name" is
> no problem.
>
> Also if you don't trust Pandoc to automatically reject raw elements with a
> bogus format you can use a simple filter:
>
> ``````lua
> local is_comment = {
>   'comment',
>   'com',
>   'remark',
>   'rem',
>   'kommentar',
>   'komm',
>   'anmärkning',
>   'anm',
>   'athugasemd',
>   'aths',
> }
> -- Turn the list into a set
> for i=1,#is_comment do
>   is_comment[is_comment[i]] = true
>   is_comment[i] = nil
> end
>
> local function raw (r)
>   if is_comment[r.format] then
>     return {}
>   else
>     return nil
>   end
> end
>
> return {
>   {
>     RawBlock = raw,
>     RawInline = raw,
>   }
> }
> ``````
>
> Notably this filter can be used to remove such "comments" from Markdown
> output, while otherwise they will remain when reformatting Markdown source
> with Pandoc, which IMO is an advantage over YAML comments.
>
> I hope this is useful for others,
>
> /bpj
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/332666C5-9B8E-42B1-A9D2-2437FCE7B70E%40coolfortheblind.dk
> <https://groups.google.com/d/msgid/pandoc-discuss/332666C5-9B8E-42B1-A9D2-2437FCE7B70E%40coolfortheblind.dk?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDBa8sm2VNKdQpdz_SsBvMYOfofJG-6-hjY6XrSL19nPA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 6891 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Tip: comments in Markdown
       [not found]         ` <CADAJKhDBa8sm2VNKdQpdz_SsBvMYOfofJG-6-hjY6XrSL19nPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2022-06-23 20:21           ` John MacFarlane
  0 siblings, 0 replies; 8+ messages in thread
From: John MacFarlane @ 2022-06-23 20:21 UTC (permalink / raw)
  To: BPJ, pandoc-discuss


Maybe we could put this in FAQs?

BPJ <bpj-J3H7GcXPSITLoDKTGw+V6w@public.gmane.org> writes:

> It's perhaps not proper to include this in the manual because it is an
> exploit of a feature for something it wasn't meant for, or if you want to
> be charitable you can call it an "emergent feature". Maybe there could be a
> section in the manual describing the various alternatives for *simulating*
> markdown comments, but it would have to be somewhat carefully worded!
>
> I think a better solution would be to document such borderline "features"
> on the GitHub wiki. However I just checked and there is no link to the wiki
> in the manual. There probably should be one.
>
> Den ons 22 juni 2022 21:13Thomas Byskov Dalgaard <tbdlist@coolfortheblind.dk>
> skrev:
>
>> Wow that would be very cool. Would you mind documenting this in the Pandoc
>> manual?
>>
>> Will test this to see if it can help me in some very odd cases I have had
>> in the past. Thanks again bpj.
>>
>> Best regards Thomas
>>
>> Den 22. jun. 2022 kl. 15.53 skrev BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>>
>> I don't know if I or someone else has mentioned this before, but I just
>> realized that there is (another) simple trick to simulate "markdown
>> comments" as opposed to HTML comments:
>>
>> ``````markdown
>> ```{=comment}
>> This won't show up in HTML output!
>> ```
>>
>> `This neither`{=comment}
>>
>> <!-- But this will be in HTML -->
>> ``````
>>
>> Theoretically this might break if there ever is an output format called
>> "comment" but I guess that is highly unlikely.
>>
>> It will also probably work with your local language's word(s) for
>> 'comment'; I tried with Swedish "anmärkning" (and the abbreviations
>> "anmärkn" and "anm") and it seems multi-byte chars in the "format name" is
>> no problem.
>>
>> Also if you don't trust Pandoc to automatically reject raw elements with a
>> bogus format you can use a simple filter:
>>
>> ``````lua
>> local is_comment = {
>>   'comment',
>>   'com',
>>   'remark',
>>   'rem',
>>   'kommentar',
>>   'komm',
>>   'anmärkning',
>>   'anm',
>>   'athugasemd',
>>   'aths',
>> }
>> -- Turn the list into a set
>> for i=1,#is_comment do
>>   is_comment[is_comment[i]] = true
>>   is_comment[i] = nil
>> end
>>
>> local function raw (r)
>>   if is_comment[r.format] then
>>     return {}
>>   else
>>     return nil
>>   end
>> end
>>
>> return {
>>   {
>>     RawBlock = raw,
>>     RawInline = raw,
>>   }
>> }
>> ``````
>>
>> Notably this filter can be used to remove such "comments" from Markdown
>> output, while otherwise they will remain when reformatting Markdown source
>> with Pandoc, which IMO is an advantage over YAML comments.
>>
>> I hope this is useful for others,
>>
>> /bpj
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2%3DBE2T7kO0GA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/332666C5-9B8E-42B1-A9D2-2437FCE7B70E%40coolfortheblind.dk
>> <https://groups.google.com/d/msgid/pandoc-discuss/332666C5-9B8E-42B1-A9D2-2437FCE7B70E%40coolfortheblind.dk?utm_medium=email&utm_source=footer>
>> .
>>
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDBa8sm2VNKdQpdz_SsBvMYOfofJG-6-hjY6XrSL19nPA%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/m2zgi3p1vm.fsf%40johnmacfarlane.net.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-06-23 20:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 13:53 Tip: comments in Markdown BPJ
     [not found] ` <CADAJKhAYoUGxuA-xFBp699zqrYHTARhTLCmPjZ2=BE2T7kO0GA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-06-22 13:57   ` William Lupton
     [not found]     ` <CAEe_xxjAwFPZsCP3JMW+qHpfT2csgnei3pyE3RZT+aoUhYVwoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-06-22 17:48       ` BPJ
     [not found]         ` <CADAJKhDDy5y-KFmWcea6BwaL7S9Jk7piw-bf4RbYmBJtVQb2aA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-06-22 18:47           ` William Lupton
2022-06-22 17:55   ` John MacFarlane
2022-06-22 19:12   ` Thomas Byskov Dalgaard
     [not found]     ` <332666C5-9B8E-42B1-A9D2-2437FCE7B70E-AHfMSizzl90sTMJHDOTzqX9LOBIZ5rWg@public.gmane.org>
2022-06-23 10:18       ` BPJ
     [not found]         ` <CADAJKhDBa8sm2VNKdQpdz_SsBvMYOfofJG-6-hjY6XrSL19nPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-06-23 20:21           ` John MacFarlane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).