Skip to main content
Another option as an afterthought (using filters)
Source Link
ebpa
  • 7.6k
  • 32
  • 55

If there were a general org export option to do so I would expect to see it documented here: http://orgmode.org/manual/Export-settings.html#Export-settings. Looking directly at the source I don't see an option in the markdown export engine to do so either. Some options:

Quick-and-Dirty Solution™

If you are looking for the Quick-and-Dirty Solution™. You should probablycan redefine the org-md-link function to "format" link strings according to your preference. For example replacing The function can be trivially simple:

(defun my-org-md-link (link contents info) contents)

If that breaks something else in your output (unlikely) you can at the very least directly revise the output formatting lines like

(format "[%s](%s)" contents path)

with

(format "%s" contents path)

If you want to preserve the original behavior of the export engine in some circumstances you can register a derived export engine:

(org-export-define-derived-backend 'my-md 'md
    :menu-entry
     '(?M "Export to Markdown without links" (lambda (a s v b) (org-md-export-to-markdown a s v)))
    :translate-alist '((link . my-org-md-link)))

Add a filter which removes the links generated by ox-md (both better and worse)

The org export engine does have a mechanism that allows you a degree of flexibility to control the output of an export. See Filter Markup and Advanced Configuration.

(defun custom-md-link-filter (link backend info)
  "Rewrite markdown links in export to preserve link text only."
  (if (eq backend 'md)
      (replace-regexp-in-string "\\[\\([^]]*\\)\\]([^)]*)" "\\1" link)
    link)
(add-to-list 'org-export-filter-link-functions
              'custom-md-link-filter)

I agree with you theyou; a potential general org export option you are looking forwould be useful and would appropriately belong in the core export engine, so the translator of the selected export engine wouldn't even get called. Kudos to you if you submit a feature request (I would +1 that). If you do submit one-- post a link here for others to track it?

If there were a general org export option to do so I would expect to see it documented here: http://orgmode.org/manual/Export-settings.html#Export-settings. Looking directly at the source I don't see an option in the markdown export engine to do so either.

If you are looking for the Quick-and-Dirty Solution™. You should probably redefine the org-md-link function to "format" link strings according to your preference. For example replacing

(format "[%s](%s)" contents path)

with

(format "%s" contents path)

I agree with you the option you are looking for would appropriately belong in the core export engine, so the translator of the selected export engine wouldn't even get called. Kudos to you if you submit a feature request (I would +1 that). If you do submit one-- post a link here for others to track it?

If there were a general org export option to do so I would expect to see it documented here: http://orgmode.org/manual/Export-settings.html#Export-settings. Looking directly at the source I don't see an option in the markdown export engine to do so either. Some options:

Quick-and-Dirty Solution™

If you are looking for the Quick-and-Dirty Solution™. You can redefine the org-md-link function. The function can be trivially simple:

(defun my-org-md-link (link contents info) contents)

If that breaks something else in your output (unlikely) you can at the very least directly revise the output formatting lines like

(format "[%s](%s)" contents path)

with

(format "%s" contents path)

If you want to preserve the original behavior of the export engine in some circumstances you can register a derived export engine:

(org-export-define-derived-backend 'my-md 'md
    :menu-entry
     '(?M "Export to Markdown without links" (lambda (a s v b) (org-md-export-to-markdown a s v)))
    :translate-alist '((link . my-org-md-link)))

Add a filter which removes the links generated by ox-md (both better and worse)

The org export engine does have a mechanism that allows you a degree of flexibility to control the output of an export. See Filter Markup and Advanced Configuration.

(defun custom-md-link-filter (link backend info)
  "Rewrite markdown links in export to preserve link text only."
  (if (eq backend 'md)
      (replace-regexp-in-string "\\[\\([^]]*\\)\\]([^)]*)" "\\1" link)
    link)
(add-to-list 'org-export-filter-link-functions
              'custom-md-link-filter)

I agree with you; a potential general org export option would be useful and would appropriately belong in the core export engine, so the translator of the selected export engine wouldn't even get called. Kudos to you if you submit a feature request (I would +1 that). If you do submit one-- post a link here for others to track it

deleted 4 characters in body
Source Link
ebpa
  • 7.6k
  • 32
  • 55

If there were a general org export option to do so I would expect to see it documented here: http://orgmode.org/manual/Export-settings.html#Export-settings. Looking directly at the source for I don't see an option in the markdown export engine to do so either.

If you are looking for the Quick-and-Dirty Solution™. You should probably redefine the org-md-link function to "format" link strings according to your preference. For example replacing

(format "[%s](%s)" contents path)

with

(format "%s" contents path)

I agree with you the option you are looking for would appropriately belong in the core export engine, so the translator of the selected export engine wouldn't even get called. Kudos to you if you submit a feature request (I would +1 that). If you do submit one-- post a link here for others to track it?

If there were a general org export option to do so I would expect to see it documented here: http://orgmode.org/manual/Export-settings.html#Export-settings. Looking directly at the source for I don't see an option in the markdown export engine to do so either.

If you are looking for the Quick-and-Dirty Solution™. You should probably redefine the org-md-link function to "format" link strings according to your preference. For example replacing

(format "[%s](%s)" contents path)

with

(format "%s" contents path)

I agree with you the option you are looking for would appropriately belong in the core export engine, so the translator of the selected export engine wouldn't even get called. Kudos to you if you submit a feature request (I would +1 that). If you do submit one-- post a link here for others to track it?

If there were a general org export option to do so I would expect to see it documented here: http://orgmode.org/manual/Export-settings.html#Export-settings. Looking directly at the source I don't see an option in the markdown export engine to do so either.

If you are looking for the Quick-and-Dirty Solution™. You should probably redefine the org-md-link function to "format" link strings according to your preference. For example replacing

(format "[%s](%s)" contents path)

with

(format "%s" contents path)

I agree with you the option you are looking for would appropriately belong in the core export engine, so the translator of the selected export engine wouldn't even get called. Kudos to you if you submit a feature request (I would +1 that). If you do submit one-- post a link here for others to track it?

Source Link
ebpa
  • 7.6k
  • 32
  • 55

If there were a general org export option to do so I would expect to see it documented here: http://orgmode.org/manual/Export-settings.html#Export-settings. Looking directly at the source for I don't see an option in the markdown export engine to do so either.

If you are looking for the Quick-and-Dirty Solution™. You should probably redefine the org-md-link function to "format" link strings according to your preference. For example replacing

(format "[%s](%s)" contents path)

with

(format "%s" contents path)

I agree with you the option you are looking for would appropriately belong in the core export engine, so the translator of the selected export engine wouldn't even get called. Kudos to you if you submit a feature request (I would +1 that). If you do submit one-- post a link here for others to track it?